File tree 1 file changed +11
-0
lines changed
packages/angular_devkit/schematics/tools
1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change 5
5
* Use of this source code is governed by an MIT-style license that can be
6
6
* found in the LICENSE file at https://angular.io/license
7
7
*/
8
+ import { BaseException } from '@angular-devkit/core' ;
8
9
import * as core from '@angular-devkit/core/node' ;
9
10
import { dirname , join , resolve as resolvePath } from 'path' ;
10
11
import { RuleFactory } from '../src' ;
@@ -22,6 +23,13 @@ import { FileSystemEngineHostBase } from './file-system-engine-host-base';
22
23
import { readJsonFile } from './file-system-utility' ;
23
24
24
25
26
+ export class NodePackageDoesNotSupportSchematics extends BaseException {
27
+ constructor ( name : string ) {
28
+ super ( `Package ${ JSON . stringify ( name ) } was found but does not support schematics.` ) ;
29
+ }
30
+ }
31
+
32
+
25
33
/**
26
34
* A simple EngineHost that uses NodeModules to resolve collections.
27
35
*/
@@ -81,6 +89,9 @@ export class NodeModulesEngineHost extends FileSystemEngineHostBase {
81
89
}
82
90
83
91
const pkgJsonSchematics = require ( packageJsonPath ) [ 'schematics' ] ;
92
+ if ( ! pkgJsonSchematics || typeof pkgJsonSchematics != 'string' ) {
93
+ throw new NodePackageDoesNotSupportSchematics ( name ) ;
94
+ }
84
95
collectionPath = this . _resolvePath ( pkgJsonSchematics , dirname ( packageJsonPath ) ) ;
85
96
}
86
97
You can’t perform that action at this time.
0 commit comments