Welcome to your Angular Workspace, a structured environment for developing, testing, and publishing Angular libraries. This guide will walk you through essential commands and workflows to streamline your library management and ensure a smooth and professional development process.
Make sure you have the following installed:
After installing Node.js, globally install the Angular CLI to manage your Angular projects:
npm install -g @angular/cli@latest
-
Clone the repository.
-
Install the project dependencies with the following command:
npm install
Note: Library-specific dependencies must be installed inside each library's directory.
The workspace is organized to separate library development from distribution-ready builds:
└── simple-angular-libraries/
├── LICENSE
├── README.md
├── angular.json
├── package-lock.json
├── package.json
├── projects
│ ├── your-library
│ └── testing
├── scripts
│ ├── build.js
│ └── publish.js
└── tsconfig.json
Here’s a breakdown of the key npm scripts available in this workspace, designed to assist you at different stages of development, from testing to publishing.
The following command helps you create a new Angular library within your workspace:
npm run generate:library
This command runs the Angular CLI ng generate library
with the --standalone=false
option. It
will prompt you to provide a name for the new library and then scaffold the necessary files and
folder structure, integrating the new library into your workspace.
This command compiles your library with production optimizations. The output is placed in the
dist/your-library
directory, ready for distribution or further testing.
npm run build
You will be prompted to specify the correct library name you want to build.
To start a local development server and test your library in real-time with live reloading, use:
npm run test
Note: Before testing, ensure you have built your library using npm run build
. Import your
library module in app.module
, and use your library component's selector inside app.component
.
Publishing your library involves versioning and uploading it to the npm registry.
npm run publish
This command will prompt you to specify the correct library name for publishing and the type of version increment. Below is a high-level overview of version increments:
-
Patch Version: For backward-compatible bug fixes or small improvements (e.g.,
1.0.0
to1.0.1
). -
Minor Version: For backward-compatible enhancements or new features (e.g.,
1.0.0
to1.1.0
). -
Major Version: For significant changes that are not backward-compatible (e.g.,
1.0.0
to2.0.0
).
The publishing process performs the following steps:
-
Authenticate with npm: The command will prompt you to log in to npm, ensuring you have the appropriate permissions.
-
Publish: Once authenticated, the library is published to npm using
npm publish --access public
, making it publicly available.
- Author: Karan Gupta
- LinkedIn: Karan Gupta
- GitHub: Karan Gupta
- Contact: +91-8396919047
- Email: karangupta0005@gmail.com
Contributions are welcome! Here’s how you can contribute:
-
Fork the Repository: Start by forking the project to your GitHub account.
-
Clone Locally: Clone the forked repository to your local machine.
git clone https://github.com/Karan0005/simple-angular-libraries
-
Create a New Branch: Create a new branch for your changes with a descriptive name.
git checkout -b new-feature-x
-
Make Your Changes: Develop and test your changes locally.
-
Commit Your Changes: Commit with a clear message describing your updates.
git commit -m 'Implemented new feature x.'
-
Push to GitHub: Push the changes to your forked repository.
git push origin new-feature-x
-
Submit a Pull Request: Create a PR against the original repository. Clearly describe the changes and their purpose.
-
Review: Once your PR is reviewed and approved, it will be merged. Thank you for your contribution!
For reporting issues, visit the Issues Page.
This project is licensed under the MIT License.