-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.js
executable file
·75 lines (61 loc) · 1.74 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/usr/bin/env node
import shelljs from "shelljs";
import { addJasmineRules } from "./eslint/jasmine.js";
import { addRxJSRules } from "./eslint/rxjs.js";
import { addSonarRules } from "./eslint/sonar.js";
import { addTemplateRules } from "./eslint/template.js";
import {
commit,
execOrFail,
gitignore,
logEnd,
logStart,
} from "./helpers/index.js";
import { addHusky } from "./husky/index.js";
import { addLintStaged } from "./lint-staged/index.js";
import { addPrettier } from "./prettier/index.js";
import { addStylelint } from "./stylelint/index.js";
import { execFileSync } from "child_process";
const appName = process.argv[2];
logStart("Scaffolding Angular application...");
execFileSync("npx", ["@angular/cli@17", "new", appName, "--style", "scss"], {
stdio: "inherit",
});
logEnd("Angular application scaffolded");
shelljs.cd(appName);
// Add ESLint
execOrFail({
cmd: "npx ng add @angular-eslint/schematics@17 --skip-confirmation",
startMsg: "Adding @angular-eslint schematics",
errorMsg: "Error during adding Angular ESLint",
endMsg: "@angular-eslint schematics added",
});
commit("Add ESLint");
// Add ESLint rules
addTemplateRules();
addJasmineRules();
addRxJSRules();
addSonarRules();
commit("Add ESLint rules");
gitignore(`# lint caches
.eslintcache`);
commit("Add .eslintcache to .gitignore");
addPrettier();
commit("Add Prettier");
addStylelint();
commit("Add Stylelint");
gitignore(`.stylelintcache`);
commit("Add .stylelintcache to .gitignore");
// Add svgo
execOrFail({
cmd: "npm i -D svgo@3",
startMsg: "Installing svgo",
errorMsg: "Error during svgo installation",
endMsg: "svgo installed",
});
commit("Add SVGo");
addLintStaged();
commit("Add Lint staged");
addHusky();
commit("Add Husky");
logEnd("Ready to work!");