@safedep/gryph 0.0.1 → 0.2.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/package.json +1 -1
- package/bin/gryph.js +0 -76
package/package.json
CHANGED
package/bin/gryph.js
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
const fs = require("fs");
|
|
4
|
-
const path = require("path");
|
|
5
|
-
const { spawn } = require("child_process");
|
|
6
|
-
const { ORG_NAME, PACKAGE_NAME, BINARY_NAME } = require("../config");
|
|
7
|
-
|
|
8
|
-
const BINARY_NAME_WITH_EXT =
|
|
9
|
-
process.platform === "win32" ? `${BINARY_NAME}.exe` : BINARY_NAME;
|
|
10
|
-
const BINARY_PATH = path.join(__dirname, BINARY_NAME_WITH_EXT);
|
|
11
|
-
|
|
12
|
-
function main() {
|
|
13
|
-
// Check if binary exists
|
|
14
|
-
if (!fs.existsSync(BINARY_PATH)) {
|
|
15
|
-
console.error(`❌ ${BINARY_NAME_WITH_EXT} binary not found`);
|
|
16
|
-
console.error(
|
|
17
|
-
`Try reinstalling: npm install -g ${ORG_NAME}/${PACKAGE_NAME}`,
|
|
18
|
-
);
|
|
19
|
-
process.exit(1);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
// Verify binary is executable
|
|
23
|
-
try {
|
|
24
|
-
fs.accessSync(BINARY_PATH, fs.constants.F_OK | fs.constants.X_OK);
|
|
25
|
-
} catch (error) {
|
|
26
|
-
console.error(`❌ ${BINARY_NAME_WITH_EXT} is not executable`);
|
|
27
|
-
console.error(
|
|
28
|
-
`Try reinstalling: npm install -g ${ORG_NAME}/${PACKAGE_NAME}`,
|
|
29
|
-
);
|
|
30
|
-
process.exit(1);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
// Pass all arguments to the binary
|
|
34
|
-
const args = process.argv.slice(2);
|
|
35
|
-
|
|
36
|
-
// Spawn the binary with inherited stdio for proper terminal interaction
|
|
37
|
-
const child = spawn(BINARY_PATH, args, {
|
|
38
|
-
stdio: "inherit",
|
|
39
|
-
windowsHide: false,
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
// Handle process termination
|
|
43
|
-
child.on("error", (error) => {
|
|
44
|
-
console.error(
|
|
45
|
-
`❌ Failed to execute ${BINARY_NAME_WITH_EXT}: ${error.message}`,
|
|
46
|
-
);
|
|
47
|
-
console.error(
|
|
48
|
-
`Try reinstalling: npm install -g ${ORG_NAME}/${PACKAGE_NAME}`,
|
|
49
|
-
);
|
|
50
|
-
process.exit(1);
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
// Exit with the same code as the child process
|
|
54
|
-
child.on("exit", (code, signal) => {
|
|
55
|
-
if (signal) {
|
|
56
|
-
process.kill(process.pid, signal);
|
|
57
|
-
} else {
|
|
58
|
-
process.exit(code || 0);
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
// Handle termination signals
|
|
63
|
-
process.on("SIGTERM", () => {
|
|
64
|
-
child.kill("SIGTERM");
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
process.on("SIGINT", () => {
|
|
68
|
-
child.kill("SIGINT");
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
if (require.main === module) {
|
|
73
|
-
main();
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
module.exports = { main };
|