
Security News
Browserslist-rs Gets Major Refactor, Cutting Binary Size by Over 1MB
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
angular-library-builder
Advanced tools
CLI Tool to build Angular (2+) libraries ready to be published to npm
It's a CLI Tool to build Angular (2+) libraries ready to be published to npm.
At the moment there is no official documentation/guidelines on how to build and publish Angular (2+) components/libraries/services/modules to npm. Angular Library Builder (nglb) is trying to solve this in the easiest way possible.
templateUrl
with template
stylesUrls
with styles
. It uses:
*.d.ts
, *.js
, *.js.map
, *.metadata.json
filesangular-library-builder
commandnpm install --save-dev angular-library-builder
angular-library-builder
?Add angular-library-builder (nglb) script, main and types to package.json
:
"main": "./lib-dist/your-main-file.js",
"types": "./lib-dist/your-main-file.d.ts",
"scripts": {
"build:library": "nglb --rootDir src/lib --outDir lib-dist"
}
or
"main": "./lib-dist/your-main-file.js",
"types": "./lib-dist/your-main-file.d.ts",
"scripts": {
"build:library": "angular-library-builder --rootDir src/lib --outDir lib-dist"
}
Now, in your project root:
npm run build:library
Congratulations! Your library is available in lib-dist folder ready to be published to npm.
To publish your new library to npm, execute the following command in your project root:
npm publish
angular-library-builder
supportsoption (argument) | description |
---|---|
--rootDir | Specifies the root directory of input files. Example: nglb --rootDir src , [required] |
--outDir | Redirect output structure to the directory. Example: nglb --outDir dist , [required] |
--tsconfig | Possibility to extend/override properties in default tsconfig-ngc.json. Example: nglb --tsconfig path/to/your/override-tsconfig-ngc.json |
--help (-h) | Print help message |
angular-library-builder
tsconfig-ngc.json default properties?Sometimes the defaults aren't good enough for everybody.
Let's imagine that you want to change slightly the build process:
To acomplish this create a file called, for example, override-tsconfig-ngc.json
in your project root.
Your override-tsconfig-ngc.json
file can be something like:
{
"compilerOptions": {
"target": "es2015",
"noImplicitAny": true
}
}
Then, you invoke nglb like this:
nglb --rootDir path/to/your/source --outDir path/to/dist --tsconfig override-tsconfig-ngc.json
@bmvantunes (Bruno Antunes, author)
Special thanks to gulp-inline-ng2-template. Without gulp-inline-ng2-template angular-library-builder
would not be possible!
The repository code is open-sourced software licensed under the MIT license.
FAQs
CLI Tool to build Angular (2+) libraries ready to be published to npm
The npm package angular-library-builder receives a total of 43 weekly downloads. As such, angular-library-builder popularity was classified as not popular.
We found that angular-library-builder demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.
Security News
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.