This project is a library of reusable Angular components designed for consistent UI across multiple applications. It provides a common header and sidebar along with other shared UI elements to ensure a unified experience across government applications.
- Development Setup
- Code Scaffolding
- Building the Project
- Running Tests
- Publishing to JFrog Registry
- Sidebar and Header Documentation
- Additional Resources
To set up the development environment and run the application locally, follow these steps:
git clone <repository-url>
cd usgov-ui-commonMake sure you have Node.js (>=22.x, preferably LTS 20.x) and Angular CLI (>=19.1.4) installed. Then, run:
npm installTo launch the application, run:
ng serveOnce the server is running, open your browser and navigate to http://localhost:4200/. The application will automatically reload whenever you modify any of the source files.
To generate a new component, use:
ng generate component component-nameFor a complete list of available schematics (such as components, directives, or pipes), run:
ng generate --helpTo build the project, run:
ng buildThis compiles the project and stores the build artifacts in the dist/ directory. By default, the production build optimizes for performance and speed.
If you are building the UI library instead of the full application, run:
ng build ui-commonThis will generate the library package inside dist/ui-common/, ready for publishing.
To execute unit tests using Karma, run:
ng testFor end-to-end (e2e) testing, run:
ng e2eWhen you make updates to the ui-common package, you need to build and publish the new version to JFrog.
Before publishing, you must authenticate with the JFrog registry. If you haven't already, configure NPM to use JFrog:
npm config set registry <JFROG_REGISTRY_URL>
npm login- Replace
<JFROG_REGISTRY_URL>with the URL of your JFrog registry. - Enter your username and password/API token when prompted.
Each update requires a new version number. Update the version in projects/ui-common/package.json:
{
"name": "@lnx-le/ui-common",
"version": "0.0.2", // Increment this version
"description": "A library of reusable Angular components for USGOV applications"
}🚀 Use npm version to automatically bump versions:
npm version patch # For small fixes
npm version minor # For backward-compatible feature additions
npm version major # For breaking changes### If Changing Tokens
---
### **3️⃣ Build the Package**
Run the following to generate the `dist/ui-common/` directory:
```bash
ng build ui-common
💡 We are using Scoped Packages (@lnx-le/ui-common), you may need to set the scope manually:
npm config set @lnx-le:registry https://useast.jfrog.lexisnexisrisk.com/artifactory/api/npm/govweb-npm-dev-usLogin to the Registry:
npm login --registry=https://useast.jfrog.lexisnexisrisk.com/artifactory/api/npm/govweb-npm-dev-us/Navigate into the built package directory:
cd dist/ui-commonThen publish the package to JFrog:
npm publish --registry=<REGISTRY_URL>Example:
npm publish --registry=https://useast.jfrog.lexisnexisrisk.com/artifactory/api/npm/govweb-npm-dev-us/After publishing, check the JFrog registry to confirm the package was uploaded successfully.
Once the package is published, developers can install the latest version:
npm install @lnx-le/ui-common@latestThis project includes a common header and sidebar for consistent UI navigation. To learn more about their usage, customization, and integration, refer to the Sidebar and Header Guide.
For more information on using Angular CLI, including detailed command references, visit the Angular CLI Overview and Command Reference.
| Step | Command |
|---|---|
| Set up JFrog credentials | npm login |
| Update package version | npm version patch |
| Build the library | ng build ui-common |
| Navigate to built package | cd dist/ui-common |
| Publish to JFrog | npm publish --registry=<JFROG_REGISTRY_URL> |
| Verify package on JFrog | Manually check in the UI |
| Install latest package | npm install @lnx-le/ui-common@latest |
🚀 Now, every time you make updates to ui-common, just follow these steps to publish the latest version to JFrog! 🚀