angular Schematics cli を使用して、単純な新しい回路図を作成しました。この回路図は名前を入力として取り、ツリーにファイルを生成します。私のfiles/
ディレクトリは次のようになります。
src/
app/
__name@dasherize__.ts
私はそれを構築し、新しいAngularプロジェクトを作成しました:
ng new test-app --routing --style css
次に、cd で test-app ディレクトリに移動し、サンプル回路図にリンクします。
npm link ../schematics/sample-schematic
次に、回路図を実行します。
ng g sample-schematic:sample
ただし、そうすると次のエラーが発生します。
Pipe "dasherize" is not defined.
files
ディレクトリ内のファイル名を に変更すると、正常test.ts
に動作し、ファイルが作成されます。私のテストアプリプロジェクトでさまざまな回路図関数を使用するためのインポートが不足していると思います。私の依存関係と開発依存関係はtest-app
次のようになります。
"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",
...
}