SourceGuard Frontend Components - Deployment Guide
Overview
The SourceGuard Frontend Components library is a comprehensive React component library designed for security and vulnerability management applications. This library provides a collection of reusable UI components, internationalization support, and TypeScript definitions for building modern security-focused web applications.
Installation
Prerequisites
- Node.js (version 16 or higher)
- npm or yarn package manager
- React 18.2.0 or higher
- Access to Sparkle-Techbank private registry
Setting Up Registry Access
-
Generate Authentication Token
Visit GitLab and navigate to:
Profile → Access Tokens → Add new tokenOr alternatively:
User Settings → Access Tokens → Personal Access TokensToken Scopes: Select
apiandread_registryscopes for npm package access.⚠️ Important: Copy your token immediately as it will only be shown once.
-
Configure NPM Registry
Add the following to your local
~/.npmrcfile:@Sparkle-Techbank:registry=https://gitlab.sparkle-in-tech.com/api/v4/packages/npm/
//gitlab.sparkle-in-tech.com/api/v4/packages/npm/:_authToken=[YOUR_AUTH_TOKEN]Replace
[YOUR_AUTH_TOKEN]with the token generated in step 1. -
Install the Package
npm install @Sparkle-Techbank/sourceguard-frontend-components@[VERSION]Replace
[VERSION]with the desired version (e.g.,0.0.5-rc27).
Development Setup
Local Development Environment
-
Clone the Repository
git clone [REPOSITORY_URL]
cd source-guard-frontend-component -
Install Dependencies
npm install -
Install Yalc (for local development)
npm install -g yalc -
Start Development Server
npm run start
# or for webpack dev server
npm run start-server -
Build for Development
npm run build-dev -
Build for Production
npm run build-prod
Local Development with Yalc
Yalc allows you to test your component library locally in consuming projects without publishing to the registry. This is essential for rapid development and testing.
Setting Up Yalc Workflow
-
Build and Publish to Yalc Store (fisrt time setup)
npm run yalc:publishThis will:
- Build the library
- Publish it to the local Yalc store
- Make it available for local consumption
-
Push to Yalc Store (after changes)
npm run yalc:pushThis will:
- Push the changes to the local Yalc store
Using in Consuming Projects
-
Add the Library from Yalc
In your consuming project:
yalc add @Sparkle-Techbank/sourceguard-frontend-components
npm install -
Update When Changes are Made
yalc update @Sparkle-Techbank/sourceguard-frontend-components -
Remove Yalc Package (when done testing)
yalc remove @Sparkle-Techbank/sourceguard-frontend-components
npm install @Sparkle-Techbank/sourceguard-frontend-components@[VERSION]
Development Scripts
| Script | Description |
|---|---|
npm run start | Start React development server |
npm run start-server | Start Webpack dev server with hot reload |
npm run build | Build library for development |
npm run build-dev | Build library in development mode |
npm run build-prod | Build library in production mode |
npm run prepublish | Clean and build before publishing |
npm run clean | Remove dist directory |
npm run yalc:publish | Build and publish to local Yalc store |
npm run yalc:watch | Watch mode - auto rebuild and push to Yalc |
npm run yalc:push | Push current build to Yalc consumers |
Publishing
Pre-Publishing Checklist
- Update Version: Increment version in
package.json - Test Build: Ensure clean build without errors
- Review Changes: Verify all changes are intended
- Update Documentation: Update any relevant documentation
Publishing Process
-
Prepare Build
npm run prepublishThis command:
- Removes existing
distdirectory - Builds the library in development mode
- Generates TypeScript definitions
- Removes existing
-
Publish to Registry
npm publish -
Verify Publication Check the package is available at: GitLab Packages