@@ -27,8 +27,8 @@ import {InsertChange} from '@schematics/angular/utility/change';
27
27
import { getWorkspace } from '@schematics/angular/utility/config' ;
28
28
import { buildRelativePath , findModuleFromOptions } from '@schematics/angular/utility/find-module' ;
29
29
import { parseName } from '@schematics/angular/utility/parse-name' ;
30
- import { buildDefaultPath } from '@schematics/angular/utility/project' ;
31
30
import { validateHtmlSelector , validateName } from '@schematics/angular/utility/validation' ;
31
+ import { ProjectType , WorkspaceProject } from '@schematics/angular/utility/workspace-models' ;
32
32
import { readFileSync , statSync } from 'fs' ;
33
33
import { dirname , join , resolve } from 'path' ;
34
34
import * as ts from 'typescript' ;
@@ -40,6 +40,20 @@ import {
40
40
import { getProjectFromWorkspace } from './get-project' ;
41
41
import { getDefaultComponentOptions } from './schematic-options' ;
42
42
43
+ /**
44
+ * Build a default project path for generating.
45
+ * @param project The project to build the path for.
46
+ */
47
+ function buildDefaultPath ( project : WorkspaceProject ) : string {
48
+ const root = project . sourceRoot
49
+ ? `/${ project . sourceRoot } /`
50
+ : `/${ project . root } /src/` ;
51
+
52
+ const projectDirName = project . projectType === ProjectType . Application ? 'app' : 'lib' ;
53
+
54
+ return `${ root } ${ projectDirName } ` ;
55
+ }
56
+
43
57
/**
44
58
* List of style extensions which are CSS compatible. All supported CLI style extensions can be
45
59
* found here: angular/angular-cli/master/packages/schematics/angular/ng-new/schema.json#L118-L122
0 commit comments