@2api-store/activate 0.3.0 → 0.3.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/activate.mjs +3 -0
- package/lib/detect.mjs +2 -2
- package/lib/install.mjs +2 -2
- package/lib/ui.mjs +1 -1
- package/package.json +1 -1
package/activate.mjs
CHANGED
package/lib/detect.mjs
CHANGED
|
@@ -62,11 +62,11 @@ function findBinary(name, isWindows) {
|
|
|
62
62
|
function getVersion(bin, isWindows) {
|
|
63
63
|
// --version 是通用约定;codex/claude/gemini/opencode/grok 都支持
|
|
64
64
|
try {
|
|
65
|
-
const result = spawnSync(bin, ['--version'], {
|
|
65
|
+
const result = spawnSync(isWindows ? `${bin}.cmd` : bin, ['--version'], {
|
|
66
66
|
encoding: 'utf8',
|
|
67
67
|
stdio: ['ignore', 'pipe', 'pipe'],
|
|
68
68
|
timeout: 5000,
|
|
69
|
-
shell:
|
|
69
|
+
// 不用 shell:true(node 22+ DEP0190);Windows 用 <bin>.cmd 直调
|
|
70
70
|
})
|
|
71
71
|
if (result.status === 0 && result.stdout) {
|
|
72
72
|
const firstLine = result.stdout.trim().split(/\r?\n/)[0]
|
package/lib/install.mjs
CHANGED
|
@@ -38,9 +38,9 @@ export function installCLI(meta, opts = {}) {
|
|
|
38
38
|
|
|
39
39
|
console.log(` 正在执行:${cmd}…`)
|
|
40
40
|
try {
|
|
41
|
-
const result = spawnSync('npm', ['install', '-g', pkg], {
|
|
41
|
+
const result = spawnSync(process.platform === 'win32' ? 'npm.cmd' : 'npm', ['install', '-g', pkg], {
|
|
42
42
|
stdio: 'inherit', // npm 进度/输出直接透传到当前终端
|
|
43
|
-
shell:
|
|
43
|
+
// 不用 shell:true(node 22+ DEP0190 警告 + 安全风险);Windows 用 npm.cmd 直调
|
|
44
44
|
})
|
|
45
45
|
if (result.status === 0) {
|
|
46
46
|
return { ok: true }
|
package/lib/ui.mjs
CHANGED