@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 CHANGED
@@ -1,4 +1,7 @@
1
1
  #!/usr/bin/env node
2
+ // 抑制 node DeprecationWarning(DEP0190 spawnSync shell 等)+ 透传子进程
3
+ process.removeAllListeners('warning')
4
+ process.env.NODE_NO_WARNINGS = '1'
2
5
  /**
3
6
  * @2api-store/activate — TokenShop CLI 一键激活(v0.3.0)
4
7
  *
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: isWindows, // Windows 可能需要 shell 解析 .cmd
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: process.platform === 'win32', // Windows 需要 shell 解析 npm.cmd
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
@@ -15,7 +15,7 @@
15
15
 
16
16
  import chalk from 'chalk'
17
17
 
18
- const PKG_VERSION = '0.3.0'
18
+ const PKG_VERSION = '0.3.1'
19
19
 
20
20
  const BANNER = String.raw`
21
21
  _ _ _ _ ____ _ ____ _ _
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@2api-store/activate",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "TokenShop CLI 一键激活:配置本地 codex/claude/gemini/grok/opencode 指向 2api.store 中转(彩色输出 + 自动安装 CLI)",
5
5
  "type": "module",
6
6
  "bin": {