@satori-sh/cli 0.0.17 → 0.0.19
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/dist/index.js +4 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -234,22 +234,21 @@ async function main() {
|
|
|
234
234
|
const isInteractive = process.stdin.isTTY && process.stdout.isTTY;
|
|
235
235
|
if (isInteractive && !globalThis.Bun && !process.env.SATORI_BUN_REEXEC) {
|
|
236
236
|
const bunBinDir = join2(homedir2(), ".bun", "bin");
|
|
237
|
-
const bunPath = join2(bunBinDir, "bun");
|
|
238
237
|
const baseEnv = { ...process.env, PATH: `${bunBinDir}:${process.env.PATH ?? ""}` };
|
|
239
|
-
const
|
|
240
|
-
if (
|
|
238
|
+
const ensureBun = () => spawnSync("bun", ["--version"], { stdio: "ignore", env: baseEnv }).status === 0;
|
|
239
|
+
if (!ensureBun()) {
|
|
241
240
|
const installResult = spawnSync(
|
|
242
241
|
"bash",
|
|
243
242
|
["-lc", "curl -fsSL https://bun.sh/install | bash"],
|
|
244
243
|
{ stdio: "inherit" }
|
|
245
244
|
);
|
|
246
|
-
if (installResult.status !== 0) {
|
|
245
|
+
if (installResult.status !== 0 || !ensureBun()) {
|
|
247
246
|
console.error("Failed to install Bun. Please install manually and retry.");
|
|
248
247
|
process.exit(1);
|
|
249
248
|
}
|
|
250
249
|
}
|
|
251
250
|
const bunProcess = spawn(
|
|
252
|
-
|
|
251
|
+
"bun",
|
|
253
252
|
[modulePath2, ...process.argv.slice(2)],
|
|
254
253
|
{ env: { ...baseEnv, SATORI_BUN_REEXEC: "1" }, stdio: "inherit" }
|
|
255
254
|
);
|