File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
packages/angular_devkit/schematics/tools Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change 55 * Use of this source code is governed by an MIT-style license that can be
66 * found in the LICENSE file at https://angular.io/license
77 */
8+ import { BaseException } from '@angular-devkit/core' ;
89import * as core from '@angular-devkit/core/node' ;
910import { dirname , join , resolve as resolvePath } from 'path' ;
1011import { RuleFactory } from '../src' ;
@@ -22,6 +23,13 @@ import { FileSystemEngineHostBase } from './file-system-engine-host-base';
2223import { readJsonFile } from './file-system-utility' ;
2324
2425
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+
2533/**
2634 * A simple EngineHost that uses NodeModules to resolve collections.
2735 */
@@ -81,6 +89,9 @@ export class NodeModulesEngineHost extends FileSystemEngineHostBase {
8189 }
8290
8391 const pkgJsonSchematics = require ( packageJsonPath ) [ 'schematics' ] ;
92+ if ( ! pkgJsonSchematics || typeof pkgJsonSchematics != 'string' ) {
93+ throw new NodePackageDoesNotSupportSchematics ( name ) ;
94+ }
8495 collectionPath = this . _resolvePath ( pkgJsonSchematics , dirname ( packageJsonPath ) ) ;
8596 }
8697
You can’t perform that action at this time.
0 commit comments