relayfile 0.1.2 → 0.1.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/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "relayfile",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "CLI for relayfile — real-time filesystem for humans and agents",
5
5
  "bin": {
6
- "relayfile": "bin/relayfile"
6
+ "relayfile": "scripts/run.js"
7
7
  },
8
8
  "scripts": {
9
9
  "postinstall": "node scripts/install.js || true"
@@ -8,7 +8,6 @@ const https = require("https");
8
8
 
9
9
  const VERSION = require("../package.json").version;
10
10
  const BIN_DIR = path.join(__dirname, "..", "bin");
11
- const BIN_PATH = path.join(BIN_DIR, "relayfile");
12
11
 
13
12
  const PLATFORM_MAP = {
14
13
  darwin: "darwin",
@@ -21,6 +20,10 @@ const ARCH_MAP = {
21
20
  arm64: "arm64",
22
21
  };
23
22
 
23
+ function getBinaryFilename() {
24
+ return os.platform() === "win32" ? "relayfile.exe" : "relayfile";
25
+ }
26
+
24
27
  function getDownloadUrl() {
25
28
  const platform = PLATFORM_MAP[os.platform()];
26
29
  const arch = ARCH_MAP[os.arch()];
@@ -61,13 +64,14 @@ function download(url, dest) {
61
64
 
62
65
  async function main() {
63
66
  const url = getDownloadUrl();
67
+ const binPath = path.join(BIN_DIR, getBinaryFilename());
64
68
 
65
69
  fs.mkdirSync(BIN_DIR, { recursive: true });
66
70
 
67
71
  console.log(`Downloading relayfile v${VERSION}...`);
68
72
  try {
69
- await download(url, BIN_PATH);
70
- fs.chmodSync(BIN_PATH, 0o755);
73
+ await download(url, binPath);
74
+ fs.chmodSync(binPath, 0o755);
71
75
  console.log("relayfile installed successfully.");
72
76
  } catch (err) {
73
77
  console.error(`Failed to download relayfile: ${err.message}`);
package/scripts/run.js ADDED
@@ -0,0 +1,31 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { spawnSync } = require("child_process");
4
+ const fs = require("fs");
5
+ const os = require("os");
6
+ const path = require("path");
7
+
8
+ const binName = os.platform() === "win32" ? "relayfile.exe" : "relayfile";
9
+ const binPath = path.join(__dirname, "..", "bin", binName);
10
+
11
+ if (!fs.existsSync(binPath)) {
12
+ console.error(
13
+ `relayfile binary not found at ${binPath}. Reinstall the package or run postinstall again.`
14
+ );
15
+ process.exit(1);
16
+ }
17
+
18
+ const result = spawnSync(binPath, process.argv.slice(2), {
19
+ stdio: "inherit",
20
+ });
21
+
22
+ if (result.error) {
23
+ console.error(`Failed to launch relayfile binary: ${result.error.message}`);
24
+ process.exit(1);
25
+ }
26
+
27
+ if (typeof result.status === "number") {
28
+ process.exit(result.status);
29
+ }
30
+
31
+ process.exit(1);