@aslomon/effectum 0.1.6 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/effectum.js +50 -0
- package/bin/init.js +30 -0
- package/bin/install.js +531 -484
- package/bin/lib/config.js +55 -0
- package/bin/lib/constants.js +197 -0
- package/bin/lib/detect.js +98 -0
- package/bin/lib/stack-parser.js +56 -0
- package/bin/lib/template.js +108 -0
- package/bin/lib/ui.js +221 -0
- package/bin/lib/utils.js +56 -0
- package/bin/reconfigure.js +170 -0
- package/package.json +6 -3
package/bin/effectum.js
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Effectum CLI — subcommand router.
|
|
4
|
+
*
|
|
5
|
+
* npx @aslomon/effectum → install (default)
|
|
6
|
+
* npx @aslomon/effectum init → per-project init
|
|
7
|
+
* npx @aslomon/effectum reconfigure → re-apply from .effectum.json
|
|
8
|
+
* npx @aslomon/effectum --help → help text
|
|
9
|
+
*/
|
|
10
|
+
"use strict";
|
|
11
|
+
|
|
12
|
+
const path = require("path");
|
|
13
|
+
|
|
14
|
+
const args = process.argv.slice(2);
|
|
15
|
+
|
|
16
|
+
// Handle --version early
|
|
17
|
+
if (args.includes("--version") || args.includes("-v")) {
|
|
18
|
+
const pkg = require("../package.json");
|
|
19
|
+
console.log(`effectum v${pkg.version}`);
|
|
20
|
+
process.exit(0);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const subcommand = args.find((a) => !a.startsWith("-"));
|
|
24
|
+
|
|
25
|
+
// Route to the correct script
|
|
26
|
+
switch (subcommand) {
|
|
27
|
+
case "init":
|
|
28
|
+
// Remove 'init' from argv so the child script sees clean args
|
|
29
|
+
process.argv = [
|
|
30
|
+
process.argv[0],
|
|
31
|
+
process.argv[1],
|
|
32
|
+
...args.filter((a) => a !== "init"),
|
|
33
|
+
];
|
|
34
|
+
require("./init.js");
|
|
35
|
+
break;
|
|
36
|
+
|
|
37
|
+
case "reconfigure":
|
|
38
|
+
process.argv = [
|
|
39
|
+
process.argv[0],
|
|
40
|
+
process.argv[1],
|
|
41
|
+
...args.filter((a) => a !== "reconfigure"),
|
|
42
|
+
];
|
|
43
|
+
require("./reconfigure.js");
|
|
44
|
+
break;
|
|
45
|
+
|
|
46
|
+
default:
|
|
47
|
+
// Default: run the installer (handles --help, --global, --local, etc.)
|
|
48
|
+
require("./install.js");
|
|
49
|
+
break;
|
|
50
|
+
}
|
package/bin/init.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Per-project initializer.
|
|
4
|
+
* Used after a global install to configure a specific project.
|
|
5
|
+
* Essentially runs install.js in local mode with interactive prompts.
|
|
6
|
+
*/
|
|
7
|
+
"use strict";
|
|
8
|
+
|
|
9
|
+
// init is equivalent to running install with --local (but interactive)
|
|
10
|
+
// We just re-use install.js — it handles everything
|
|
11
|
+
const path = require("path");
|
|
12
|
+
|
|
13
|
+
// Ensure --local is set if no scope flag given
|
|
14
|
+
const args = process.argv.slice(2);
|
|
15
|
+
const hasScope =
|
|
16
|
+
args.includes("--global") ||
|
|
17
|
+
args.includes("-g") ||
|
|
18
|
+
args.includes("--local") ||
|
|
19
|
+
args.includes("-l");
|
|
20
|
+
|
|
21
|
+
if (!hasScope && !args.includes("--yes") && !args.includes("-y")) {
|
|
22
|
+
// Interactive mode for init — just run install.js as-is (defaults to local)
|
|
23
|
+
require("./install.js");
|
|
24
|
+
} else if (!hasScope) {
|
|
25
|
+
// Non-interactive init defaults to local
|
|
26
|
+
process.argv.push("--local");
|
|
27
|
+
require("./install.js");
|
|
28
|
+
} else {
|
|
29
|
+
require("./install.js");
|
|
30
|
+
}
|