cicy-desktop 2.1.81 → 2.1.82
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
CHANGED
|
@@ -8,22 +8,23 @@
|
|
|
8
8
|
//
|
|
9
9
|
// Usage: node scripts/sync-runtime-deps.cjs (writes package.json in place)
|
|
10
10
|
|
|
11
|
-
const {
|
|
11
|
+
const { execSync } = require("child_process");
|
|
12
12
|
const fs = require("fs");
|
|
13
13
|
const path = require("path");
|
|
14
14
|
|
|
15
15
|
const REGISTRY = process.env.NPM_REGISTRY || "https://registry.npmjs.org";
|
|
16
|
-
// On Windows `npm` is `npm.cmd`; execFileSync (no shell) can't launch a bare
|
|
17
|
-
// "npm" there → every `npm view` throws ENOENT, gets swallowed by the catch,
|
|
18
|
-
// and the script aborts with "resolved nothing" (registry was fine all along).
|
|
19
|
-
// Resolve the real binary name per-platform.
|
|
20
|
-
const NPM = process.platform === "win32" ? "npm.cmd" : "npm";
|
|
21
16
|
const PLATFORMS = ["darwin-x64", "darwin-arm64", "linux-x64", "linux-arm64", "windows-x64", "windows-arm64"];
|
|
22
17
|
const COMPONENTS = ["cicy-code", "cicy-mihomo"]; // NOT cicy-msys2 — win drops it
|
|
23
18
|
|
|
24
19
|
function latest(pkg) {
|
|
20
|
+
// Use execSync (runs through a shell) instead of execFileSync: on Windows npm
|
|
21
|
+
// is npm.cmd, and Node refuses to spawn .cmd/.bat without a shell (EINVAL) —
|
|
22
|
+
// execFileSync('npm'|'npm.cmd', …) therefore threw on every call and the whole
|
|
23
|
+
// script aborted with "resolved nothing" even though the registry was fine.
|
|
24
|
+
// cmd.exe (win) / sh (unix) resolve `npm` correctly. pkg/REGISTRY are trusted
|
|
25
|
+
// constants, so the interpolation is safe.
|
|
25
26
|
try {
|
|
26
|
-
return
|
|
27
|
+
return execSync(`npm view ${pkg} version --registry=${REGISTRY}`, { encoding: "utf8", stdio: ["ignore", "pipe", "ignore"] }).trim() || null;
|
|
27
28
|
} catch {
|
|
28
29
|
return null; // not published for this platform (e.g. cicy-code has no windows-arm64)
|
|
29
30
|
}
|