@bitmilldev/warden 1.0.0 → 1.0.1
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/warden +23 -0
- package/package.json +1 -1
- package/scripts/postinstall.js +19 -1
package/bin/warden
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const { spawnSync } = require("child_process");
|
|
3
|
+
const path = require("path");
|
|
4
|
+
const os = require("os");
|
|
5
|
+
|
|
6
|
+
const ext = os.platform() === "win32" ? ".exe" : "";
|
|
7
|
+
const binary = path.join(os.homedir(), ".warden", "bin", `warden${ext}`);
|
|
8
|
+
|
|
9
|
+
const result = spawnSync(binary, process.argv.slice(2), {
|
|
10
|
+
stdio: "inherit",
|
|
11
|
+
windowsHide: true,
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
if (result.error) {
|
|
15
|
+
if (result.error.code === "ENOENT") {
|
|
16
|
+
console.error("warden binary not found. Run: npm install -g @bitmilldev/warden");
|
|
17
|
+
} else {
|
|
18
|
+
console.error(`Failed to run warden: ${result.error.message}`);
|
|
19
|
+
}
|
|
20
|
+
process.exit(1);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
process.exit(result.status || 0);
|
package/package.json
CHANGED
package/scripts/postinstall.js
CHANGED
|
@@ -46,9 +46,27 @@ async function main() {
|
|
|
46
46
|
|
|
47
47
|
try {
|
|
48
48
|
await download(url, dest);
|
|
49
|
-
if (os.platform()
|
|
49
|
+
if (os.platform() === "win32") {
|
|
50
|
+
// Remove Zone.Identifier to prevent SmartScreen "Access denied"
|
|
51
|
+
try { fs.unlinkSync(dest + ":Zone.Identifier"); } catch (e) {}
|
|
52
|
+
} else {
|
|
50
53
|
fs.chmodSync(dest, 0o755);
|
|
51
54
|
}
|
|
55
|
+
|
|
56
|
+
// Also download the relay binary (Windows only — prevents CMD flicker)
|
|
57
|
+
if (os.platform() === "win32") {
|
|
58
|
+
const relayBinary = binary.replace("warden-", "warden-relay-");
|
|
59
|
+
const relayDest = path.join(binDir, "warden-relay.exe");
|
|
60
|
+
const relayUrl = `https://github.com/${REPO}/releases/download/v${VERSION}/${relayBinary}`;
|
|
61
|
+
try {
|
|
62
|
+
await download(relayUrl, relayDest);
|
|
63
|
+
try { fs.unlinkSync(relayDest + ":Zone.Identifier"); } catch (e) {}
|
|
64
|
+
console.log(`Installed relay to ${relayDest}`);
|
|
65
|
+
} catch (e) {
|
|
66
|
+
// Relay is optional — warden works without it (just has CMD flicker)
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
52
70
|
console.log(`Installed to ${dest}`);
|
|
53
71
|
|
|
54
72
|
// Run warden init (non-interactive: just PATH + config)
|