lapeh 2.3.9 → 2.4.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.
- package/bin/index.js +22 -5
- package/package.json +1 -1
package/bin/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
1
|
+
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
const fs = require('fs');
|
|
4
4
|
const path = require('path');
|
|
@@ -47,7 +47,21 @@ function runDev() {
|
|
|
47
47
|
const bootstrapPath = fs.existsSync(localBootstrapPath) ? localBootstrapPath : fallbackBootstrapPath;
|
|
48
48
|
|
|
49
49
|
// We execute a script that requires ts-node to run lib/bootstrap.ts
|
|
50
|
-
|
|
50
|
+
// Use JSON.stringify to properly escape paths for the shell command
|
|
51
|
+
const nodeArgs = `-r ${JSON.stringify(tsNodePath)} -r ${JSON.stringify(tsConfigPathsPath)} ${JSON.stringify(bootstrapPath)}`;
|
|
52
|
+
const isWin = process.platform === 'win32';
|
|
53
|
+
|
|
54
|
+
let cmd;
|
|
55
|
+
if (isWin) {
|
|
56
|
+
// On Windows, escape inner quotes
|
|
57
|
+
const escapedArgs = nodeArgs.replace(/"/g, '\\"');
|
|
58
|
+
cmd = `npx nodemon --watch src --watch lib --ext ts,json --exec "node ${escapedArgs}"`;
|
|
59
|
+
} else {
|
|
60
|
+
// On Linux/Mac, use single quotes for the outer wrapper
|
|
61
|
+
cmd = `npx nodemon --watch src --watch lib --ext ts,json --exec 'node ${nodeArgs}'`;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
execSync(cmd, { stdio: 'inherit' });
|
|
51
65
|
} catch (error) {
|
|
52
66
|
// Ignore error
|
|
53
67
|
}
|
|
@@ -157,14 +171,17 @@ function runStart() {
|
|
|
157
171
|
}
|
|
158
172
|
|
|
159
173
|
if (tsNodePath && tsConfigPathsPath) {
|
|
160
|
-
|
|
174
|
+
const script = `require(${JSON.stringify(bootstrapPath)}).bootstrap()`;
|
|
175
|
+
cmd = `node -r ${JSON.stringify(tsNodePath)} -r ${JSON.stringify(tsConfigPathsPath)} -e ${JSON.stringify(script)}`;
|
|
161
176
|
} else {
|
|
162
177
|
// Fallback to npx if resolution fails
|
|
163
|
-
|
|
178
|
+
const script = `require(${JSON.stringify(bootstrapPath)}).bootstrap()`;
|
|
179
|
+
cmd = `npx ts-node -r tsconfig-paths/register -e ${JSON.stringify(script)}`;
|
|
164
180
|
}
|
|
165
181
|
} else {
|
|
166
182
|
// JS file, run with node
|
|
167
|
-
|
|
183
|
+
const script = `require(${JSON.stringify(bootstrapPath)}).bootstrap()`;
|
|
184
|
+
cmd = `node -e ${JSON.stringify(script)}`;
|
|
168
185
|
}
|
|
169
186
|
|
|
170
187
|
execSync(cmd, {
|