This is a demo repository for the blog post "How to Use Custom Schematics to Supercharge Developer Experience".
- Clone this repository
- Change to the
schematicsfolder and runnpm install - Run
npm run buildto build the schematics, or runnpm run devto build the schematics on watch mode - Run
npm linkin theschematicsfolder - Change to the
demo-appfolder and runnpm install - Once the installation is complete, also run
npm link ds-schematicsto link the custom schematics to the demo app so that you can test the custom schematics on an Angular project
- Run
ng g ds-schematics:component --name=checkbox --standaloneto generate a standalone checkbox component
CREATE src/app/checkbox/checkbox.component.scss (0 bytes)
CREATE src/app/checkbox/checkbox.component.html (0 bytes)
CREATE src/app/checkbox/checkbox.component.spec.ts (613 bytes)
CREATE src/app/checkbox/checkbox.component.ts (263 bytes)- Run
ng g ds-schematics:component --name=checkboxto generate a component that is part of the AppModule
CREATE src/app/checkbox/checkbox.component.scss (0 bytes)
CREATE src/app/checkbox/checkbox.component.html (0 bytes)
CREATE src/app/checkbox/checkbox.component.spec.ts (613 bytes)
CREATE src/app/checkbox/checkbox.component.ts (263 bytes)
UPDATE src/app/app.module.ts (484 bytes)- Run
ng g ds-schematics:ng-add - This command updates the npm script
test: jestand install Jest as a dependency
Q: I saw this error An unhandled exception occurred: Collection "ds-schematics" cannot be resolved. when I'm running the schematics commands
A: Run npm link ds-schematics in the demo-app folder again and should resolve this issue.