-
Notifications
You must be signed in to change notification settings - Fork 842
/
cli.js
86 lines (74 loc) · 2.74 KB
/
cli.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
76
77
78
79
80
81
82
83
84
85
86
// @ts-check
import { program } from "commander";
import {
updateFrameworks,
cleanFrameworkDirectories,
configureStyles,
copyProjectToDist,
createFrameworkZipArchive,
updateFrameworkLockfiles,
rebuildAllFrameworks,
rebuildSingleFramework,
} from "./cli/index.js";
import { updateOneFramework } from "./cli/update-frameworks.js";
program.command("zip").description("Create a zip archive of frameworks").action(createFrameworkZipArchive);
program.command("copy").description("Copy project to dist directory").action(copyProjectToDist);
program
.command("update-frameworks")
.option("--type [types...]", "", ["keyed", "non-keyed"])
.description("Update implementations in the frameworks directory")
.action((options) => {
updateFrameworks(options);
});
program
.command("update-one-framework")
.arguments("<frameworks>")
.description("Update implementation in the frameworks directory")
.action((framework) => {
let [type, name] = framework.split("/");
if (!["keyed","non-keyed"].includes(type)) throw new Error("Invalid framework name. Must be something like keyed/vue");
updateOneFramework({type,name, debug: true});
});
program
.command("cleanup")
.description(
"Clean all framework directories of package-lock.json, yarn-lock and the elm-stuff, node-modules, bower-components and dist directories"
)
.option("--frameworks-dir-path [string]", "", "frameworks")
.option("--frameworks-types [types...]", "", ["keyed", "non-keyed"])
.action((options) => {
cleanFrameworkDirectories(options);
});
program
.command("update-lockfiles")
.description("Update lockfiles for all frameworks in the frameworks directory")
.option("--frameworks-dir-path [string]", "", "frameworks")
.option("--frameworks-types [types...]", "", ["keyed", "non-keyed"])
.option("--latest-lockfile-version [number]", "", "3")
.action((options) => {
updateFrameworkLockfiles(options);
});
program
.command("configure-styles")
.description("Configure CSS styles for all frameworks in the frameworks directory")
.option("--bootstrap [boolean]", "", false)
.option("--minimal [boolean]", "", false)
.action(async (options) => {
await configureStyles(options);
});
program
.command("rebuild-all")
.option("--type [types...]", "", ["keyed", "non-keyed"])
.option("--ci [boolean]", "", false)
.option("--restart-with-framework [string]", "", "")
.action((options) => {
rebuildAllFrameworks({ type: options.type, restartWithFramework: options.restartWithFramework, useCi: options.ci });
});
program
.command("rebuild-single")
.option("-f, --frameworks [frameworks...]", "", [])
.option("--ci [boolean]", "", false)
.action((options) => {
rebuildSingleFramework(options);
});
program.parse();