dsh-wechat-remote 1.7.5 → 1.7.8
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/README.md +16 -12
- package/assets/plugin.tgz +0 -0
- package/assets/release.json +8 -10
- package/bin/dsh-discovery.mjs +175 -0
- package/bin/native-control.mjs +4 -2
- package/bin/native-recovery.mjs +44 -0
- package/bin/release-selection.mjs +36 -33
- package/bin/setup.mjs +129 -61
- package/lib/install-control.js +1 -1
- package/lib/install-profile.js +113 -159
- package/lib/install-runtime.js +17 -0
- package/lib/native-recovery.js +7478 -0
- package/lib/update-policy.js +26 -27
- package/lib/update-worker.js +295 -176
- package/package.json +1 -1
package/lib/install-runtime.js
CHANGED
|
@@ -6,6 +6,22 @@ import path from "node:path";
|
|
|
6
6
|
import { createRequire } from "node:module";
|
|
7
7
|
import { spawn } from "node:child_process";
|
|
8
8
|
var INSTALL_PNPM_VERSION = "11.22.0";
|
|
9
|
+
async function pinInstallRuntime(runtime, directory) {
|
|
10
|
+
let root = path.dirname(runtime.cli);
|
|
11
|
+
while (!fs.existsSync(path.join(root, "package.json"))) {
|
|
12
|
+
const parent = path.dirname(root);
|
|
13
|
+
if (parent === root) throw new Error("\u65E0\u6CD5\u5B9A\u4F4D\u5B89\u88C5\u5DE5\u5177\u5305\u3002");
|
|
14
|
+
root = parent;
|
|
15
|
+
}
|
|
16
|
+
const manifest = JSON.parse(fs.readFileSync(path.join(root, "package.json"), "utf8"));
|
|
17
|
+
if (manifest.name !== "pnpm" || manifest.version !== runtime.version) throw new Error("\u5B89\u88C5\u5DE5\u5177\u7248\u672C\u4E0D\u4E00\u81F4\u3002");
|
|
18
|
+
const target = path.join(directory, "install-runtime");
|
|
19
|
+
if (fs.existsSync(target)) throw new Error("\u672C\u6B21\u5B89\u88C5\u5DE5\u5177\u76EE\u5F55\u5DF2\u5B58\u5728\u3002");
|
|
20
|
+
fs.cpSync(root, target, { recursive: true, dereference: false, verbatimSymlinks: true, mode: fs.constants.COPYFILE_FICLONE });
|
|
21
|
+
const pinned = { ...runtime, cli: path.join(target, path.relative(root, runtime.cli)) };
|
|
22
|
+
await verifyInstallRuntime(pinned);
|
|
23
|
+
return pinned;
|
|
24
|
+
}
|
|
9
25
|
function resolveInstallRuntime(owner, executable = process.execPath, nodeVersion = process.versions.node) {
|
|
10
26
|
const [major, minor] = nodeVersion.split(".").map(Number);
|
|
11
27
|
if (!(major > 22 || major === 22 && minor >= 13)) throw new Error("\u5F53\u524D Node.js \u7248\u672C\u4E0D\u6EE1\u8DB3\u5B89\u88C5\u8981\u6C42\uFF0822.13 \u6216\u66F4\u9AD8\uFF09\uFF0C\u672A\u4FEE\u6539\u63D2\u4EF6\u3002");
|
|
@@ -59,6 +75,7 @@ function verifyInstallRuntime(runtime) {
|
|
|
59
75
|
}
|
|
60
76
|
export {
|
|
61
77
|
INSTALL_PNPM_VERSION,
|
|
78
|
+
pinInstallRuntime,
|
|
62
79
|
resolveInstallRuntime,
|
|
63
80
|
verifyInstallRuntime
|
|
64
81
|
};
|