This repository was archived by the owner on Apr 4, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +21
-2
lines changed
packages/schematics/angular/application Expand file tree Collapse file tree 4 files changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -94,6 +94,7 @@ export default function (options: ApplicationOptions): Rule {
9494 mergeWith (
9595 apply ( url ( './files' ) , [
9696 options . minimal ? filter ( minimalPathFilter ) : noop ( ) ,
97+ options . skipGit ? filter ( path => ! path . endsWith ( 'gitignore' ) ) : noop ( ) ,
9798 template ( {
9899 utils : stringUtils ,
99100 'dot' : '.' ,
Original file line number Diff line number Diff line change @@ -91,4 +91,12 @@ describe('Application Schematic', () => {
9191 const routingModuleContent = getFileContent ( tree , '/foo/src/app/app-routing.module.ts' ) ;
9292 expect ( routingModuleContent ) . toMatch ( / R o u t e r M o d u l e .f o r R o o t \( r o u t e s \) / ) ;
9393 } ) ;
94+
95+ it ( 'should handle the skip git flag' , ( ) => {
96+ const options = { ...defaultOptions , skipGit : true } ;
97+
98+ const tree = schematicRunner . runSchematic ( 'application' , options ) ;
99+ const files = tree . files ;
100+ expect ( files . indexOf ( '/foo/.gitignore' ) ) . toEqual ( - 1 ) ;
101+ } ) ;
94102} ) ;
Original file line number Diff line number Diff line change @@ -25,11 +25,11 @@ export interface Schema {
2525 /**
2626 * Specifies the view encapsulation strategy.
2727 */
28- viewEncapsulation ?: ( ' Emulated' | ' Native' | ' None' ) ;
28+ viewEncapsulation ?: ( " Emulated" | " Native" | " None" ) ;
2929 /**
3030 * Specifies the change detection strategy.
3131 */
32- changeDetection ?: ( ' Default' | ' OnPush' ) ;
32+ changeDetection ?: ( " Default" | " OnPush" ) ;
3333 version ?: string ;
3434 routing ?: boolean ;
3535 /**
@@ -44,6 +44,10 @@ export interface Schema {
4444 * Skip creating spec files.
4545 */
4646 skipTests ?: boolean ;
47+ /**
48+ * Skip initializing a git repository.
49+ */
50+ skipGit ?: boolean ;
4751 /**
4852 * Should create a minimal app.
4953 */
Original file line number Diff line number Diff line change 6969 "default" : false ,
7070 "alias" : " st"
7171 },
72+ "skipGit" : {
73+ "description" : " Skip initializing a git repository." ,
74+ "type" : " boolean" ,
75+ "default" : false ,
76+ "alias" : " sg"
77+ },
7278 "minimal" : {
7379 "description" : " Should create a minimal app." ,
7480 "type" : " boolean" ,
You can’t perform that action at this time.
0 commit comments