halleyfy 0.0.0-stage → 0.1.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/halleyfy.cjs +25 -0
- package/bin/select.cjs +25 -0
- package/package.json +18 -4
- package/README.md +0 -3
package/bin/halleyfy.cjs
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Launcher for the `halleyfy` npm package: runs the compiled binary from this platform's optional package.
|
|
3
|
+
const { spawnSync } = require("node:child_process");
|
|
4
|
+
const { isMusl, packageFor } = require("./select.cjs");
|
|
5
|
+
|
|
6
|
+
const pkg = packageFor(process.platform, process.arch, isMusl());
|
|
7
|
+
if (!pkg) {
|
|
8
|
+
console.error(`halleyfy has no build for ${process.platform}-${process.arch}.`);
|
|
9
|
+
process.exit(1);
|
|
10
|
+
}
|
|
11
|
+
const exe = process.platform === "win32" ? "halleyfy.exe" : "halleyfy";
|
|
12
|
+
let bin;
|
|
13
|
+
try {
|
|
14
|
+
bin = require.resolve(`${pkg}/bin/${exe}`);
|
|
15
|
+
} catch {
|
|
16
|
+
console.error(`halleyfy needs the ${pkg} package, which isn't installed. Reinstall without --omit=optional (or --no-optional).`);
|
|
17
|
+
process.exit(1);
|
|
18
|
+
}
|
|
19
|
+
const r = spawnSync(bin, process.argv.slice(2), { stdio: "inherit" });
|
|
20
|
+
if (r.error) {
|
|
21
|
+
console.error(`Couldn't run ${bin}: ${r.error.message}`);
|
|
22
|
+
process.exit(1);
|
|
23
|
+
}
|
|
24
|
+
if (r.signal) process.kill(process.pid, r.signal);
|
|
25
|
+
process.exit(r.status === null ? 1 : r.status);
|
package/bin/select.cjs
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// Picks the platform package for this machine. Hand-written CommonJS (it ships as-is in the launcher
|
|
2
|
+
// package); platforms.test.ts checks it against TARGETS.
|
|
3
|
+
const fs = require("node:fs");
|
|
4
|
+
|
|
5
|
+
function isMusl() {
|
|
6
|
+
if (process.platform !== "linux") return false;
|
|
7
|
+
const report = process.report && process.report.getReport ? process.report.getReport() : null;
|
|
8
|
+
if (report && report.header) return !report.header.glibcVersionRuntime;
|
|
9
|
+
try {
|
|
10
|
+
return fs.readdirSync("/lib").some((f) => f.startsWith("ld-musl-"));
|
|
11
|
+
} catch {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function packageFor(platform, arch, musl) {
|
|
17
|
+
const cpu = arch === "x64" || arch === "arm64" ? arch : null;
|
|
18
|
+
if (!cpu) return null;
|
|
19
|
+
if (platform === "darwin") return `@halleyfy/cli-darwin-${cpu}`;
|
|
20
|
+
if (platform === "win32") return cpu === "x64" ? "@halleyfy/cli-windows-x64" : null;
|
|
21
|
+
if (platform === "linux") return `@halleyfy/cli-linux-${cpu}${musl ? "-musl" : ""}`;
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
module.exports = { isMusl, packageFor };
|
package/package.json
CHANGED
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "halleyfy",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
|
|
6
|
-
}
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"bin": {
|
|
5
|
+
"halleyfy": "bin/halleyfy.cjs"
|
|
6
|
+
},
|
|
7
|
+
"optionalDependencies": {
|
|
8
|
+
"@halleyfy/cli-darwin-arm64": "0.1.0",
|
|
9
|
+
"@halleyfy/cli-darwin-x64": "0.1.0",
|
|
10
|
+
"@halleyfy/cli-linux-x64": "0.1.0",
|
|
11
|
+
"@halleyfy/cli-linux-arm64": "0.1.0",
|
|
12
|
+
"@halleyfy/cli-linux-x64-musl": "0.1.0",
|
|
13
|
+
"@halleyfy/cli-linux-arm64-musl": "0.1.0",
|
|
14
|
+
"@halleyfy/cli-windows-x64": "0.1.0"
|
|
15
|
+
},
|
|
16
|
+
"engines": {
|
|
17
|
+
"node": ">=18"
|
|
18
|
+
},
|
|
19
|
+
"license": "UNLICENSED"
|
|
20
|
+
}
|
package/README.md
DELETED