sleev 0.1.9 → 0.1.11
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/sleev.exe +3 -0
- package/package.json +8 -8
- package/postinstall.mjs +27 -5
- package/bin/sleev.js +0 -84
package/bin/sleev.exe
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sleev",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.11",
|
|
4
4
|
"description": "Sleeve CLI tool.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
},
|
|
9
9
|
"type": "module",
|
|
10
10
|
"bin": {
|
|
11
|
-
"sleev": "./bin/sleev.
|
|
11
|
+
"sleev": "./bin/sleev.exe"
|
|
12
12
|
},
|
|
13
13
|
"scripts": {
|
|
14
14
|
"postinstall": "node ./postinstall.mjs"
|
|
@@ -17,12 +17,12 @@
|
|
|
17
17
|
"access": "public"
|
|
18
18
|
},
|
|
19
19
|
"optionalDependencies": {
|
|
20
|
-
"sleev-linux-x64": "0.1.
|
|
21
|
-
"sleev-linux-arm64": "0.1.
|
|
22
|
-
"sleev-darwin-x64": "0.1.
|
|
23
|
-
"sleev-darwin-arm64": "0.1.
|
|
24
|
-
"sleev-windows-x64": "0.1.
|
|
25
|
-
"sleev-windows-arm64": "0.1.
|
|
20
|
+
"sleev-linux-x64": "0.1.11",
|
|
21
|
+
"sleev-linux-arm64": "0.1.11",
|
|
22
|
+
"sleev-darwin-x64": "0.1.11",
|
|
23
|
+
"sleev-darwin-arm64": "0.1.11",
|
|
24
|
+
"sleev-windows-x64": "0.1.11",
|
|
25
|
+
"sleev-windows-arm64": "0.1.11"
|
|
26
26
|
},
|
|
27
27
|
"keywords": [
|
|
28
28
|
"sleeve",
|
package/postinstall.mjs
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
import { spawnSync } from "node:child_process";
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
chmodSync,
|
|
6
|
+
copyFileSync,
|
|
7
|
+
existsSync,
|
|
8
|
+
linkSync,
|
|
9
|
+
mkdirSync,
|
|
10
|
+
realpathSync,
|
|
11
|
+
unlinkSync,
|
|
12
|
+
} from "node:fs";
|
|
5
13
|
import { dirname, join } from "node:path";
|
|
6
14
|
import { fileURLToPath } from "node:url";
|
|
7
15
|
|
|
@@ -43,6 +51,7 @@ function findBinary(startDir) {
|
|
|
43
51
|
|
|
44
52
|
const scriptDir = dirname(realpathSync(fileURLToPath(import.meta.url)));
|
|
45
53
|
const resolved = process.env.SLEEV_BIN_PATH || findBinary(scriptDir);
|
|
54
|
+
const target = join(scriptDir, "bin", "sleev.exe");
|
|
46
55
|
|
|
47
56
|
if (!resolved) {
|
|
48
57
|
console.error(
|
|
@@ -55,12 +64,25 @@ if (!resolved) {
|
|
|
55
64
|
process.exit(1);
|
|
56
65
|
}
|
|
57
66
|
|
|
58
|
-
|
|
59
|
-
|
|
67
|
+
mkdirSync(dirname(target), { recursive: true });
|
|
68
|
+
if (existsSync(target)) unlinkSync(target);
|
|
69
|
+
try {
|
|
70
|
+
linkSync(resolved, target);
|
|
71
|
+
} catch {
|
|
72
|
+
copyFileSync(resolved, target);
|
|
73
|
+
}
|
|
74
|
+
chmodSync(target, 0o755);
|
|
75
|
+
|
|
76
|
+
const result = spawnSync(target, ["paths"], {
|
|
77
|
+
encoding: "utf8",
|
|
78
|
+
stdio: "pipe",
|
|
60
79
|
timeout: 5000,
|
|
80
|
+
windowsHide: true,
|
|
61
81
|
});
|
|
62
82
|
|
|
63
|
-
if (result.status !== 0) {
|
|
64
|
-
console.error(`Sleev native binary verification failed: ${
|
|
83
|
+
if (result.status !== 0 || !result.stdout.includes('"configDir"')) {
|
|
84
|
+
console.error(`Sleev native binary verification failed: ${target}`);
|
|
85
|
+
if (result.stderr) console.error(result.stderr);
|
|
86
|
+
if (result.stdout) console.error(result.stdout);
|
|
65
87
|
process.exit(result.status ?? 1);
|
|
66
88
|
}
|
package/bin/sleev.js
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { spawn } from "node:child_process";
|
|
3
|
-
import { existsSync, realpathSync } from "node:fs";
|
|
4
|
-
import { dirname, join } from "node:path";
|
|
5
|
-
import { fileURLToPath } from "node:url";
|
|
6
|
-
const forwardedSignals = ["SIGINT", "SIGTERM", "SIGHUP"];
|
|
7
|
-
function run(target) {
|
|
8
|
-
const child = spawn(target, process.argv.slice(2), {
|
|
9
|
-
stdio: "inherit",
|
|
10
|
-
});
|
|
11
|
-
child.on("error", (error) => {
|
|
12
|
-
console.error(error.message);
|
|
13
|
-
process.exit(1);
|
|
14
|
-
});
|
|
15
|
-
const forwarders = new Map();
|
|
16
|
-
for (const signal of forwardedSignals) {
|
|
17
|
-
const forwarder = () => {
|
|
18
|
-
try {
|
|
19
|
-
child.kill(signal);
|
|
20
|
-
}
|
|
21
|
-
catch {
|
|
22
|
-
// The child may have already exited.
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
forwarders.set(signal, forwarder);
|
|
26
|
-
process.on(signal, forwarder);
|
|
27
|
-
}
|
|
28
|
-
child.on("exit", (code, signal) => {
|
|
29
|
-
for (const [forwardedSignal, forwarder] of forwarders) {
|
|
30
|
-
process.removeListener(forwardedSignal, forwarder);
|
|
31
|
-
}
|
|
32
|
-
if (signal) {
|
|
33
|
-
process.kill(process.pid, signal);
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
process.exit(typeof code === "number" ? code : 0);
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
const platformMap = {
|
|
40
|
-
darwin: "darwin",
|
|
41
|
-
linux: "linux",
|
|
42
|
-
win32: "windows",
|
|
43
|
-
};
|
|
44
|
-
const archMap = {
|
|
45
|
-
arm64: "arm64",
|
|
46
|
-
x64: "x64",
|
|
47
|
-
};
|
|
48
|
-
function packageNames() {
|
|
49
|
-
const platform = platformMap[process.platform] ?? process.platform;
|
|
50
|
-
const arch = archMap[process.arch] ?? process.arch;
|
|
51
|
-
return [`sleev-${platform}-${arch}`];
|
|
52
|
-
}
|
|
53
|
-
function findBinary(startDir) {
|
|
54
|
-
const binary = process.platform === "win32" ? "sleev.exe" : "sleev";
|
|
55
|
-
let current = startDir;
|
|
56
|
-
for (;;) {
|
|
57
|
-
const modules = join(current, "node_modules");
|
|
58
|
-
if (existsSync(modules)) {
|
|
59
|
-
for (const name of packageNames()) {
|
|
60
|
-
const candidate = join(modules, name, "bin", binary);
|
|
61
|
-
if (existsSync(candidate))
|
|
62
|
-
return candidate;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
const parent = dirname(current);
|
|
66
|
-
if (parent === current)
|
|
67
|
-
return undefined;
|
|
68
|
-
current = parent;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
const envPath = process.env.SLEEV_BIN_PATH?.trim();
|
|
72
|
-
const scriptDir = dirname(realpathSync(fileURLToPath(import.meta.url)));
|
|
73
|
-
const resolved = envPath || findBinary(scriptDir);
|
|
74
|
-
if (!resolved) {
|
|
75
|
-
console.error([
|
|
76
|
-
"Sleev could not find the native binary for this platform.",
|
|
77
|
-
`Tried: ${packageNames().join(", ")}`,
|
|
78
|
-
"This usually means npm skipped optional dependencies or this platform is not supported yet.",
|
|
79
|
-
"Try reinstalling without --ignore-scripts/--omit=optional, or set SLEEV_BIN_PATH to a local binary.",
|
|
80
|
-
].join("\n"));
|
|
81
|
-
process.exit(1);
|
|
82
|
-
}
|
|
83
|
-
run(resolved);
|
|
84
|
-
//# sourceMappingURL=bin.js.map
|