rules-cli 1.2.1 → 1.2.3
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.
Binary file
|
Binary file
|
Binary file
|
package/bin/linux-x64/rules-cli
CHANGED
Binary file
|
Binary file
|
package/bin.js
CHANGED
@@ -1,24 +1,34 @@
|
|
1
1
|
#!/usr/bin/env node
|
2
2
|
|
3
|
-
const { spawn } = require(
|
4
|
-
const path = require(
|
5
|
-
const fs = require(
|
6
|
-
const os = require(
|
3
|
+
const { spawn } = require("child_process");
|
4
|
+
const path = require("path");
|
5
|
+
const fs = require("fs");
|
6
|
+
const os = require("os");
|
7
7
|
|
8
8
|
// Determine platform and architecture
|
9
9
|
const platform = os.platform();
|
10
|
-
|
10
|
+
let arch = os.arch();
|
11
|
+
|
12
|
+
// Map architecture for consistency with binary naming
|
13
|
+
if (platform === "darwin" && arch === "x64") {
|
14
|
+
arch = "amd64";
|
15
|
+
}
|
11
16
|
|
12
17
|
// Map OS and architecture to binary name
|
13
18
|
let binaryName;
|
14
|
-
if (platform ===
|
15
|
-
binaryName =
|
19
|
+
if (platform === "win32") {
|
20
|
+
binaryName = "rules-cli.exe";
|
16
21
|
} else {
|
17
|
-
binaryName =
|
22
|
+
binaryName = "rules-cli";
|
18
23
|
}
|
19
24
|
|
20
25
|
// Construct path to the binary
|
21
|
-
const binaryPath = path.join(
|
26
|
+
const binaryPath = path.join(
|
27
|
+
__dirname,
|
28
|
+
"bin",
|
29
|
+
`${platform}-${arch}`,
|
30
|
+
binaryName
|
31
|
+
);
|
22
32
|
|
23
33
|
// Check if binary exists
|
24
34
|
if (!fs.existsSync(binaryPath)) {
|
@@ -27,9 +37,9 @@ if (!fs.existsSync(binaryPath)) {
|
|
27
37
|
}
|
28
38
|
|
29
39
|
// Make binary executable (not needed on Windows)
|
30
|
-
if (platform !==
|
40
|
+
if (platform !== "win32") {
|
31
41
|
try {
|
32
|
-
fs.chmodSync(binaryPath,
|
42
|
+
fs.chmodSync(binaryPath, "755");
|
33
43
|
} catch (error) {
|
34
44
|
console.error(`Failed to make binary executable: ${error.message}`);
|
35
45
|
process.exit(1);
|
@@ -37,13 +47,15 @@ if (platform !== 'win32') {
|
|
37
47
|
}
|
38
48
|
|
39
49
|
// Execute the binary with all arguments passed through
|
40
|
-
const childProcess = spawn(binaryPath, process.argv.slice(2), {
|
50
|
+
const childProcess = spawn(binaryPath, process.argv.slice(2), {
|
51
|
+
stdio: "inherit",
|
52
|
+
});
|
41
53
|
|
42
|
-
childProcess.on(
|
54
|
+
childProcess.on("error", (error) => {
|
43
55
|
console.error(`Failed to start binary: ${error.message}`);
|
44
56
|
process.exit(1);
|
45
57
|
});
|
46
58
|
|
47
|
-
childProcess.on(
|
59
|
+
childProcess.on("close", (code) => {
|
48
60
|
process.exit(code);
|
49
|
-
});
|
61
|
+
});
|