This project was generated using Angular CLI version 18.2.11.
This boilerplate helps you quickly set up and develop Angular libraries. It includes a pre-configured structure for components, services, utilities, themes, assets, and more. The project is optimized for scalability and maintainability.
- Pre-configured folder structure for Angular libraries.
- Automatic barrel file generation for cleaner imports.
- Support for custom themes, assets, styles, and fonts.
- Ready-to-use Angular Material theme integration.
- Built-in support for unit testing with Karma and Jasmine.
- Easy publishing to npm or private repositories.
Use the following command to create a new Angular library:
npx ngx-lib-starter-kit my-libOR
Clone the repository and navigate to the project directory:
git clone https://github.com/your-repo/ngx-lib-starter-kit.git
cd ngx-lib-starter-kitInstall all required dependencies:
npm installOR
npm iDefine the necessary structures based on your project requirements and remove any unnecessary files or folders.
Rename the project in package.json and angular.json to match your library's name:
- Open
package.jsonand update the"name"field:{ "name": "your-library-name" } - Open
angular.jsonand update the"defaultProject"field:{ "defaultProject": "your-library-name" }
Customize the folder structure to suit your library's needs. For example:
- Place reusable components in the
src/componentsfolder. - Add services to the
src/servicesfolder. - Store utility functions in the
src/utilsfolder. - Keep styles and themes in the
src/stylesfolder.
Delete any files or folders that are not required for your library. For example:
- Remove unused assets from the
src/assetsfolder. - Delete example components or services and ....
Ensure the README.md file reflects the changes made to the structure and provides clear instructions for contributors and users.
Build the library for distribution:
npm run buildBefore publishing the library, ensure the following configurations are in place:
- Verify the
namefield matches your library's name. - Ensure the
versionfield follows Semantic Versioning. - Add a
description,keywords, andauthorfield to improve discoverability. - Specify the
mainandmoduleentry points for your library:{ "main": "dist/your-library-name/bundles/your-library-name.umd.js", "module": "dist/your-library-name/fesm2015/your-library-name.js", "types": "dist/your-library-name/your-library-name.d.ts" } - Add a
filesfield to include only necessary files in the package:{ "files": [ "dist/", "README.md", "LICENSE" ] }
Run the build command to generate the distribution files:
npm run buildAuthenticate with your npm account:
npm loginPublish the library to npm or a private repository:
npm publish --access publicFor private repositories, ensure the publishConfig field in package.json is set correctly:
{
"publishConfig": {
"registry": "https://your-private-registry-url/"
}
}After publishing, verify the package is available by installing it in a test project:
npm install your-library-nameRun unit tests with the Karma test runner:
npm run testEnsure your code adheres to best practices by running ESLint:
npm run lintContributions are welcome! Please follow these steps:
- Fork the repository.
- Create a new branch for your feature or bugfix.
- Commit your changes and push the branch.
- Open a pull request.
This project is licensed under the MIT License. See the LICENSE file for details.