@@ -2,9 +2,9 @@ import { Path, join, normalize, strings } from '@angular-devkit/core';
2
2
import { DirEntry , Rule , SchematicsException , Tree , apply , branchAndMerge , chain , filter , mergeWith , move , noop , template , url } from '@angular-devkit/schematics' ;
3
3
import { findNodes } from '@schematics/angular/utility/ast-utils' ;
4
4
import { Change , InsertChange } from '@schematics/angular/utility/change' ;
5
- import { getWorkspace } from '@schematics/angular/utility/config' ;
6
5
import { ModuleOptions , buildRelativePath } from '@schematics/angular/utility/find-module' ;
7
6
import { parseName } from '@schematics/angular/utility/parse-name' ;
7
+ import { buildDefaultPath , getProject } from '@schematics/angular/utility/project' ;
8
8
import { validateHtmlSelector , validateName } from '@schematics/angular/utility/validation' ;
9
9
import * as ts from 'typescript' ;
10
10
@@ -151,16 +151,14 @@ function buildSelector(options: PageOptions, projectPrefix: string) {
151
151
152
152
export default function ( options : PageOptions ) : Rule {
153
153
return ( host , context ) => {
154
- const workspace = getWorkspace ( host ) ;
155
-
156
154
if ( ! options . project ) {
157
- options . project = Object . keys ( workspace . projects ) [ 0 ] ;
155
+ throw new SchematicsException ( 'Option ( project) is required.' ) ;
158
156
}
159
157
160
- const project = workspace . projects [ options . project ] ;
158
+ const project = getProject ( host , options . project ) ;
161
159
162
160
if ( options . path === undefined ) {
163
- options . path = `/ ${ project . root } /src/app` ;
161
+ options . path = buildDefaultPath ( project ) ;
164
162
}
165
163
166
164
options . module = findRoutingModuleFromOptions ( host , options ) ;
0 commit comments