create-zfb 0.1.0-next.37 → 0.1.0-next.39

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/create-zfb.mjs +15 -0
  2. package/package.json +2 -2
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { spawnSync } from "node:child_process";
3
3
  import { createRequire } from "node:module";
4
+ import { constants as osConstants } from "node:os";
4
5
  import { dirname, join } from "node:path";
5
6
 
6
7
  const require = createRequire(import.meta.url);
@@ -94,4 +95,18 @@ const zfbBin = join(dirname(zfbPkgJson), "bin", "zfb.mjs");
94
95
 
95
96
  const args = ["new", ...process.argv.slice(2)];
96
97
  const result = spawnSync(process.execPath, [zfbBin, ...args], { stdio: "inherit" });
98
+ if (result.signal) {
99
+ // Re-raise the child's termination signal on ourselves so the caller sees
100
+ // the real cause of death (e.g. WIFSIGNALED), not a plain exit code 1.
101
+ // Mirrors the wrapper behaviour in packages/zfb/bin/zfb.mjs.
102
+ try {
103
+ process.kill(process.pid, result.signal);
104
+ } catch {
105
+ // Signal cannot be re-raised on this platform (Windows emulation).
106
+ }
107
+ // Reached only if the re-raised signal did not terminate us — fall back
108
+ // to the shell's 128+n convention for death-by-signal.
109
+ const signum = osConstants.signals[result.signal];
110
+ process.exit(signum ? 128 + signum : 1);
111
+ }
97
112
  process.exit(result.status ?? 1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-zfb",
3
- "version": "0.1.0-next.37",
3
+ "version": "0.1.0-next.39",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Scaffold a new zfb static-site project: `npm create zfb@latest my-site`",
@@ -35,6 +35,6 @@
35
35
  "node": ">=18"
36
36
  },
37
37
  "dependencies": {
38
- "@takazudo/zfb": "0.1.0-next.37"
38
+ "@takazudo/zfb": "0.1.0-next.39"
39
39
  }
40
40
  }