lapeh 2.3.9 → 2.4.0

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/index.js +10 -5
  2. 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,9 @@ 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
- execSync(`npx nodemon --watch src --watch lib --ext ts,json --exec "node -r ${tsNodePath} -r ${tsConfigPathsPath} ${bootstrapPath}"`, { stdio: 'inherit' });
50
+ // Use JSON.stringify to properly escape paths for the shell command
51
+ const cmd = `npx nodemon --watch src --watch lib --ext ts,json --exec "node -r ${JSON.stringify(tsNodePath)} -r ${JSON.stringify(tsConfigPathsPath)} ${JSON.stringify(bootstrapPath)}"`;
52
+ execSync(cmd, { stdio: 'inherit' });
51
53
  } catch (error) {
52
54
  // Ignore error
53
55
  }
@@ -157,14 +159,17 @@ function runStart() {
157
159
  }
158
160
 
159
161
  if (tsNodePath && tsConfigPathsPath) {
160
- cmd = `node -r ${tsNodePath} -r ${tsConfigPathsPath} -e "require('${bootstrapPath.replace(/\\/g, '/')}').bootstrap()"`;
162
+ const script = `require(${JSON.stringify(bootstrapPath)}).bootstrap()`;
163
+ cmd = `node -r ${JSON.stringify(tsNodePath)} -r ${JSON.stringify(tsConfigPathsPath)} -e ${JSON.stringify(script)}`;
161
164
  } else {
162
165
  // Fallback to npx if resolution fails
163
- cmd = `npx ts-node -r tsconfig-paths/register -e "require('${bootstrapPath.replace(/\\/g, '/')}').bootstrap()"`;
166
+ const script = `require(${JSON.stringify(bootstrapPath)}).bootstrap()`;
167
+ cmd = `npx ts-node -r tsconfig-paths/register -e ${JSON.stringify(script)}`;
164
168
  }
165
169
  } else {
166
170
  // JS file, run with node
167
- cmd = `node -e "require('${bootstrapPath.replace(/\\/g, '/')}').bootstrap()"`;
171
+ const script = `require(${JSON.stringify(bootstrapPath)}).bootstrap()`;
172
+ cmd = `node -e ${JSON.stringify(script)}`;
168
173
  }
169
174
 
170
175
  execSync(cmd, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lapeh",
3
- "version": "2.3.9",
3
+ "version": "2.4.0",
4
4
  "description": "Framework API Express yang siap pakai (Standardized)",
5
5
  "main": "dist/lib/bootstrap.js",
6
6
  "bin": {