@priyankasakat/shared-ui-library
v1.0.3
Published
A centralized React + TypeScript shared library designed for Micro Frontend (MFE) architecture. This library will be consumed by the Host application and all Remote applications as a reusable NPM package.
Maintainers
Readme
NMS Shared UI Library
A centralized React + TypeScript shared library designed for Micro Frontend (MFE) architecture. This library will be consumed by the Host application and all Remote applications as a reusable NPM package.
Prerequisites
Ensure the following are installed on your machine:
node -v
npm -vRecommended:
Node.js >= 22
npm >= 10Install Dependencies
npm installProject Structure
src
│
├── api
├── components
├── hooks
├── layouts
├── themes
├── types
├── utils
│
└── index.ts
docs/
README.md
CONTRIBUTING.md
package.json
tsconfig.json
vite.config.ts
eslint.config.js
.prettierrcAvailable Scripts
Start Development Server
npm run devRun TypeScript Validation
npx tsc --noEmitValidates TypeScript configuration without generating build files.
Run ESLint
npm run lintChecks code quality and coding standards.
Format Source Code
npm run formatFormats source files using Prettier.
Build Library
npm run buildGenerates build artifacts inside the dist folder.
Expected output:
dist/
├── index.js
├── index.d.tsGenerate Local NPM Package
npm packExpected output:
nms-shared-ui-library-1.0.0.tgzDevelopment Workflow
Step 1: Install Dependencies
npm installStep 2: Validate TypeScript
npx tsc --noEmitStep 3: Run Linting
npm run lintStep 4: Format Code
npm run formatStep 5: Build Library
npm run buildStep 6: Generate Package
npm packVerify Build Artifacts
After successful build:
npm run buildVerify:
dist/
├── index.js
├── index.d.tsVerify Package Generation
Generate package:
npm packVerify generated file:
nms-shared-ui-library-1.0.0.tgzTest Local Installation
Create a sample consumer application:
mkdir test-consumer
cd test-consumer
npm init -yInstall generated package:
npm install ../nms-shared-ui-library/nms-shared-ui-library-1.0.0.tgzVerify installation:
npm ls @nms/shared-ui-libraryPackage Usage Example
import {} from '@nms/shared-ui-library';Acceptance Criteria Verification
Run all commands successfully:
npx tsc --noEmit
npm run lint
npm run format
npm run build
npm packSuccessful execution confirms:
- TypeScript configuration is valid
- ESLint configuration is valid
- Prettier configuration is valid
- Build completes successfully
- Package artifacts are generated successfully
- Package can be distributed through NPM
- Package can be consumed by Host and MFE applications
Coding Standards
- Use TypeScript Strict Mode
- Use Functional Components
- Use Named Exports
- Follow ESLint rules
- Follow Prettier formatting
- Write reusable and generic code
- Avoid application-specific business logic
- Follow project folder structure and naming conventions
Future Scope
The following features will be implemented in upcoming stories:
- Design Tokens
- Theme Configuration
- Core Components (Button, Input, Select, Checkbox, Radio, TextArea)
- Layout Components
- Advanced Components
- Storybook Integration
- Unit Testing
- CI/CD Pipeline
- Organizational NPM Registry Publishing