@boxes-dev/cli 1.0.578 → 1.0.580

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/dvb CHANGED
@@ -1,6 +1,20 @@
1
1
  #!/bin/sh
2
2
  DEVBOX_DIR="${DEVBOX_HOME:-$HOME/.devbox}"
3
3
  STANDALONE_DIR="$DEVBOX_DIR/standalone/current"
4
+ OWNER_PATH="$0"
5
+ case "$OWNER_PATH" in
6
+ */*)
7
+ OWNER_PATH="$(cd "$(dirname "$OWNER_PATH")" && pwd)/$(basename "$OWNER_PATH")"
8
+ ;;
9
+ *)
10
+ OWNER_PATH="$(command -v -- "$OWNER_PATH" 2>/dev/null || printf '%s' "$OWNER_PATH")"
11
+ ;;
12
+ esac
13
+ if [ -n "${DEVBOX_INSTALL_OWNER_PATHS:-}" ]; then
14
+ export DEVBOX_INSTALL_OWNER_PATHS="${DEVBOX_INSTALL_OWNER_PATHS}:$OWNER_PATH"
15
+ else
16
+ export DEVBOX_INSTALL_OWNER_PATHS="$OWNER_PATH"
17
+ fi
4
18
  if [ ! -x "$STANDALONE_DIR/dvb" ]; then
5
19
  echo "dvb: standalone runtime not installed." >&2
6
20
  echo "Run: npm install -g @boxes-dev/cli" >&2
package/bin/dvbd CHANGED
@@ -1,6 +1,20 @@
1
1
  #!/bin/sh
2
2
  DEVBOX_DIR="${DEVBOX_HOME:-$HOME/.devbox}"
3
3
  STANDALONE_DIR="$DEVBOX_DIR/standalone/current"
4
+ OWNER_PATH="$0"
5
+ case "$OWNER_PATH" in
6
+ */*)
7
+ OWNER_PATH="$(cd "$(dirname "$OWNER_PATH")" && pwd)/$(basename "$OWNER_PATH")"
8
+ ;;
9
+ *)
10
+ OWNER_PATH="$(command -v -- "$OWNER_PATH" 2>/dev/null || printf '%s' "$OWNER_PATH")"
11
+ ;;
12
+ esac
13
+ if [ -n "${DEVBOX_INSTALL_OWNER_PATHS:-}" ]; then
14
+ export DEVBOX_INSTALL_OWNER_PATHS="${DEVBOX_INSTALL_OWNER_PATHS}:$OWNER_PATH"
15
+ else
16
+ export DEVBOX_INSTALL_OWNER_PATHS="$OWNER_PATH"
17
+ fi
4
18
  if [ ! -x "$STANDALONE_DIR/dvbd" ]; then
5
19
  echo "dvbd: standalone runtime not installed." >&2
6
20
  echo "Run: npm install -g @boxes-dev/cli" >&2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@boxes-dev/cli",
3
- "version": "1.0.578",
3
+ "version": "1.0.580",
4
4
  "description": "Boxes.dev CLI (standalone, includes bundled Node runtime)",
5
5
  "license": "UNLICENSED",
