@@ -76,26 +76,27 @@ include ../_util-fns
76
76
A library should have the following file layout when published:
77
77
78
78
.filetree
79
- .file node_modules/library-name
79
+ .file node_modules/angular- library-name
80
80
.children
81
- .file dist
82
- .children
83
- .file library-subfolders/...
84
- .file library-name.d.ts ('typings')
85
- .file library-name.es5.js ('module')
86
- .file library-name.js ('es2015')
87
- .file library-name.metadata.json
88
- .file library-name.umd.js ('main')
89
- .file library-name.umd.min.js
90
- .file index.d.ts
91
- .file module.d.ts
81
+ .file bundles
82
+ .children
83
+ .file angular-library-name.umd.js ('main' entry point)
84
+ .file angular-library-name.umd.js.map
85
+ .file angular-library-name.umd.min.js
86
+ .file angular-library-name.umd.min.js.map
87
+ .file src/*.d.ts
88
+ .file angular-library-name.d.ts ('typings' entry point)
89
+ .file angular-library-name.es5.js ('module' entry point)
90
+ .file angular-library-name.es5.js.map
91
+ .file angular-library-name.js ('es2015' entry point)
92
+ .file angular-library-name.js.map
93
+ .file angular-library-name.metadata.json
94
+ .file index.d.ts
92
95
.file LICENSE
93
- .file package.json
96
+ .file package.json (lists all entry points)
94
97
.file README.md
95
98
96
99
97
-
98
-
99
100
:marked
100
101
There is also a minified UMD bundle (`angular-quickstart-lib.umd.min.js`) for smaller payloads
101
102
in Plunkers and script tags.
@@ -195,29 +196,31 @@ a#seed
195
196
.file app.module.ts
196
197
.file lib
197
198
.children
198
- .file component
199
- .children
200
- .file lib.component.ts
201
- .file service
199
+ .file src
202
200
.children
203
- .file lib.service.ts
201
+ .file component
202
+ .children
203
+ .file lib.component.ts
204
+ .file service
205
+ .children
206
+ .file lib.service.ts
207
+ .file module.ts
204
208
.file index.ts
205
- .file module.ts
206
209
207
210
+ makeTabs(`
208
211
quickstart-lib/ts/src/demo/app/app.component.ts,
209
212
quickstart-lib/ts/src/demo/app/app.module.ts,
210
- quickstart-lib/ts/src/lib/component/lib.component.ts,
211
- quickstart-lib/ts/src/lib/service/lib.service.ts,
213
+ quickstart-lib/ts/src/lib/src/component/lib.component.ts,
214
+ quickstart-lib/ts/src/lib/src/service/lib.service.ts,
215
+ quickstart-lib/ts/src/lib/src/module.ts
212
216
quickstart-lib/ts/src/lib/index.ts,
213
- quickstart-lib/ts/src/lib/module.ts
214
217
` , '' , `
215
218
src/demo/app/app.component.ts,
216
219
src/demo/app/app.module.ts,
217
- src/lib/component/lib.component.ts,
218
- src/lib/service/lib.service.ts,
219
- src/lib/index .ts,
220
- src/lib/module .ts
220
+ src/lib/src/ component/lib.component.ts,
221
+ src/lib/src/ service/lib.service.ts,
222
+ src/lib/src/module .ts,
223
+ src/lib/index .ts
221
224
` )( format ='.' )
222
225
223
226
:marked
@@ -254,25 +257,25 @@ table(width="100%")
254
257
:marked
255
258
A demo `NgModule` that imports the Library `LibModule`.
256
259
tr
257
- td <ngio-ex >lib/component/app.component.ts</ngio-ex >
260
+ td <ngio-ex >lib/src/ component/app.component.ts</ngio-ex >
258
261
td
259
262
:marked
260
263
A sample library component that renders an `<h2>` tag.
261
264
tr
262
- td <code >lib/service/lib.service.ts</code >
265
+ td <code >lib/src/ service/lib.service.ts</code >
263
266
td
264
267
:marked
265
268
A sample library service that exports a value.
266
269
tr
267
- td <code >lib/index .ts</code >
270
+ td <code >lib/src/module .ts</code >
268
271
td
269
272
:marked
270
- The public API of your library, where you choose what to export to consumers .
273
+ The library's main `NgModule`, `LibModule` .
271
274
tr
272
- td <code >lib/module .ts</code >
275
+ td <code >lib/index .ts</code >
273
276
td
274
277
:marked
275
- The library's main `NgModule`, `LibModule` .
278
+ The public API of your library, where you choose what to export to consumers .
276
279
277
280
278
281
.l-main-section
@@ -288,6 +291,7 @@ table(width="100%")
288
291
- Inline html and css inside the generated JavaScript files.
289
292
- Copy typings, metatada, html and css.
290
293
- Create each bundle using Rollup.
294
+ - Copy `LICENSE`, `package.json` and `README.md` files
291
295
292
296
293
297
.l-main-section
@@ -322,15 +326,13 @@ table(width="100%")
322
326
323
327
You can also test your library by installing it in another local repository you have.
324
328
To do so, first build your lib via `npm run build`.
325
- Then install it from your other repo using a relative path: `npm install relative/path/to/lib`.
329
+ Then install it from your other repo using a relative path to the dist folder:
330
+ `npm install relative/path/to/library/dist`.
326
331
327
332
.l-main-section
328
333
:marked
329
334
## Publishing your library
330
335
331
- The `.npmignore` file defines what files and folders will be published to NPM: `dist/`,
332
- `LICENSE`, `package.json` and `README.md`.
333
-
334
336
Every package on NPM has a unique name, and so should yours.
335
337
If you haven't already, now is the time to change the name of your library.
336
338
@@ -358,8 +360,9 @@ table(width="100%")
358
360
After you have changed the package name, you can publish it to NPM (read
359
361
[this link](https://docs.npmjs.com/getting-started/publishing-npm-packages) for details).
360
362
361
- You'll need to create a NPM account, login on your local machine, and then you can publish updated
362
- by running `npm publish`.
363
+ First you'll need to create a NPM account and login on your local machine.
364
+ Then you can publish your package by running `npm publish dist/`.
365
+ Since your package is built on the `dist/` folder this is the one you should publish.
363
366
364
367
.l-sub-section
365
368
:marked
0 commit comments