0.1.1 • Published 6 years ago

huypq-angular-datepicker v0.1.1

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

Step to create and publish new angular 2 package to npmjs.com (reference https://github.com/jvandemo/generator-angular2-library)

  1. Setup environment:
npm install -g @angular/cli
  • Install gulp:
npm install -g gulp
npm install -g gulp-cli
  1. If node_modules in root folder (angular), run:
npm install
  1. Copy lib-name folder, rename to your-lib-name

  2. Replace lib-name text in 4 file to your-lib-name as 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"
  1. 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
  2. Replace src folder 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
  3. Build lib:

nmp run build
  1. Publish to nmpjs.com: (need increase version package.json before publish)
npm publish dist