You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 4, 2017. It is now read-only.
To create a more flexible developer experience, a JIT compatible build of the library should be published as well. The format of the JIT bundle is `umd`, which stands for Universal Module Definition. Shipping the bundle as `umd` ensures compatibility with most common module loading formats.
385
394
386
395
The `umd` bundle will ship as a single file containing ES5 JavaScript and inlined versions of any external templates or css.
396
+
397
+
398
+
.l-main-section
399
+
:marked
400
+
## Appendix: Dependency Management
401
+
402
+
As a library maintainer, it's important to properly manage your dependencies in `package.json`.
403
+
404
+
There are [three kinds of dependencies](https://docs.npmjs.com/files/package.json#dependencies):
405
+
`dependencies`, `devDependencies` and `peerDependencies`.
406
+
407
+
- `dependencies`: here go all the other libraries yours depends on when being used.
408
+
A good way to figure out these is to go through your library source code (in `src/lib` **only**)
409
+
and list all the libraries there.
410
+
- `devDependencies`: libraries that you need while developing, testing and building your app
411
+
go here.
412
+
When a user installs your library, these won't be installed.
413
+
Users don't need to develop, build or test your library, they just need to run it.
414
+
your app.
415
+
- `peerDependencies`: these are similar to `dependencies` since your library expects them to be
416
+
there at runtime.
417
+
The difference is that you don't want to install a new version of these, but instead use
418
+
the one already available.
419
+
420
+
A good example of a peer dependency is `@angular/core` and all other main Angular libraries.
421
+
If you listed these in `dependencies`, a new one - with a different version! - could be installed
422
+
for your library to use.
423
+
This isn't what you wanted though. You want your library to use *the exact same* `@angular/core`
424
+
that the app is using.
425
+
426
+
You'll usually used `@angular/*` libraries listed in both `devDependencies` and
427
+
`peerDependencies`.
428
+
This is normal and expected, because when you're developing your library also need a copy of
429
+
them installed.
430
+
431
+
Another thing to remember is to keep your dependencies from changing too much unexpectedly.
432
+
Different versions of libraries can have different features, and if you inadvertently are too
433
+
lenient with allowed versions your library might stop working because a dependency changed.
434
+
435
+
You can choose what versions you allow by using [ranges](https://docs.npmjs.com/misc/semver).
436
+
437
+
A good rule of thumb is to have all `dependencies` specified with a tilde `~`(`~1.2.3`),
438
+
while your `peerDependencies` have a range (`"@angular/core": ">=4.0.0 <5.0.0 || >=4.0.0-beta <5.0.0"`).
0 commit comments