node package manager
Don’t reinvent the wheel. Reuse code within your team. Create a free org »

ngm-cli

Sample projects structure

+-- dist // target folder
+-- src
|   +-- package.json // module package.json
angular-cli.json
package.json // root package.json
  1. Safety: add "private":true to your root package.json

  2. Module package.json (see sample project structure above) should contain dependencies and peerDepencies of module, sample:

{
  "name": "ng2-bootstrap",
  "dependencies": {
    "moment": "*"
  },
  "peerDependencies": {
    "@angular/common": "*",
    "@angular/compiler": "*",
    "@angular/core": "*",
    "@angular/forms": "*"
  }
}
  1. Module configuration: by default ngm reads angular-cli.json in projects root
{
  "module":[{
    "name": "ng2-bootstrap",
    "root": "src",
    "outDir": "dist",
    "main":"index.ts",
    "tsconfig": "tsconfig.json"
  }]
}
  1. Running: just add ngm script to your root package.json (see sample project structure above)
  "scripts"{
    "build": "ngm"
  }
  1. Ready steady go:
npm run build
  1. Now you can go to dist folder and do npm publish (will be added as a command later)