@@ -27,8 +27,8 @@ import {InsertChange} from '@schematics/angular/utility/change';
2727import { getWorkspace } from '@schematics/angular/utility/config' ;
2828import { buildRelativePath , findModuleFromOptions } from '@schematics/angular/utility/find-module' ;
2929import { parseName } from '@schematics/angular/utility/parse-name' ;
30- import { buildDefaultPath } from '@schematics/angular/utility/project' ;
3130import { validateHtmlSelector , validateName } from '@schematics/angular/utility/validation' ;
31+ import { ProjectType , WorkspaceProject } from '@schematics/angular/utility/workspace-models' ;
3232import { readFileSync , statSync } from 'fs' ;
3333import { dirname , join , resolve } from 'path' ;
3434import * as ts from 'typescript' ;
@@ -40,6 +40,20 @@ import {
4040import { getProjectFromWorkspace } from './get-project' ;
4141import { getDefaultComponentOptions } from './schematic-options' ;
4242
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+
4357/**
4458 * List of style extensions which are CSS compatible. All supported CLI style extensions can be
4559 * found here: angular/angular-cli/master/packages/schematics/angular/ng-new/schema.json#L118-L122
0 commit comments