@clubnet/seedclub 0.2.2 → 0.2.4
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/package.json +1 -1
- package/postinstall.js +16 -18
package/package.json
CHANGED
package/postinstall.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
const { existsSync, mkdirSync, readFileSync, writeFileSync, cpSync, rmSync } = require("fs");
|
|
4
4
|
const { join, dirname } = require("path");
|
|
5
5
|
const { homedir } = require("os");
|
|
6
|
-
const {
|
|
6
|
+
const { execFileSync } = require("child_process");
|
|
7
7
|
|
|
8
8
|
const HOME = homedir();
|
|
9
9
|
const SC_HOME = join(HOME, ".seedclub");
|
|
@@ -22,6 +22,10 @@ const RESET = "\x1b[0m";
|
|
|
22
22
|
function ok(msg) { console.log(`${GREEN}\u2713${RESET} ${msg}`); }
|
|
23
23
|
function info(msg) { console.log(`${CYAN}\u25b8${RESET} ${msg}`); }
|
|
24
24
|
function warn(msg) { console.log(`${YELLOW}\u26a0${RESET} ${msg}`); }
|
|
25
|
+
function fail(msg) {
|
|
26
|
+
console.error(`\x1b[31m\u2717${RESET} ${msg}`);
|
|
27
|
+
process.exit(1);
|
|
28
|
+
}
|
|
25
29
|
|
|
26
30
|
// ── 1. Create directory structure ───────────────────────────────────────
|
|
27
31
|
|
|
@@ -60,28 +64,22 @@ if (existsSync(extPkgJson)) {
|
|
|
60
64
|
info("Installing extension dependencies...");
|
|
61
65
|
const extDir = join(SC_DIR, "extensions", "seedclub");
|
|
62
66
|
const hasLock = existsSync(join(extDir, "package-lock.json"));
|
|
63
|
-
const
|
|
64
|
-
let installed = false;
|
|
67
|
+
const npmArgs = hasLock ? ["ci", "--omit=dev"] : ["install", "--omit=dev"];
|
|
65
68
|
try {
|
|
66
|
-
|
|
69
|
+
execFileSync("npm", npmArgs, {
|
|
67
70
|
cwd: extDir,
|
|
68
|
-
|
|
71
|
+
env: {
|
|
72
|
+
...process.env,
|
|
73
|
+
npm_config_global: "false",
|
|
74
|
+
NPM_CONFIG_GLOBAL: "false",
|
|
75
|
+
},
|
|
76
|
+
stdio: "inherit",
|
|
69
77
|
});
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
// Retry without --silent so errors are visible
|
|
73
|
-
try {
|
|
74
|
-
execSync(npmCmd, {
|
|
75
|
-
cwd: extDir,
|
|
76
|
-
stdio: "inherit",
|
|
77
|
-
});
|
|
78
|
-
installed = true;
|
|
79
|
-
} catch {
|
|
80
|
-
warn("Extension dependencies failed to install (non-fatal)");
|
|
81
|
-
}
|
|
78
|
+
} catch (err) {
|
|
79
|
+
fail("Extension dependencies failed to install. Aborting installation.");
|
|
82
80
|
}
|
|
83
81
|
if (!hasLock) warn("No lockfile for extension deps; installs may vary over time");
|
|
84
|
-
|
|
82
|
+
ok("Extension dependencies installed");
|
|
85
83
|
}
|
|
86
84
|
|
|
87
85
|
// ── 5. Create settings.json (only if missing) ──────────────────────────
|