0.1.2 • Published 8 years ago
huypq-angular-draggable v0.1.2
Step to create and publish new angular 2 package to npmjs.com (reference https://github.com/jvandemo/generator-angular2-library)
- Setup environment:
Install
npmhttps://nodejs.org/enInstall
angular
npm install -g @angular/cli- Install
gulp:
npm install -g gulp
npm install -g gulp-cli- If
node_modulesin root folder (angular), run:
npm installCopy
lib-namefolder, rename toyour-lib-nameReplace
lib-nametext in 4 file toyour-lib-nameas below:
gulpfile.js(2 hits) - Line 128: name: 'lib-name', - Line 136: .pipe(rename('lib-name.umd.js'))package.json(1 hit) - Line 2: "name": "lib-name",src\package.json(5 hits) - Line 2: "name": "lib-name", - Line 19: "main": "lib-name.umd.js", - Line 20: "module": "lib-name.js", - Line 21: "jsnext:main": "lib-name.js", - Line 22: "typings": "lib-name.d.ts",src\tsconfig.es5.json(2 hits) - Line 24: "flatModuleOutFile": "lib-name.js", - Line 25: "flatModuleId": "lib-name"
Create symbolic link to
node_modules:- open cmd (with Administrator previllage if needed), cd to
your-lib-name - run mklink /d node_modules ..\node_modules
- open cmd (with Administrator previllage if needed), cd to
Replace
srcfolder content to your lib content, but must keep 3 config file (.json):- Can replace:
-
h-sample.component.html-h-sample.component.css-h-sample.component.ts-index.ts - Must keep:
-
package.json-tsconfig.es5.json-tsconfig.spec.json
- Can replace:
-
Build lib:
nmp run build- Publish to nmpjs.com: (need increase version package.json before publish)
npm publish dist