6
6
  "publishConfig": {
@@ -5,11 +5,10 @@ const { execFileSync } = require("node:child_process");
5
5
  const path = require("node:path");
6
6
 
7
7
  try {
8
- execFileSync(
9
- process.execPath,
10
- [path.join(__dirname, "postinstall.mjs")],
11
- { stdio: "inherit", env: { ...process.env } },
12
- );
8
+ execFileSync(process.execPath, [path.join(__dirname, "postinstall.mjs")], {
9
+ stdio: "inherit",
10
+ env: { ...process.env },
11
+ });
13
12
  } catch (err) {
14
13
  // Non-zero exit from the ESM script.
15
14
  if (err.status != null) {
@@ -70,7 +70,9 @@ async function fetchJson(url) {
70
70
  async function downloadFile(url, dest) {
71
71
  const res = await fetch(url);
72
72
  if (!res.ok) {
73
- throw new Error(`Failed to download ${url}: ${res.status} ${res.statusText}`);
73
+ throw new Error(
74
+ `Failed to download ${url}: ${res.status} ${res.statusText}`,
75
+ );
74
76
  }
75
77
  const fileStream = fs.createWriteStream(dest);
76
78
  await pipeline(res.body, fileStream);
@@ -92,7 +94,9 @@ async function main() {
92
94
  const devboxDir = getDevboxDir();
93
95
  const standaloneDir = path.join(devboxDir, "standalone");
94
96
 
95
- console.log(`@boxes-dev/cli: installing standalone dvb for ${platformKey}...`);
97
+ console.log(
98
+ `@boxes-dev/cli: installing standalone dvb for ${platformKey}...`,
99
+ );
96
100
 
97
101
  // 1. Fetch manifest
98
102
  const manifestUrl = getManifestUrl();
@@ -115,24 +119,28 @@ async function main() {
115
119
  console.error(
116
120
  `@boxes-dev/cli: no archive available for platform ${platformKey}`,
117
121
  );
118
- console.error(`Available platforms: ${Object.keys(manifest.archives || {}).join(", ")}`);
122
+ console.error(
123
+ `Available platforms: ${Object.keys(manifest.archives || {}).join(", ")}`,
124
+ );
119
125
  process.exit(1);
120
126
  }
121
127
 
122
128
  const version = manifest.version;
123
- const versionDir = path.join(
124
- standaloneDir,
125
- `${version}-${platformKey}`,
126
- );
129
+ const versionDir = path.join(standaloneDir, `${version}-${platformKey}`);
127
130
  const currentLink = path.join(standaloneDir, "current");
128
131
 
129
132
  // 2. Check if already installed at this version
130
- if (fs.existsSync(versionDir) && fs.existsSync(path.join(versionDir, "dvb"))) {
133
+ if (
134
+ fs.existsSync(versionDir) &&
135
+ fs.existsSync(path.join(versionDir, "dvb"))
136
+ ) {
131
137
  // Check if current symlink already points here.
132
138
  try {
133
139
  const currentTarget = fs.readlinkSync(currentLink);
134
- if (path.resolve(standaloneDir, currentTarget) === versionDir ||
135
- currentTarget === versionDir) {
140
+ if (
141
+ path.resolve(standaloneDir, currentTarget) === versionDir ||
142
+ currentTarget === versionDir
143
+ ) {
136
144
  console.log(
137
145
  `@boxes-dev/cli: standalone dvb v${version} already installed, skipping.`,
138
146
  );
@@ -200,11 +208,15 @@ async function main() {
200
208
  } catch (err) {
201
209
  console.error(`@boxes-dev/cli: installation failed: ${err.message}`);
202
210
  // Clean up
203
- try { fs.rmSync(tmpDir, { recursive: true, force: true }); } catch {}
211
+ try {
212
+ fs.rmSync(tmpDir, { recursive: true, force: true });
213
+ } catch {}
204
214
  process.exit(1);
205
215
  } finally {
206
216
  // Always clean up the tarball
207
- try { fs.unlinkSync(tarballPath); } catch {}
217
+ try {
218
+ fs.unlinkSync(tarballPath);
219
+ } catch {}
208
220
  }
209
221
  }
210
222
 
@@ -218,8 +230,12 @@ function updateCurrentSymlink(standaloneDir, currentLink, versionDir, version) {
218
230
  fs.renameSync(tmpLink, currentLink);
219
231
  } catch {
220
232
  // Fallback: remove and recreate.
221
- try { fs.unlinkSync(tmpLink); } catch {}
222
- try { fs.unlinkSync(currentLink); } catch {}
233
+ try {
234
+ fs.unlinkSync(tmpLink);
235
+ } catch {}
236
+ try {
237
+ fs.unlinkSync(currentLink);
238
+ } catch {}
223
239
  const relTarget = path.relative(standaloneDir, versionDir);
224
240
  fs.symlinkSync(relTarget, currentLink);
225
241
  }