@pwrs/cem 0.9.0 → 0.9.2

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/cem.js +23 -3
  2. package/package.json +7 -7
package/bin/cem.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { platform, arch } from "node:os";
3
3
  import { createRequire } from "node:module";
4
- import { spawnSync } from "node:child_process";
4
+ import { spawn } from "node:child_process";
5
5
 
6
6
  const require = createRequire(import.meta.url);
7
7
  const supportedTargets = new Set([
@@ -28,5 +28,25 @@ try {
28
28
  process.exit(1);
29
29
  }
30
30
 
31
- const result = spawnSync(binPath, process.argv.slice(2), { stdio: "inherit" });
32
- process.exit(result.status ?? 1);
31
+ const child = spawn(binPath, process.argv.slice(2), { stdio: "inherit" });
32
+
33
+ // Forward common termination signals to child
34
+ const signals = ['SIGTERM', 'SIGINT', 'SIGHUP'];
35
+ signals.forEach(signal => {
36
+ process.on(signal, () => {
37
+ child.kill(signal);
38
+ });
39
+ });
40
+
41
+ child.on('error', (err) => {
42
+ console.error(`cem: Failed to spawn binary: ${err.message}`);
43
+ process.exit(1);
44
+ });
45
+
46
+ child.on('exit', (code, signal) => {
47
+ // Exit with child's code, or 128 + signal number per Unix convention
48
+ if (signal) {
49
+ process.exit(128 + (process.platform === 'win32' ? 1 : 0));
50
+ }
51
+ process.exit(code ?? 1);
52
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pwrs/cem",
3
- "version": "0.9.0",
3
+ "version": "0.9.2",
4
4
  "description": "CLI tool for generating and working with Custom Elements Manifests",
5
5
  "type": "module",
6
6
  "engines": {
@@ -13,12 +13,12 @@
13
13
  "postinstall": "node ./install-platform-binary.js"
14
14
  },
15
15
  "optionalDependencies": {
16
- "@pwrs/cem-linux-x64": "0.9.0",
17
- "@pwrs/cem-linux-arm64": "0.9.0",
18
- "@pwrs/cem-darwin-x64": "0.9.0",
19
- "@pwrs/cem-darwin-arm64": "0.9.0",
20
- "@pwrs/cem-win32-x64": "0.9.0",
21
- "@pwrs/cem-win32-arm64": "0.9.0"
16
+ "@pwrs/cem-linux-x64": "0.9.2",
17
+ "@pwrs/cem-linux-arm64": "0.9.2",
18
+ "@pwrs/cem-darwin-x64": "0.9.2",
19
+ "@pwrs/cem-darwin-arm64": "0.9.2",
20
+ "@pwrs/cem-win32-x64": "0.9.2",
21
+ "@pwrs/cem-win32-arm64": "0.9.2"
22
22
  },
23
23
  "files": [
24
24
  "bin/cem.js",