gpteam 0.1.11 → 0.1.12
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/lib/client-install.js +8 -3
- package/lib/help.js +1 -1
- package/package.json +1 -1
package/lib/client-install.js
CHANGED
|
@@ -52,7 +52,7 @@ export async function ensureClientInstalled(clientID, options = {}) {
|
|
|
52
52
|
throw new Error(`未安装 ${spec.label},已停止配置。安装后重新运行 npx gpteam。`);
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
await runInstallCommand(spec, options.runCommand || defaultRunCommand);
|
|
55
|
+
await runInstallCommand(spec, options.runCommand || defaultRunCommand, platform);
|
|
56
56
|
if (!await commandExists(spec.command)) {
|
|
57
57
|
throw new Error(`安装完成但仍未检测到 ${spec.label} 命令 ${spec.command}。请检查 npm 全局 bin 是否在 PATH 中,然后运行 ${spec.versionHint}。`);
|
|
58
58
|
}
|
|
@@ -76,14 +76,19 @@ async function shouldInstallMissingClient(spec, options) {
|
|
|
76
76
|
return options.confirmInstall(spec);
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
async function runInstallCommand(spec, runCommand) {
|
|
79
|
+
async function runInstallCommand(spec, runCommand, platform) {
|
|
80
80
|
const [command, args] = spec.installCommand;
|
|
81
|
-
const result = await runCommand(command, args, { stdio: 'inherit' });
|
|
81
|
+
const result = await runCommand(resolveSpawnCommand(command, platform), args, { stdio: 'inherit' });
|
|
82
82
|
if (result.status !== 0) {
|
|
83
83
|
throw new Error(`${spec.label} 安装失败,命令:${formatInstallCommand(spec)}`);
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
+
export function resolveSpawnCommand(command, platform = process.platform) {
|
|
88
|
+
if (platform === 'win32' && command === 'npm') return 'npm.cmd';
|
|
89
|
+
return command;
|
|
90
|
+
}
|
|
91
|
+
|
|
87
92
|
export function defaultRunCommand(command, args, options = {}) {
|
|
88
93
|
return new Promise((resolve) => {
|
|
89
94
|
const child = spawn(command, args, {
|
package/lib/help.js
CHANGED