1 | Sample projects structure
|
2 | ```
|
3 | +-- dist // target folder
|
4 | +-- src
|
5 | | +-- package.json // module package.json
|
6 | angular-cli.json
|
7 | package.json // root package.json
|
8 | ```
|
9 | 1. Safety: add `"private":true` to your root `package.json`
|
10 |
|
11 | 2. Module package.json (see sample project structure above) should contain dependencies and peerDepencies of module, sample:
|
12 |
|
13 | ```json
|
14 | {
|
15 | "name": "ng2-bootstrap",
|
16 | "dependencies": {
|
17 | "moment": "*"
|
18 | },
|
19 | "peerDependencies": {
|
20 | "@angular/common": "*",
|
21 | "@angular/compiler": "*",
|
22 | "@angular/core": "*",
|
23 | "@angular/forms": "*"
|
24 | }
|
25 | }
|
26 | ```
|
27 |
|
28 | 3. Module configuration: by default `ngm` reads `angular-cli.json` in projects root
|
29 | ```json
|
30 | {
|
31 | "module":[{
|
32 | "name": "ng2-bootstrap",
|
33 | "root": "src",
|
34 | "outDir": "dist",
|
35 | "main":"index.ts",
|
36 | "tsconfig": "tsconfig.json"
|
37 | }]
|
38 | }
|
39 | ```
|
40 |
|
41 | 4. Running: just add `ngm` script to your root package.json (see sample project structure above)
|
42 |
|
43 | ```json
|
44 | "scripts": {
|
45 | "build": "ngm"
|
46 | }
|
47 | ```
|
48 |
|
49 | 5. Ready steady go:
|
50 | ```sh
|
51 | npm run build
|
52 | ```
|
53 |
|
54 | 6. Now you can go to `dist` folder and do `npm publish` (will be added as a command later)
|
55 |
|
\ | No newline at end of file |