@dbx-tools/projen 0.6.158 → 0.6.160

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/package.json CHANGED
@@ -26,9 +26,9 @@
26
26
  },
27
27
  "dependencies": {
28
28
  "@clack/prompts": "^1.7.0",
29
- "@dbx-tools/core": "0.6.158",
30
- "@dbx-tools/path": "0.6.158",
31
- "@dbx-tools/shared-core": "0.6.158",
29
+ "@dbx-tools/core": "0.6.160",
30
+ "@dbx-tools/path": "0.6.160",
31
+ "@dbx-tools/shared-core": "0.6.160",
32
32
  "commander": "^15.0.0",
33
33
  "concurrently": "^10.0.3",
34
34
  "constructs": "^10.6.0",
@@ -48,7 +48,7 @@
48
48
  },
49
49
  "main": "index.ts",
50
50
  "license": "Apache-2.0",
51
- "version": "0.6.158",
51
+ "version": "0.6.160",
52
52
  "types": "index.ts",
53
53
  "type": "module",
54
54
  "exports": {
@@ -47,9 +47,21 @@ const required = (name) => {
47
47
  };
48
48
 
49
49
  const root = resolve(parsed.values.root ?? process.cwd());
50
+ const commandInvocation = (command, args) => {
51
+ if (process.platform !== "win32" || command !== "npm") return { command, args };
52
+ const npmCli = resolve(dirname(process.execPath), "node_modules", "npm", "bin", "npm-cli.js");
53
+ if (!existsSync(npmCli)) throw new Error(`Missing npm CLI ${npmCli}`);
54
+ return { command: process.execPath, args: [npmCli, ...args] };
55
+ };
50
56
  const run = (command, args, cwd = root) => {
51
- const result = spawnSync(command, args, { cwd, stdio: "inherit" });
52
- if (result.status !== 0) throw new Error(`${command} exited with ${result.status}`);
57
+ const invocation = commandInvocation(command, args);
58
+ const result = spawnSync(invocation.command, invocation.args, { cwd, stdio: "inherit" });
59
+ if (result.error) {
60
+ throw new Error(`${invocation.command} failed: ${result.error.message}`, {
61
+ cause: result.error,
62
+ });
63
+ }
64
+ if (result.status !== 0) throw new Error(`${invocation.command} exited with ${result.status}`);
53
65
  };
54
66
 
55
67
  const replaceVersion = (source, version) =>