|
9 | 9 |
|
10 | 10 | Prerequisites: **You will first want to make sure the library adheres to the Publisher Guide**
|
11 | 11 |
|
12 |
| -How do I find this out? |
| 12 | +How do I find that out? |
13 | 13 |
|
14 |
| -1. Find the root file in the 3rd party library repo you are interested in |
15 |
| -2. Take a look at the root file (should be the same name as the repo itself in most cases) |
16 |
| -3. If you see `export default { ...some angular2 metadata... }` at the bottom, then the chances are high it's compatible |
17 |
| -4. If you don't see it, [click here](#suggest-a-repo-adhere-to-the-publisher-guide) to copy/paste a feature request to post on the library repo |
| 14 | +1. Look inside the root file of the 3rd party library repo (should be the same name as the repo itself in most cases) |
| 15 | +2. If you see `export default { ...some angular2 metadata... }` at the bottom, then the chances are high it's compatible |
| 16 | +3. If you don't see it, [click here](#suggest-a-repo-adhere-to-the-publisher-guide) to copy/paste a feature request to post on the library repo |
18 | 17 |
|
19 | 18 | ### Ok I'm ready, let's do this!
|
20 | 19 |
|
@@ -63,14 +62,13 @@ Providers imported in ~/project/src/app.ts
|
63 | 62 | Done.
|
64 | 63 | ```
|
65 | 64 |
|
66 |
| -You library is now successfully installed and injected into your project. |
| 65 | +Your library is now successfully installed and injected into your project. |
67 | 66 |
|
68 | 67 | In this example we chose to inject a `Directive`.
|
69 | 68 | Specifically we chose `TestDirective` to be injected into `~/project/src/app/project.ts`.
|
70 | 69 | Upon quitting, we were given the opportunity to inject providers into our bootstrap script. We chose `Y(es)` and specified `~/project/src/app.ts`. Providers were then injected into our bootstrap script.
|
71 | 70 |
|
72 |
| -However, if we don't want that the library to auto-inject anything, we can just answer `N(o)` to the first question. |
73 |
| - |
| 71 | +However, if you don't want to auto-inject anything, you can just answer `N(o)` to the first question. |
74 | 72 | Example:
|
75 | 73 |
|
76 | 74 | ````shell
|
@@ -145,6 +143,12 @@ builder
|
145 | 143 | ````
|
146 | 144 |
|
147 | 145 | Just include this script in the root of your app named like `bundler-script.js` and run it before publishing your library to `npm`.
|
| 146 | +Example of a `prepublish` script in `package.json`: |
| 147 | +``` |
| 148 | +"scripts": { |
| 149 | + "prepublish": "tsc && tsc -d && node bundler-script.js" |
| 150 | +} |
| 151 | +``` |
148 | 152 |
|
149 | 153 | Note that when TypeScript version 1.8 is out of `beta`, this script will no longer be needed and this documentation will be updated.
|
150 | 154 |
|
@@ -174,7 +178,7 @@ export * from './src/app/test.styles';
|
174 | 178 |
|
175 | 179 | // This is the magic.
|
176 | 180 | // Provides a standard way to export your library to allow angular-cli to help developers setup your library
|
177 |
| -// Please note: keys are optional. Your library can provide any metadata is provides. |
| 181 | +// Please note: keys are optional. Your library should provide any metadata you want to be consumable. |
178 | 182 | export default {
|
179 | 183 | directives: [TestDirective],
|
180 | 184 | pipes: [TestPipe],
|
|
0 commit comments