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

fix(@schematics/angular): Add skip git option to prevent creating git… #167

Merged
merged 1 commit into from
Sep 27, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/schematics/angular/application/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ export default function (options: ApplicationOptions): Rule {
mergeWith(
apply(url('./files'), [
options.minimal ? filter(minimalPathFilter) : noop(),
options.skipGit ? filter(path => !path.endsWith('/__dot__gitignore')) : noop(),
template({
utils: stringUtils,
'dot': '.',
Expand Down
8 changes: 8 additions & 0 deletions packages/schematics/angular/application/index_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,12 @@ describe('Application Schematic', () => {
const routingModuleContent = getFileContent(tree, '/foo/src/app/app-routing.module.ts');
expect(routingModuleContent).toMatch(/RouterModule.forRoot\(routes\)/);
});

it('should handle the skip git flag', () => {
const options = { ...defaultOptions, skipGit: true };

const tree = schematicRunner.runSchematic('application', options);
const files = tree.files;
expect(files.indexOf('/foo/.gitignore')).toEqual(-1);
});
});
4 changes: 4 additions & 0 deletions packages/schematics/angular/application/schema.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ export interface Schema {
* Skip creating spec files.
*/
skipTests?: boolean;
/**
* Skip initializing a git repository.
*/
skipGit?: boolean;
/**
* Should create a minimal app.
*/
Expand Down
6 changes: 6 additions & 0 deletions packages/schematics/angular/application/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@
"default": false,
"alias": "st"
},
"skipGit": {
"description": "Skip initializing a git repository.",
"type": "boolean",
"default": false,
"alias": "sg"
},
"minimal": {
"description": "Should create a minimal app.",
"type": "boolean",
Expand Down