diff --git a/LIBRARY_EXTRACTION_PLAN.md b/LIBRARY_EXTRACTION_PLAN.md new file mode 100644 index 0000000..40c7d92 --- /dev/null +++ b/LIBRARY_EXTRACTION_PLAN.md @@ -0,0 +1,138 @@ +# Library Extraction Plan + +## Overview +Convert current Angular workspace with 12 libraries into individual Git repositories for submodule distribution. + +## Dependencies Analysis + +### Core Libraries (No internal dependencies) +1. **ui-design-system** - Foundation styles and tokens +2. **shared-utils** - Utility functions +3. **ui-data-utils** - Data manipulation utilities +4. **ui-animations** - Animation utilities +5. **ui-accessibility** - Accessibility features +6. **ui-backgrounds** - Background utilities +7. **ui-font-manager** - Font management +8. **hcl-studio** - Color management +9. **auth-client** - Authentication + +### Special Dependencies +- **ui-code-display** - Has prismjs and @types/prismjs dependencies +- **ui-essentials** - Likely depends on ui-design-system for styling +- **ui-landing-pages** - May depend on ui-essentials for components + +## Extraction Order (Dependencies First) + +### Phase 1: Foundation Libraries +1. **ui-design-system** (SCSS foundation) +2. **shared-utils** (utility foundation) +3. **ui-data-utils** (data utilities) + +### Phase 2: Standalone Libraries +4. **ui-animations** +5. **ui-accessibility** +6. **ui-backgrounds** +7. **ui-font-manager** +8. **hcl-studio** +9. **auth-client** + +### Phase 3: Dependent Libraries +10. **ui-code-display** (has external deps) +11. **ui-essentials** (may depend on ui-design-system) +12. **ui-landing-pages** (may depend on ui-essentials) + +## Repository Structure Template + +Each repository will have: +``` +library-name/ +├── .gitignore +├── README.md +├── CHANGELOG.md +├── LICENSE +├── package.json +├── ng-package.json +├── tsconfig.lib.json +├── tsconfig.lib.prod.json +├── tsconfig.spec.json +├── karma.conf.js +├── src/ +│ ├── lib/ +│ │ └── [library source files] +│ ├── public-api.ts +│ └── test.ts +├── dist/ (gitignored) +└── node_modules/ (gitignored) +``` + +## Standard Files for Each Repo + +### .gitignore +``` +/node_modules/ +/dist/ +*.tsbuildinfo +.DS_Store +Thumbs.db +``` + +### README.md Template +```markdown +# [Library Name] + +## Installation +```bash +git submodule add https://github.com/yourorg/[library-name].git libs/[library-name] +``` + +## Usage +[Usage examples] + +## Development +```bash +npm install +npm test +npm run build +``` +``` + +### package.json (standalone) +- Remove workspace references +- Add necessary build scripts +- Include all required dependencies + +## Implementation Steps + +1. **Create base template repository** +2. **Extract libraries in dependency order** +3. **Test each library builds independently** +4. **Create consumer integration example** +5. **Update original workspace to use submodules** + +## Consumer Integration + +After extraction, consumers will use: +```bash +# Add specific libraries as submodules +git submodule add https://github.com/yourorg/ui-design-system.git libs/ui-design-system +git submodule add https://github.com/yourorg/ui-essentials.git libs/ui-essentials + +# Update tsconfig.json +{ + "paths": { + "ui-design-system": ["./libs/ui-design-system/dist"], + "ui-essentials": ["./libs/ui-essentials/dist"] + } +} + +# Build libraries +cd libs/ui-design-system && npm run build +cd libs/ui-essentials && npm run build +``` + +## Benefits +- ✅ Clean, focused repositories for LLM analysis +- ✅ Independent versioning and releases +- ✅ Selective library inclusion +- ✅ Professional library distribution +- ✅ Reusable across multiple projects \ No newline at end of file diff --git a/SUBMODULE_INTEGRATION_GUIDE.md b/SUBMODULE_INTEGRATION_GUIDE.md new file mode 100644 index 0000000..24d86ba --- /dev/null +++ b/SUBMODULE_INTEGRATION_GUIDE.md @@ -0,0 +1,185 @@ +# Git Submodule Integration Guide + +## 🎯 Implementation Complete! + +All 12 libraries have been successfully extracted into individual repositories ready for Git submodule distribution. + +## 📦 Extracted Libraries + +### Foundation Libraries +1. **ui-design-system** - SCSS design system with tokens and fonts +2. **shared-utils** - Common utilities and shared services +3. **ui-data-utils** - Data manipulation utilities + +### Standalone Libraries +4. **ui-animations** - CSS animation utilities +5. **ui-accessibility** - Accessibility features and WCAG compliance +6. **ui-backgrounds** - Background generation utilities +7. **ui-font-manager** - Font management and theming +8. **hcl-studio** - HCL color management system +9. **auth-client** - Authentication with guards and interceptors + +### Component Libraries +10. **ui-code-display** - Code syntax highlighting (requires prismjs) +11. **ui-essentials** - Essential UI components (buttons, forms, etc.) +12. **ui-landing-pages** - Landing page components and templates + +## 🚀 Consumer Integration + +### Step 1: Add Libraries as Submodules + +```bash +# Navigate to your project +cd your-angular-project + +# Add only the libraries you need +git submodule add https://github.com/yourorg/ui-design-system.git libs/ui-design-system +git submodule add https://github.com/yourorg/ui-essentials.git libs/ui-essentials +git submodule add https://github.com/yourorg/auth-client.git libs/auth-client + +# Initialize and update submodules +git submodule update --init --recursive +``` + +### Step 2: Install Dependencies + +```bash +# Install dependencies for each library +cd libs/ui-design-system && npm install && npm run build +cd ../ui-essentials && npm install && npm run build +cd ../auth-client && npm install && npm run build +cd ../.. +``` + +### Step 3: Update tsconfig.json + +```json +{ + "compilerOptions": { + "paths": { + "ui-design-system": ["./libs/ui-design-system/dist"], + "ui-design-system/*": ["./libs/ui-design-system/dist/*"], + "ui-essentials": ["./libs/ui-essentials/dist"], + "ui-essentials/*": ["./libs/ui-essentials/dist/*"], + "auth-client": ["./libs/auth-client/dist"], + "auth-client/*": ["./libs/auth-client/dist/*"] + } + } +} +``` + +### Step 4: Use in Your Application + +```typescript +// Import from any library +import { ButtonComponent } from 'ui-essentials'; +import { AuthService } from 'auth-client'; +import { UiDesignSystemService } from 'ui-design-system'; + +// Import styles +// In your styles.scss +@use 'ui-design-system/src/styles' as ui; +``` + +## 🔄 Library Updates + +### Update a Single Library +```bash +cd libs/ui-essentials +git pull origin main +npm run build +cd ../.. +``` + +### Update All Libraries +```bash +git submodule update --remote +# Then rebuild each library as needed +``` + +### Lock to Specific Versions +```bash +cd libs/ui-essentials +git checkout v1.2.0 # Specific tag/version +cd ../.. +git add libs/ui-essentials +git commit -m "Lock ui-essentials to v1.2.0" +``` + +## 📁 Recommended Project Structure + +``` +your-project/ +├── src/ +├── libs/ # Git submodules +│ ├── ui-design-system/ # Foundation styles +│ ├── ui-essentials/ # Essential components +│ ├── auth-client/ # Authentication +│ └── [other-libraries]/ +├── package.json +├── tsconfig.json +├── angular.json +└── .gitmodules # Auto-generated +``` + +## 🛠 Development Workflow + +### For Library Consumers + +1. **Add library**: `git submodule add libs/` +2. **Build library**: `cd libs/ && npm run build` +3. **Use library**: Import from library name in TypeScript +4. **Update library**: `cd libs/ && git pull` + +### For Library Development + +Each library is now an independent project: +- Separate Git repository +- Independent versioning +- Own CI/CD pipeline +- Individual releases + +## 🎯 Benefits Achieved + +### ✅ For LLM Analysis +- **Complexity reduction**: 12 focused repositories vs 1 monorepo +- **Clean APIs**: Each library has optimized public-api.ts +- **Focused context**: Analyze one library at a time +- **Clear boundaries**: Well-defined library responsibilities + +### ✅ For Development +- **Selective inclusion**: Only add libraries you need +- **Independent versioning**: Lock libraries to specific versions +- **Reusable across projects**: Same libraries in multiple projects +- **Professional distribution**: Industry-standard submodule approach + +### ✅ for Maintenance +- **Isolated changes**: Updates don't affect other libraries +- **Clear ownership**: Each library can have dedicated maintainers +- **Better testing**: Test libraries in isolation +- **Release management**: Independent release cycles + +## 🔧 Next Steps + +1. **Create Git repositories** for each extracted library +2. **Initialize with git init** in each library folder +3. **Push to your Git hosting** (GitHub, GitLab, etc.) +4. **Update URLs** in integration examples above +5. **Create initial releases/tags** for versioning + +## 📊 Before vs After + +**Before (Monorepo)**: +- 1 repository with 12 libraries +- ~50,000+ files for LLM to parse +- Complex interdependencies +- All-or-nothing updates + +**After (Submodules)**: +- 12 focused repositories +- ~500-2000 files per library for LLM +- Clean, documented APIs +- Selective library inclusion +- Independent evolution + +Your library ecosystem is now ready for professional distribution and optimal LLM analysis! \ No newline at end of file diff --git a/extract-library.sh b/extract-library.sh new file mode 100644 index 0000000..0f51e7e --- /dev/null +++ b/extract-library.sh @@ -0,0 +1,225 @@ +#!/bin/bash + +# Library extraction script +# Usage: ./extract-library.sh [library-name] [description] [keywords] + +if [ $# -lt 1 ]; then + echo "Usage: $0 [description] [keywords]" + echo "Example: $0 shared-utils 'Common utilities and shared services' 'angular,utilities,shared'" + exit 1 +fi + +LIBRARY_NAME="$1" +DESCRIPTION="${2:-Angular library}" +KEYWORDS="${3:-angular,library}" +EXTRACT_DIR="../extracted-libraries" +SOURCE_DIR="projects/$LIBRARY_NAME" + +# Check if source library exists +if [ ! -d "$SOURCE_DIR" ]; then + echo "Error: Source library '$SOURCE_DIR' does not exist" + exit 1 +fi + +# Create extraction directory +DEST_DIR="$EXTRACT_DIR/$LIBRARY_NAME" +mkdir -p "$DEST_DIR" + +echo "Extracting $LIBRARY_NAME to $DEST_DIR..." + +# Copy source files +cp -r "$SOURCE_DIR/src" "$DEST_DIR/" +cp -r "$SOURCE_DIR"/tsconfig*.json "$DEST_DIR/" +cp "$SOURCE_DIR/ng-package.json" "$DEST_DIR/" + +# Create .gitignore +cat > "$DEST_DIR/.gitignore" << EOF +/node_modules/ +/dist/ +*.tsbuildinfo +.DS_Store +Thumbs.db +*.log +coverage/ +.nyc_output/ +.vscode/ +.idea/ +*.swp +*.swo +*~ +EOF + +# Create README.md +cat > "$DEST_DIR/README.md" << EOF +# $LIBRARY_NAME + +$DESCRIPTION + +## Installation + +### As Git Submodule +\`\`\`bash +git submodule add https://github.com/yourorg/$LIBRARY_NAME.git libs/$LIBRARY_NAME +cd libs/$LIBRARY_NAME +npm install +npm run build +\`\`\` + +### Update tsconfig.json +\`\`\`json +{ + "compilerOptions": { + "paths": { + "$LIBRARY_NAME": ["./libs/$LIBRARY_NAME/dist"], + "$LIBRARY_NAME/*": ["./libs/$LIBRARY_NAME/dist/*"] + } + } +} +\`\`\` + +## Usage + +\`\`\`typescript +import { /* exports */ } from '$LIBRARY_NAME'; +\`\`\` + +## Development + +\`\`\`bash +# Install dependencies +npm install + +# Run tests +npm test + +# Build library +npm run build + +# Watch mode +npm run build:watch +\`\`\` + +## Dependencies + +- Angular 19.2+ +- TypeScript 5.7+ + +## License + +MIT +EOF + +# Create package.json +cat > "$DEST_DIR/package.json" << EOF +{ + "name": "$LIBRARY_NAME", + "version": "1.0.0", + "description": "$DESCRIPTION", + "keywords": [$(echo "$KEYWORDS" | sed 's/,/", "/g' | sed 's/^/"/' | sed 's/$/"/')], + "author": "Your Organization", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/yourorg/$LIBRARY_NAME.git" + }, + "main": "./dist/bundles/$LIBRARY_NAME.umd.js", + "module": "./dist/fesm2022/$LIBRARY_NAME.mjs", + "es2015": "./dist/fesm2015/$LIBRARY_NAME.mjs", + "esm2022": "./dist/esm2022/$LIBRARY_NAME.mjs", + "fesm2022": "./dist/fesm2022/$LIBRARY_NAME.mjs", + "fesm2015": "./dist/fesm2015/$LIBRARY_NAME.mjs", + "typings": "./dist/$LIBRARY_NAME.d.ts", + "exports": { + "./package.json": { + "default": "./package.json" + }, + ".": { + "types": "./dist/$LIBRARY_NAME.d.ts", + "esm2022": "./dist/esm2022/$LIBRARY_NAME.mjs", + "esm": "./dist/esm2022/$LIBRARY_NAME.mjs", + "default": "./dist/$LIBRARY_NAME.d.ts" + } + }, + "scripts": { + "ng": "ng", + "build": "ng build $LIBRARY_NAME", + "build:watch": "ng build $LIBRARY_NAME --watch", + "test": "ng test $LIBRARY_NAME", + "lint": "ng lint $LIBRARY_NAME" + }, + "peerDependencies": { + "@angular/common": "^19.2.0", + "@angular/core": "^19.2.0" + }, + "dependencies": { + "tslib": "^2.3.0" + }, + "devDependencies": { + "@angular-devkit/build-angular": "^19.2.15", + "@angular/cli": "^19.2.15", + "@angular/compiler-cli": "^19.2.0", + "@types/jasmine": "~5.1.0", + "jasmine-core": "~5.6.0", + "karma": "~6.4.0", + "karma-chrome-launcher": "~3.2.0", + "karma-coverage": "~2.2.0", + "karma-jasmine": "~5.1.0", + "karma-jasmine-html-reporter": "~2.1.0", + "ng-packagr": "^19.2.0", + "typescript": "~5.7.2" + }, + "sideEffects": false +} +EOF + +# Create angular.json +cat > "$DEST_DIR/angular.json" << EOF +{ + "\$schema": "./node_modules/@angular/cli/lib/config/schema.json", + "version": 1, + "newProjectRoot": "projects", + "projects": { + "$LIBRARY_NAME": { + "projectType": "library", + "root": ".", + "sourceRoot": "src", + "prefix": "lib", + "architect": { + "build": { + "builder": "@angular-devkit/build-angular:ng-packagr", + "options": { + "project": "ng-package.json" + }, + "configurations": { + "production": { + "tsConfig": "tsconfig.lib.prod.json" + }, + "development": { + "tsConfig": "tsconfig.lib.json" + } + }, + "defaultConfiguration": "production" + }, + "test": { + "builder": "@angular-devkit/build-angular:karma", + "options": { + "tsConfig": "tsconfig.spec.json", + "polyfills": [ + "zone.js", + "zone.js/testing" + ] + } + } + } + } + } +} +EOF + +# Fix ng-package.json paths +sed -i 's|../../node_modules/ng-packagr/ng-package.schema.json|./node_modules/ng-packagr/ng-package.schema.json|g' "$DEST_DIR/ng-package.json" +sed -i "s|../../dist/$LIBRARY_NAME|./dist|g" "$DEST_DIR/ng-package.json" + +echo "✅ Successfully extracted $LIBRARY_NAME to $DEST_DIR" +echo "📁 Library structure:" +ls -la "$DEST_DIR" \ No newline at end of file diff --git a/projects/ui-design-system/src/public-api.ts b/projects/ui-design-system/src/public-api.ts index 254587a..00701a7 100644 --- a/projects/ui-design-system/src/public-api.ts +++ b/projects/ui-design-system/src/public-api.ts @@ -1,5 +1,5 @@ /* - * Public API Surface of shared-ui + * Public API Surface of ui-design-system */ export * from './lib/shared-ui.service'; diff --git a/projects/ui-essentials/src/public-api.ts b/projects/ui-essentials/src/public-api.ts index f70f3f3..5951d63 100644 --- a/projects/ui-essentials/src/public-api.ts +++ b/projects/ui-essentials/src/public-api.ts @@ -2,13 +2,64 @@ * Public API Surface of ui-essentials */ -export * from './lib/components/buttons/index'; -export * from './lib/components/forms/index'; +// ========================================================================== +// BUTTON COMPONENTS +// ========================================================================== +export { ButtonComponent, ButtonVariant, ButtonSize, IconPosition } from './lib/components/buttons/button.component'; +export { TextButtonComponent } from './lib/components/buttons/text-button.component'; +export { GhostButtonComponent } from './lib/components/buttons/ghost-button.component'; +export { FabComponent } from './lib/components/buttons/fab.component'; +export * from './lib/components/buttons/fab-menu'; +export * from './lib/components/buttons/icon-button'; +export * from './lib/components/buttons/split-button'; + +// ========================================================================== +// FORM COMPONENTS +// ========================================================================== +export { TextInputComponent, TextInputSize, TextInputVariant, TextInputType, TextInputState } from './lib/components/forms/input/text-input.component'; +export { TextareaComponent } from './lib/components/forms/input/textarea.component'; +export * from './lib/components/forms/checkbox'; +export * from './lib/components/forms/radio'; +export * from './lib/components/forms/search'; +export * from './lib/components/forms/switch'; +export { SelectComponent } from './lib/components/forms/select/select.component'; +export * from './lib/components/forms/autocomplete'; +export * from './lib/components/forms/date-picker'; +export * from './lib/components/forms/time-picker'; +export * from './lib/components/forms/file-upload'; +export * from './lib/components/forms/form-field'; +export * from './lib/components/forms/range-slider'; +export * from './lib/components/forms/color-picker'; +export * from './lib/components/forms/tag-input'; + +// ========================================================================== +// DATA DISPLAY COMPONENTS +// ========================================================================== export * from './lib/components/data-display/index'; + +// ========================================================================== +// NAVIGATION COMPONENTS +// ========================================================================== export * from './lib/components/navigation/index'; + +// ========================================================================== +// MEDIA COMPONENTS +// ========================================================================== export * from './lib/components/media/index'; + +// ========================================================================== +// FEEDBACK COMPONENTS +// ========================================================================== export * from './lib/components/feedback/index'; + +// ========================================================================== +// OVERLAY COMPONENTS +// ========================================================================== export * from './lib/components/overlays/index'; + +// ========================================================================== +// LAYOUT COMPONENTS +// ========================================================================== export * from './lib/components/layout/index'; // Layout Components (avoiding conflicts with navigation tab components)