Publishing an Angular library to npm
We have already seen how to build an Angular library and consume it in an Angular application when both exist in the same repository or organization. However, there are cases where you may want to make your library available to Angular projects outside your infrastructure via a public package registry such as npm
. A usual case is when you want to make your library open source so that other members in the development community can benefit from this. Let's see how to publish our ui-controls
library to npm
, as follows:
- If you do not have an
npm
account, navigate to https://www.npmjs.com/signup to create one. Otherwise, continue to Step 3. - Enter the following details and click the Create an Account button:
After your account has been created, you will be redirected to your profile page in
npm
. - Open the
package.json
file that exists in theprojects\ui-controls
folder of the Angular CLI workspace...