@kungfu-tech/buildchain 2.2.0-alpha.0 → 2.2.0-alpha.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.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kungfu-tech/buildchain",
|
|
3
|
-
"version": "2.2.0-alpha.
|
|
3
|
+
"version": "2.2.0-alpha.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Kungfu Buildchain reusable workflows, release governance, and CLI tooling.",
|
|
6
6
|
"repository": "https://github.com/kungfu-systems/buildchain",
|
|
@@ -42,13 +42,31 @@ function timed(logger, eventName, details, callback) {
|
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
+
const WINDOWS_CMD_SHIMS = new Set(["corepack", "npm", "npx", "pnpm", "yarn"]);
|
|
46
|
+
|
|
47
|
+
export function resolveSpawnCommand(command, platform = process.platform) {
|
|
48
|
+
if (platform !== "win32") {
|
|
49
|
+
return command;
|
|
50
|
+
}
|
|
51
|
+
if (!WINDOWS_CMD_SHIMS.has(command)) {
|
|
52
|
+
return command;
|
|
53
|
+
}
|
|
54
|
+
return `${command}.cmd`;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export function usesShellForSpawnCommand(command, platform = process.platform) {
|
|
58
|
+
return platform === "win32" && WINDOWS_CMD_SHIMS.has(command);
|
|
59
|
+
}
|
|
60
|
+
|
|
45
61
|
function run(command, args, options = {}) {
|
|
46
62
|
const { logger, event = "process.run", phase = "process", attributes = {}, ...spawnOptions } = options;
|
|
63
|
+
const resolvedCommand = resolveSpawnCommand(command);
|
|
64
|
+
const shell = spawnOptions.shell ?? usesShellForSpawnCommand(command);
|
|
47
65
|
const runCommand = () => {
|
|
48
|
-
const result = spawnSync(
|
|
66
|
+
const result = spawnSync(resolvedCommand, args, {
|
|
49
67
|
stdio: "inherit",
|
|
50
|
-
shell: false,
|
|
51
68
|
...spawnOptions,
|
|
69
|
+
shell,
|
|
52
70
|
});
|
|
53
71
|
if (result.error) {
|
|
54
72
|
throw result.error;
|
|
@@ -62,6 +80,7 @@ function run(command, args, options = {}) {
|
|
|
62
80
|
phase,
|
|
63
81
|
attributes: {
|
|
64
82
|
command,
|
|
83
|
+
resolvedCommand,
|
|
65
84
|
args: args.join(" "),
|
|
66
85
|
...attributes,
|
|
67
86
|
},
|