@bloret-crew/blora-agent 0.1.0-beta.2 → 0.1.0-beta.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.
- package/bin/install.js +8 -3
- package/package.json +1 -1
package/bin/install.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
const { createWriteStream, existsSync, mkdirSync,
|
|
3
|
+
const { chmodSync, copyFileSync, createWriteStream, existsSync, mkdirSync, rmSync, unlinkSync } = require("node:fs");
|
|
4
4
|
const { tmpdir } = require("node:os");
|
|
5
5
|
const path = require("node:path");
|
|
6
6
|
const { execFile } = require("node:child_process");
|
|
@@ -137,8 +137,13 @@ async function main() {
|
|
|
137
137
|
await extract(archive, target);
|
|
138
138
|
const extracted = path.join(target, executable);
|
|
139
139
|
if (!existsSync(extracted)) throw new Error(`release archive does not contain ${executable}`);
|
|
140
|
-
|
|
141
|
-
|
|
140
|
+
try {
|
|
141
|
+
copyFileSync(extracted, destination);
|
|
142
|
+
unlinkSync(extracted);
|
|
143
|
+
} catch (error) {
|
|
144
|
+
throw new Error(`could not install binary: ${error.message}`);
|
|
145
|
+
}
|
|
146
|
+
if (process.platform !== "win32") chmodSync(destination, 0o755);
|
|
142
147
|
console.log("Blora installed.");
|
|
143
148
|
} catch (error) {
|
|
144
149
|
console.error(`Blora binary download failed: ${error.message}`);
|