Phase 15: Framework Integration Package Split
September 29, 2025 ยท View on GitHub
Objective
Extract framework-specific integrations into separate, optional packages to keep the main @nexcraft/forge package lightweight and eliminate CI noise from unused dependencies.
Scope
- Split Angular integration into
@nexcraft/forge-angularโ COMPLETED - Split Vue integration into
@nexcraft/forge-vueโ COMPLETED - Split React integration into
@nexcraft/forge-react๐ง PLANNED - Maintain
@nexcraft/forgeas pure web components only (truly framework-agnostic) - Follow the successful pattern established by
@nexcraft/forge-rhf
Problem Statement
Originally, the main package contained all framework integrations, causing:
- โ CI noise: TypeScript errors when framework deps not installed
- โ Build warnings: Fallback compilation mode required
- โ Forced dependencies: Users forced to download framework code they don't use
- โ Bundle bloat: Framework-specific code increasing core package size
- โ Architectural impurity: Core package tied to specific frameworks
Solution Architecture
Package Structure (ULTIMATE MINIMAL ARCHITECTURE)
@nexcraft/forge // PURE web components (truly framework-agnostic)
โโโ src/components/ // Web components ONLY
@nexcraft/forge-react // React integration (NEW - Phase 15.4)
โโโ src/components/ // React component wrappers (33 components)
โโโ src/utils/ // React utilities
โโโ src/types/ // React TypeScript definitions
โโโ src/ssr/ // SSR compatibility
@nexcraft/forge-vue // Vue integration (COMPLETED โ
)
โโโ src/composables/ // Vue composables
โโโ src/directives/ // Vue directives
โโโ src/plugin/ // Vue plugin
โโโ src/types/ // Vue TypeScript definitions
@nexcraft/forge-angular // Angular integration (COMPLETED โ
)
โโโ src/directives/ // Angular directives
โโโ src/services/ // Angular services
โโโ src/forms/ // Angular reactive forms integration
โโโ src/types/ // Angular TypeScript definitions
@nexcraft/forge-rhf // React Hook Form (EXISTING โ
)
โโโ src/adapters/ // RHF adapters (keeps specialized purpose)
Benefits
- Clean CI: No more Angular compilation errors
- Focused Packages: Each package serves specific ecosystem
- Optional Dependencies: Install only what you need
- Better Maintenance: Framework experts can maintain their integrations
- Proven Pattern: Follows successful RHF approach
Deliverables
Phase 15.1: Angular Package Creation (Priority) โ COMPLETED
- โ
New workspace package:
packages/forge-angular - โ
Migrate Angular integration from
src/integrations/angular.ts - โ Angular directives for web component integration
- โ Angular reactive forms adapters
- โ Angular service for theme management
- โ TypeScript definitions and build setup
- โ
Documentation:
docs/integrations/angular.md
Phase 15.2: Main Package Cleanup
- โ
Remove Angular compilation from
vite.config.ts - โ
Remove
src/integrations/angular.ts(migrated to @nexcraft/forge-angular) - โ Update package exports (remove Angular subpath)
- โ Clean CI output validation (zero Angular compilation errors)
- โ Update main package documentation (README.md updated with framework packages section)
- โ
PUBLISHED:
@nexcraft/forge-angular@0.1.0available on npm
Phase 15.3: Vue Package (Active Implementation) โ COMPLETED
- โ Evaluation Complete: Vue integration is 500+ lines (NOT lightweight!)
- โ
Decision: Extract to
@nexcraft/forge-vuefor truly minimal core package - โ
New workspace package:
packages/forge-vue - โ
Migrate Vue integration from
src/integrations/vue.ts(composables, plugin, types) - โ Remove Vue compilation from main package
- โ Update package exports (remove Vue subpath)
- โ
PUBLISHED:
@nexcraft/forge-vue@0.1.0available on npm - โ Update documentation and README
Phase 15.4: React Package (Ultimate Architecture) โ COMPLETED
- โ Evaluation: React integration is 38 files with 33 components (substantial!)
- โ
Decision: Extract to
@nexcraft/forge-reactfor pure web components core package - โ
New workspace package:
packages/forge-react - โ
Migrate React integration from
src/integrations/react/(all 38 files) - โ Remove React compilation from main package
- โ Update package exports (remove React subpath)
- โ
Keep
@nexcraft/forge-rhfseparate (specialized React Hook Form purpose) - โ
PUBLISHED:
@nexcraft/forge-react@0.1.0available on npm - โ Update documentation and README
- โ
Achievement:
@nexcraft/forgebecomes pure web components (truly framework-agnostic)
Technical Implementation
React Package Setup
// packages/forge-react/package.json
{
"name": "@nexcraft/forge-react",
"version": "0.1.0",
"type": "module",
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.js"
},
"./components": {
"types": "./dist/components/index.d.ts",
"import": "./dist/components/index.js"
},
"./hooks": {
"types": "./dist/hooks/index.d.ts",
"import": "./dist/hooks/index.js"
},
"./ssr": {
"types": "./dist/ssr/index.d.ts",
"import": "./dist/ssr/index.js"
}
},
"peerDependencies": {
"@nexcraft/forge": ">=0.7.0",
"react": "^17.0.0 || ^18.0.0 || ^19.0.0",
"react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0"
}
}
Angular Package Setup
// packages/forge-angular/package.json
{
"name": "@nexcraft/forge-angular",
"version": "0.1.0",
"type": "module",
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.js"
},
"./forms": {
"types": "./dist/forms/index.d.ts",
"import": "./dist/forms/index.js"
}
},
"peerDependencies": {
"@nexcraft/forge": ">=0.7.0",
"@angular/core": "^17.0.0 || ^18.0.0",
"@angular/forms": "^17.0.0 || ^18.0.0"
}
}
Migration Strategy
- Extract Current Code: Move
src/integrations/angular.tsto new package - Expand Functionality: Add proper Angular directives and services
- Build System: Create Angular-specific build configuration
- Dependencies: Add Angular as peer dependencies only
- Clean Main Package: Remove Angular compilation entirely
Usage Pattern
// Core Forge components (main package) - Pure web components
import '@nexcraft/forge/components';
// React integration (separate package)
import { ForgeButton, ForgeInput, ForgeCard } from '@nexcraft/forge-react';
import { useForgeComponent, useForgeEvent } from '@nexcraft/forge-react/hooks';
// Angular integration (separate package)
import { ForgeDirective, ForgeFormsModule } from '@nexcraft/forge-angular';
import { ForgeInputAdapter } from '@nexcraft/forge-angular/forms';
// Vue integration (separate package)
import { useForgeComponent, useForgeVModel } from '@nexcraft/forge-vue';
Timeline (1-2 weeks)
Week 1: Angular Package Creation
- Day 1-2: Package scaffold and build setup
- Day 3-4: Migrate and expand Angular integration
- Day 5: Documentation and examples
Week 2: Integration and Cleanup
- Day 1-2: Main package cleanup and CI fixes
- Day 3-4: Testing with Angular projects
- Day 5: Publishing and announcement
Success Metrics
Immediate (CI Health)
- โ Zero Angular compilation errors in main package CI
- โ Clean build output without fallback warnings
- โ Main package builds without Angular dependencies
Long-term (Ecosystem)
- ๐ Angular package adoption by Angular developers
- ๐ Reduced main package bundle size
- ๐ Better framework-specific documentation and examples
Risks & Mitigations
Risk: Package Proliferation
- Mitigation: Only create packages when clear value (Angular has CI noise issue)
- Decision: Vue stays in main package (lightweight, no build issues)
Risk: Version Synchronization
- Mitigation: Use workspace publishing with version locking
- Benefit: Follow established RHF package patterns
Risk: Maintenance Overhead
- Mitigation: Framework packages can be maintained by framework experts
- Community: Angular package can attract Angular community contributors
Acceptance Criteria
- โ
@nexcraft/forgebuilds without any Angular or Vue references - โ
@nexcraft/forgebuilds without React references (pure web components) - โ
@nexcraft/forge-angularprovides full Angular integration (published) - โ
@nexcraft/forge-vueprovides full Vue integration (published) - โ
@nexcraft/forge-reactprovides full React integration (published) - โ CI output is clean with no compilation warnings
- โ Documentation clearly explains package separation
- โ Angular developers can use Forge components seamlessly
- โ Vue developers can use Forge components seamlessly
- โ React developers can use Forge components seamlessly
- โ Main package is pure web components (truly framework-agnostic)
Related Phases
- Phase 12: React Hook Form package split (completed) - provides pattern
- Phase 13: Monorepo platform (in progress) - provides infrastructure
- Phase 14: Monorepo publishing (future) - will handle multi-package releases
Status: โ
COMPLETED - Ultimate minimal architecture achieved!
Dependencies: โ
Phase 13 monorepo infrastructure (satisfied)
Achievements: โ
Pure web components core, all framework packages published
๐ฏ Phase 15: Ultimate Architecture ACHIEVED โ
All Framework Packages Published:
@nexcraft/forge-angular@0.1.0- Angular integration โ@nexcraft/forge-vue@0.1.0- Vue composables & plugin โ@nexcraft/forge-react@0.1.0- React integration โ@nexcraft/forge-rhf@0.3.0- React Hook Form adapters โ
โ Ultimate Architecture Achieved:
@nexcraft/forge- Pure web components (truly framework-agnostic) โ- All frameworks are now optional separate packages โ
Benefits Delivered:
- ๐ฏ Pure web components core - truly framework-agnostic โ
- ๐ฆ Smaller bundle size - no React dependencies in core โ
- ๐งฉ Consistent architecture - all frameworks are optional โ
- ๐ Better performance - framework code only when needed โ