Credits

Contributors

Backers

Sponsors

Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [Become a sponsor]

Usage Example

Let's walk through a getting started that'll build an Angular library from TypeScript sources and create a distribution-ready npm package:
create a package.json file, add the custom ngPackage property, and eventually run ng-packagr -p package.json
– Here we go:

Note 1: Paths in the ngPackage section are resolved relative to the location of the package.json file.
In the above example, public_api.ts is the entry file to the library's sources and must be placed next to package.json (a sibling in the same folder).

Note 2: referencing the $schema enables JSON editing support (auto-completion for configuration) in IDEs like VSCode.

You can easily run ng-packagr through a npm/yarn script:

{
"scripts": {
"build": "ng-packagr -p package.json"
}
}

Now, execute the build with the following command:

$ yarn build

The build output is written to the dist folder, containing all those binaries to meet the Angular Package Format specification.
You'll now be able to go ahead and npm publish dist your Angular library to the npm registry.

Do you like to publish more libraries?
Is your code living in a monorepo?
Create one package.json per npm package, run ng-packagr for each!