feat(schematics): adds a code formatter

This commit is contained in:
vsavkin 2017-10-01 15:48:12 -04:00
parent 156975ce57
commit ff7b28e65e
4 changed files with 8 additions and 5 deletions

View File

@ -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",

View File

@ -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"
}
}

View File

@ -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)]))]);
}

View File

@ -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