business-stack 0.1.6 → 0.1.7

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.
@@ -121,9 +121,7 @@ function getCliPackageVersion() {
121
121
  }
122
122
 
123
123
  function logPhase(msg) {
124
- const line = `business-stack: ${msg}`;
125
- console.log(line);
126
- console.error(line);
124
+ console.error(`business-stack: ${msg}`);
127
125
  }
128
126
 
129
127
  /** Microsoft Store / WindowsApps shims often exit 0 immediately with no real Bun — skip them. */
@@ -151,11 +149,14 @@ function whereAll(cmd) {
151
149
  }
152
150
 
153
151
  function executableResponds(exe, args) {
152
+ const win = process.platform === "win32";
153
+ const shell = win && /\.(cmd|bat)$/i.test(exe);
154
154
  const r = spawnSync(exe, args, {
155
155
  encoding: "utf8",
156
156
  windowsHide: true,
157
157
  stdio: ["ignore", "pipe", "pipe"],
158
158
  timeout: 20_000,
159
+ shell,
159
160
  });
160
161
  if (r.error) {
161
162
  return false;
@@ -199,6 +200,13 @@ function resolveExecutable(cmd) {
199
200
  return order[order.length - 1] || cmd;
200
201
  }
201
202
 
203
+ /** Windows: spawning `.cmd` with shell:false often yields EINVAL; use shell for these. */
204
+ function useWindowsShell(cmd) {
205
+ if (process.platform !== "win32") return false;
206
+ const c = String(cmd).toLowerCase();
207
+ return c === "npm" || c === "npx" || c === "uv";
208
+ }
209
+
202
210
  function cmdExists(cmd) {
203
211
  const isWin = process.platform === "win32";
204
212
  const which = isWin ? "where" : "which";
@@ -380,16 +388,18 @@ function envFileLooksConfigured(stackRoot) {
380
388
 
381
389
  function runCmd(label, cmd, args, cwd, extraEnv) {
382
390
  logPhase(`${label}…`);
383
- const exe = resolveExecutable(cmd);
384
- if (process.platform === "win32") {
385
- logPhase(`using ${cmd} ${exe}`);
391
+ const win = process.platform === "win32";
392
+ const shell = useWindowsShell(cmd);
393
+ const exe = shell ? cmd : resolveExecutable(cmd);
394
+ if (win) {
395
+ logPhase(shell ? `${cmd} (via shell)` : `using ${cmd} → ${exe}`);
386
396
  }
387
397
  const r = spawnSync(exe, args, {
388
398
  cwd,
389
399
  stdio: "inherit",
390
400
  env: { ...process.env, ...extraEnv },
391
- shell: false,
392
- windowsHide: process.platform === "win32",
401
+ shell,
402
+ windowsHide: win,
393
403
  });
394
404
  if (r.error) {
395
405
  console.error(`business-stack: ${label} failed:`, r.error.message);
@@ -481,16 +491,18 @@ async function runStart(opts) {
481
491
  }
482
492
 
483
493
  logPhase("launching production servers (turbo start via npm)");
484
- const npmExe = resolveExecutable("npm");
485
- if (process.platform === "win32") {
486
- logPhase(`using npm ${npmExe}`);
494
+ const win = process.platform === "win32";
495
+ const shell = useWindowsShell("npm");
496
+ const npmCmd = shell ? "npm" : resolveExecutable("npm");
497
+ if (win) {
498
+ logPhase(shell ? "npm (via shell)" : `using npm → ${npmCmd}`);
487
499
  }
488
- const child = spawn(npmExe, ["run", "start"], {
500
+ const child = spawn(npmCmd, ["run", "start"], {
489
501
  cwd: stackRoot,
490
502
  stdio: "inherit",
491
503
  env: childEnv,
492
- shell: false,
493
- windowsHide: process.platform === "win32",
504
+ shell,
505
+ windowsHide: win,
494
506
  });
495
507
 
496
508
  const shutdown = () => {
@@ -530,7 +542,7 @@ function runDev() {
530
542
  program
531
543
  .name("business-stack")
532
544
  .description("Run the business-stack monorepo (Next + Hono gateway + FastAPI)")
533
- .version("0.1.6");
545
+ .version("0.1.7");
534
546
 
535
547
  program
536
548
  .command("doctor")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "business-stack",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "Next.js + Hono gateway + FastAPI monorepo",
5
5
  "license": "UNLICENSED",
6
6
  "workspaces": ["frontend/web", "gateway", "backend"],