@@ -2,9 +2,9 @@ import { Path, join, normalize, strings } from '@angular-devkit/core';
22import { DirEntry , Rule , SchematicsException , Tree , apply , branchAndMerge , chain , filter , mergeWith , move , noop , template , url } from '@angular-devkit/schematics' ;
33import { findNodes } from '@schematics/angular/utility/ast-utils' ;
44import { Change , InsertChange } from '@schematics/angular/utility/change' ;
5- import { getWorkspace } from '@schematics/angular/utility/config' ;
65import { ModuleOptions , buildRelativePath } from '@schematics/angular/utility/find-module' ;
76import { parseName } from '@schematics/angular/utility/parse-name' ;
7+ import { buildDefaultPath , getProject } from '@schematics/angular/utility/project' ;
88import { validateHtmlSelector , validateName } from '@schematics/angular/utility/validation' ;
99import * as ts from 'typescript' ;
1010
@@ -151,16 +151,14 @@ function buildSelector(options: PageOptions, projectPrefix: string) {
151151
152152export default function ( options : PageOptions ) : Rule {
153153 return ( host , context ) => {
154- const workspace = getWorkspace ( host ) ;
155-
156154 if ( ! options . project ) {
157- options . project = Object . keys ( workspace . projects ) [ 0 ] ;
155+ throw new SchematicsException ( 'Option ( project) is required.' ) ;
158156 }
159157
160- const project = workspace . projects [ options . project ] ;
158+ const project = getProject ( host , options . project ) ;
161159
162160 if ( options . path === undefined ) {
163- options . path = `/ ${ project . root } /src/app` ;
161+ options . path = buildDefaultPath ( project ) ;
164162 }
165163
166164 options . module = findRoutingModuleFromOptions ( host , options ) ;
0 commit comments