File tree Expand file tree Collapse file tree 3 files changed +16
-1
lines changed
packages/schematics/angular/ng-new Expand file tree Collapse file tree 3 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ import {
1515 empty ,
1616 mergeWith ,
1717 move ,
18+ noop ,
1819 schematic ,
1920} from '@angular-devkit/schematics' ;
2021import {
@@ -60,7 +61,7 @@ export default function (options: NgNewOptions): Rule {
6061 mergeWith (
6162 apply ( empty ( ) , [
6263 schematic ( 'workspace' , workspaceOptions ) ,
63- schematic ( 'application' , applicationOptions ) ,
64+ options . createApplication ? schematic ( 'application' , applicationOptions ) : noop ,
6465 move ( options . directory || options . name ) ,
6566 ] ) ,
6667 ) ,
Original file line number Diff line number Diff line change @@ -56,4 +56,13 @@ describe('Ng New Schematic', () => {
5656 const moduleContent = tree . readContent ( '/foo/src/app/app.module.ts' ) ;
5757 expect ( moduleContent ) . toMatch ( / d e c l a r a t i o n s : \s * \[ \s * A p p C o m p o n e n t \s * \] / m) ;
5858 } ) ;
59+
60+ it ( 'createApplication=false should create an empty workspace' , ( ) => {
61+ const options = { ...defaultOptions , createApplication : false } ;
62+
63+ const tree = schematicRunner . runSchematic ( 'ng-new' , options ) ;
64+ const files = tree . files ;
65+ expect ( files . indexOf ( '/bar/angular.json' ) ) . toBeGreaterThanOrEqual ( 0 ) ;
66+ expect ( files . indexOf ( '/bar/src' ) ) . toBe ( - 1 ) ;
67+ } ) ;
5968} ) ;
Original file line number Diff line number Diff line change 131131 "type" : " boolean" ,
132132 "default" : false ,
133133 "alias" : " S"
134+ },
135+ "createApplication" : {
136+ "description" : " Flag to toggle creation of an application in the new workspace." ,
137+ "type" : " boolean" ,
138+ "default" : true
134139 }
135140 },
136141 "required" : [
You can’t perform that action at this time.
0 commit comments