docs-combiner 0.1.0 → 0.1.1

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/cli.js +21 -3
  2. package/package.json +2 -1
package/cli.js CHANGED
@@ -1,13 +1,31 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- const { spawn } = require('child_process');
3
+ const spawn = require('cross-spawn');
4
4
  const electron = require('electron');
5
5
  const path = require('path');
6
6
 
7
+ // require('electron') returns the path to Electron's executable from node_modules/electron
8
+ // On Windows: .../node_modules/electron/dist/electron.exe
9
+ // On macOS: .../node_modules/electron/dist/Electron.app/Contents/MacOS/Electron
10
+ // On Linux: .../node_modules/electron/dist/electron
11
+ const electronPath = electron;
12
+
13
+ // Path to the app directory (where package.json and dist/ are located)
14
+ // When installed via npx, __dirname points to the installed package location
7
15
  const appPath = path.join(__dirname);
8
- const child = spawn(electron, [appPath], { stdio: 'inherit' });
16
+
17
+ // Use cross-spawn for cross-platform compatibility
18
+ // cross-spawn correctly handles Windows paths, .exe extensions, and spaces in paths
19
+ const child = spawn(electronPath, [appPath], {
20
+ stdio: 'inherit'
21
+ });
22
+
23
+ child.on('error', (err) => {
24
+ console.error('Failed to start Electron:', err.message);
25
+ process.exit(1);
26
+ });
9
27
 
10
28
  child.on('close', (code) => {
11
- process.exit(code);
29
+ process.exit(code || 0);
12
30
  });
13
31
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "docs-combiner",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Combine titles, texts, and images into a product feed table",
5
5
  "main": "dist/main.js",
6
6
  "bin": {
@@ -38,6 +38,7 @@
38
38
  "@emotion/styled": "^11.14.1",
39
39
  "@mui/icons-material": "^7.3.5",
40
40
  "@mui/material": "^7.3.5",
41
+ "cross-spawn": "^7.0.6",
41
42
  "electron": "^28.0.0",
42
43
  "jszip": "^3.10.1",
43
44
  "react": "^19.2.0",