@alienplatform/cli 1.3.2-linux-arm64 → 1.3.2
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/alien.js
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { spawn } from "node:child_process"
|
|
4
|
+
import { existsSync } from "node:fs"
|
|
5
|
+
import { createRequire } from "node:module"
|
|
6
|
+
import { dirname, join } from "node:path"
|
|
7
|
+
|
|
8
|
+
// Map Node.js platform/arch to Rust target triples
|
|
9
|
+
const TARGET_MAP = {
|
|
10
|
+
"linux-x64": "x86_64-unknown-linux-musl",
|
|
11
|
+
"linux-arm64": "aarch64-unknown-linux-musl",
|
|
12
|
+
"darwin-arm64": "aarch64-apple-darwin",
|
|
13
|
+
"win32-x64": "x86_64-pc-windows-msvc",
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const platformKey = `${process.platform}-${process.arch}`
|
|
17
|
+
const target = TARGET_MAP[platformKey]
|
|
18
|
+
|
|
19
|
+
if (!target) {
|
|
20
|
+
console.error(`Unsupported platform: ${platformKey}`)
|
|
21
|
+
process.exit(1)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const binaryName = process.platform === "win32" ? "alien.exe" : "alien"
|
|
25
|
+
|
|
26
|
+
// Try to find the binary from the platform-specific optional dependency
|
|
27
|
+
function findBinary() {
|
|
28
|
+
const require = createRequire(import.meta.url)
|
|
29
|
+
|
|
30
|
+
// Strategy 1: Look for the platform-specific optional dependency
|
|
31
|
+
const platformPkg = `@alienplatform/cli-${platformKey}`
|
|
32
|
+
try {
|
|
33
|
+
const pkgPath = require.resolve(`${platformPkg}/package.json`)
|
|
34
|
+
const vendorDir = join(dirname(pkgPath), "vendor", target)
|
|
35
|
+
const binPath = join(vendorDir, binaryName)
|
|
36
|
+
if (existsSync(binPath)) return binPath
|
|
37
|
+
} catch {
|
|
38
|
+
// Not installed (expected on other platforms)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// Strategy 2: Look in local vendor directory (for development / non-npm installs)
|
|
42
|
+
const localVendor = join(dirname(import.meta.url.replace("file://", "")), "..", "vendor", target)
|
|
43
|
+
const localBin = join(localVendor, binaryName)
|
|
44
|
+
if (existsSync(localBin)) return localBin
|
|
45
|
+
|
|
46
|
+
return null
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const binPath = findBinary()
|
|
50
|
+
|
|
51
|
+
if (!binPath) {
|
|
52
|
+
console.error(
|
|
53
|
+
`Could not find alien binary for ${platformKey}.\nTry reinstalling: npm install -g @alienplatform/cli`,
|
|
54
|
+
)
|
|
55
|
+
process.exit(1)
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// Spawn the binary, forwarding all arguments and stdio
|
|
59
|
+
const child = spawn(binPath, process.argv.slice(2), {
|
|
60
|
+
stdio: "inherit",
|
|
61
|
+
env: process.env,
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
// Forward signals to the child process
|
|
65
|
+
for (const signal of ["SIGINT", "SIGTERM", "SIGHUP"]) {
|
|
66
|
+
process.on(signal, () => {
|
|
67
|
+
if (!child.killed) {
|
|
68
|
+
child.kill(signal)
|
|
69
|
+
}
|
|
70
|
+
})
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
child.on("close", (code, signal) => {
|
|
74
|
+
if (signal) {
|
|
75
|
+
process.kill(process.pid, signal)
|
|
76
|
+
} else {
|
|
77
|
+
process.exit(code ?? 1)
|
|
78
|
+
}
|
|
79
|
+
})
|
package/package.json
CHANGED
|
@@ -1,11 +1,28 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alienplatform/cli",
|
|
3
|
-
"version": "1.3.2
|
|
4
|
-
"description": "Alien
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
|
|
3
|
+
"version": "1.3.2",
|
|
4
|
+
"description": "Alien Developer Platform CLI",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"bin": {
|
|
7
|
+
"alien": "bin/alien.js"
|
|
8
|
+
},
|
|
9
|
+
"type": "module",
|
|
10
|
+
"engines": {
|
|
11
|
+
"node": ">=18"
|
|
12
|
+
},
|
|
13
|
+
"files": ["bin"],
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "https://github.com/alienplatform/alien.git",
|
|
17
|
+
"directory": "packages/alien-cli-npm"
|
|
18
|
+
},
|
|
8
19
|
"publishConfig": {
|
|
9
20
|
"access": "public"
|
|
21
|
+
},
|
|
22
|
+
"optionalDependencies": {
|
|
23
|
+
"@alienplatform/cli-linux-x64": "npm:@alienplatform/cli@1.3.2-linux-x64",
|
|
24
|
+
"@alienplatform/cli-linux-arm64": "npm:@alienplatform/cli@1.3.2-linux-arm64",
|
|
25
|
+
"@alienplatform/cli-darwin-arm64": "npm:@alienplatform/cli@1.3.2-darwin-arm64",
|
|
26
|
+
"@alienplatform/cli-win32-x64": "npm:@alienplatform/cli@1.3.2-win32-x64"
|
|
10
27
|
}
|
|
11
28
|
}
|
|
Binary file
|
|
Binary file
|