Skip to content
This repository was archived by the owner on Apr 4, 2025. It is now read-only.

Commit 1ac7e06

Browse files
committed
fix(@schematics/angular): Add skip git option to prevent creating gitignore file
fixes angular/angular-cli#7686
1 parent 8338150 commit 1ac7e06

File tree

4 files changed

+19
-0
lines changed

4 files changed

+19
-0
lines changed

packages/schematics/angular/application/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff 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': '.',

packages/schematics/angular/application/index_spec.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff 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(/RouterModule.forRoot\(routes\)/);
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
});

packages/schematics/angular/application/schema.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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
*/

packages/schematics/angular/application/schema.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,12 @@
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",

0 commit comments

Comments
 (0)