I created a simple new schematic using the angular schematics cli. This schematic takes as input a name, and generates a file in the tree. My files/
directory looks like:
src/
app/
__name@dasherize__.ts
I've built it, and then created a new angular project:
ng new test-app --routing --style css
I then cd into the test-app directory and link to my sample schematic:
npm link ../schematics/sample-schematic
I then run my schematic:
ng g sample-schematic:sample
however I get the following error when I do so:
Pipe "dasherize" is not defined.
If I change the file name in my files
directory to test.ts
it works fine, and the file is created. I am guessing i am missing some import to use the various schematic functions in my test-app project. My dependancies and dev-dependancies for test-app
looks like:
"dependencies": {
"@angular/animations": "~7.2.0",
"@angular/common": "~7.2.0",
"@angular/compiler": "~7.2.0",
"@angular/core": "~7.2.0",
...
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.13.0",
"@angular-devkit/core": "^7.3.9",
"@angular-devkit/schematics": "^7.3.9",
"@angular-devkit/schematics-cli": "^0.13.9",
"@angular/cli": "~7.3.9",
"@angular/compiler-cli": "~7.2.0",
"@angular/language-service": "~7.2.0",
"@schematics/angular": "^7.3.9",
...
}