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-lib
OR
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-kit
Install all required dependencies:
npm install
OR
npm i
Define 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.json
and update the"name"
field:{ "name": "your-library-name" }
- Open
angular.json
and 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/components
folder. - Add services to the
src/services
folder. - Store utility functions in the
src/utils
folder. - Keep styles and themes in the
src/styles
folder.
Delete any files or folders that are not required for your library. For example:
- Remove unused assets from the
src/assets
folder. - 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 build
Before publishing the library, ensure the following configurations are in place:
- Verify the
name
field matches your library's name. - Ensure the
version
field follows Semantic Versioning. - Add a
description
,keywords
, andauthor
field to improve discoverability. - Specify the
main
andmodule
entry 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
files
field to include only necessary files in the package:{ "files": [ "dist/", "README.md", "LICENSE" ] }
Run the build command to generate the distribution files:
npm run build
Authenticate with your npm account:
npm login
Publish the library to npm or a private repository:
npm publish --access public
For 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-name
Run unit tests with the Karma test runner:
npm run test
Ensure your code adheres to best practices by running ESLint:
npm run lint
Contributions 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.