From ff7b28e65e1901223c15131ef57ef04a68f4da86 Mon Sep 17 00:00:00 2001 From: vsavkin Date: Sun, 1 Oct 2017 15:48:12 -0400 Subject: [PATCH] feat(schematics): adds a code formatter --- package.json | 2 +- .../src/workspace/files/__directory__/package.json | 6 ++++-- packages/schematics/src/workspace/index.ts | 3 ++- scripts/e2e.sh | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 0825c6f3ea211..58eee9f7159c1 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,7 @@ "@types/jasmine": "2.5.53", "@types/node": "8.0.7", "angular": "1.6.6", - "clang-format": "^1.0.32", + "clang-format": "1.0.55", "jasmine-core": "~2.6.2", "jest": "20.0.4", "karma": "~1.7.0", diff --git a/packages/schematics/src/workspace/files/__directory__/package.json b/packages/schematics/src/workspace/files/__directory__/package.json index 8f220f272b3a5..b8e7e35e16e2a 100644 --- a/packages/schematics/src/workspace/files/__directory__/package.json +++ b/packages/schematics/src/workspace/files/__directory__/package.json @@ -8,7 +8,8 @@ "build": "ng build", "test": "ng test", "lint": "ng lint", - "e2e": "ng e2e" + "e2e": "ng e2e", + "format": "find apps/ -iname '*.ts' | xargs clang-format -i && find libs/ -iname '*.ts' | xargs clang-format -i" }, "private": true, "dependencies": { @@ -50,6 +51,7 @@ "protractor": "~5.1.2", "ts-node": "~3.2.0", "tslint": "~5.3.2",<% } %> - "typescript": "~2.3.3" + "typescript": "~2.3.3", + "clang-format": "1.0.55" } } diff --git a/packages/schematics/src/workspace/index.ts b/packages/schematics/src/workspace/index.ts index eef420cbe1c66..7d45aea6f490b 100644 --- a/packages/schematics/src/workspace/index.ts +++ b/packages/schematics/src/workspace/index.ts @@ -7,7 +7,8 @@ export default function(options: Schema): Rule { const npmScope = options.npmScope ? options.npmScope : options.name; const templateSource = apply( url('./files'), - [template({utils: stringUtils, dot: '.', nxVersion, ngrxVersion, schematicsVersion, ...options as object, npmScope})]); + [template( + {utils: stringUtils, dot: '.', nxVersion, ngrxVersion, schematicsVersion, ...options as object, npmScope})]); return chain([branchAndMerge(chain([mergeWith(templateSource)]))]); } diff --git a/scripts/e2e.sh b/scripts/e2e.sh index bed17f9d0b681..25acbd22f6589 100755 --- a/scripts/e2e.sh +++ b/scripts/e2e.sh @@ -2,4 +2,4 @@ ./scripts/link.sh rm -rf tmp -jest --maxWorkers=1 ./build/e2e/schematics/workspace.test.js +jest --maxWorkers=1 ./build/e2e/schematics