@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.
Files changed (2) hide show
  1. package/bin/install.js +8 -3
  2. 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, renameSync, rmSync } = require("node:fs");
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
- renameSync(extracted, destination);
141
- if (process.platform !== "win32") require("node:fs").chmodSync(destination, 0o755);
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}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bloret-crew/blora-agent",
3
- "version": "0.1.0-beta.2",
3
+ "version": "0.1.0-beta.3",
4
4
  "description": "Blora Agent CLI installer",
5
5
  "license": "GPL-3.0-or-later",
6
6
  "repository": {