@ngcorex/angular
v0.2.9
Published
Angular CLI integration for ngCorex - deterministic, governance-first design token engine with build-time CSS generation. Provides ng add support and build-time workflow wiring.
Maintainers
Readme
@ngcorex/angular
Angular CLI integration for ngCorex - a deterministic, governance-first design token engine with build-time CSS generation.
This package provides ng add support and workflow wiring for Angular projects.
- It does not introduce runtime logic.
- It does not modify components.
- It does not generate styles at runtime.
All processing remains build-time only.
Installation
Inside an Angular project:
npx ng add @ngcorex/angularWhat ng add Does
The schematic performs the following deterministic actions:
1. Adds devDependencies
"@ngcorex/cli": "^<version>"@ngcorex/css is automatically installed as a transitive dependency of @ngcorex/cli.
ngCorex runs at build-time only, so packages are installed as dev dependencies.
Note: Dependencies are added to package.json but not installed automatically. Run
npm run ngcorex:setupto install dependencies and complete setup.
2. Adds CLI Scripts
"scripts": {
"ngcorex:init": "ngcorex init",
"ngcorex:build": "ngcorex build",
"ngcorex:watch": "ngcorex build --watch",
"ngcorex:setup": "npm install && ngcorex init && ngcorex build",
"ngcorex:dev": "npm install && ngcorex init && ngcorex build --watch",
"ngcorex:start": "npm install && ngcorex init && ngcorex build && ng serve"
}These scripts provide convenient workflows:
ngcorex:init- Createstokens.jsonandngcorex.config.tsngcorex:build- Generates CSS from tokens (one-time)ngcorex:watch- Watches for changes and auto-rebuilds CSSngcorex:setup- Installs dependencies + init + build for quick setupngcorex:dev- Installs dependencies + init + build with watch mode for developmentngcorex:start- Installs dependencies + init + build + ng serve for complete startup
Smart start Script Modification:
The schematic intelligently modifies the existing start script:
- If
startis exactly"ng serve", it becomes"ngcorex build && ng serve" - If
starthas a custom value, it remains unchanged ngcorex:startis always added as a fallback
3. Updates angular.json
Injects:
src/styles/ngcorex.cssinto:
build.options.stylesThis ensures generated CSS is included in Angular builds.
First-Time Setup
After installation, you have two options:
Quick Setup (Recommended)
npm run ngcorex:setupThis will:
- Install ngCorex dependencies
- Generate
ngcorex.config.ts - Generate
tokens.json - Generate
src/styles/ngcorex.css
Alternatively, you can use the watch mode for development:
npm run ngcorex:dev
ng serveThis will:
- Install ngCorex dependencies
- Generate
ngcorex.config.ts - Generate
tokens.json - Generate
src/styles/ngcorex.css - Start watching for changes to
tokens.jsonandngcorex.config.ts - Auto-rebuild CSS whenever tokens are modified
Manual Setup
npm run ngcorex:init
npm run ngcorex:build
ng serveThis will:
- Generate
ngcorex.config.ts - Generate
tokens.json - Generate
src/styles/ngcorex.css - Serve Angular with ngCorex styles included
Note: With manual setup, you'll need to run
npm run ngcorex:buildeach time you modifytokens.jsonorngcorex.config.ts. Alternatively, runnpm run ngcorex:watchin a separate terminal for automatic rebuilds, or usenpm run ngcorex:devwhich combines init + watch.
Architecture
Dependency direction:
Angular Project
↓
@ngcorex/angular
↓
@ngcorex/css
↓
@ngcorex/cliThe core engine never depends on Angular.
This adapter exists only to reinforce workflow and CLI integration.
Versioning
The Angular adapter follows strict lockstep versioning with the ngCorex ecosystem.
Example:
@ngcorex/[email protected]
@ngcorex/[email protected]Philosophy
ngCorex in Angular remains:
- Deterministic
- Constraint-driven
- Governance-first
- Build-time only
- Framework-agnostic at its core
