@andyqiu/codeforge 0.8.17 → 0.8.19

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/bin/codeforge.mjs CHANGED
@@ -264,7 +264,7 @@ async function cmdUpgrade(args) {
264
264
  return 0
265
265
  }
266
266
 
267
- const r = spawnSync(npmCmd, npmArgs, {
267
+ let r = spawnSync(npmCmd, npmArgs, {
268
268
  stdio: "inherit",
269
269
  env: {
270
270
  ...process.env,
@@ -272,6 +272,21 @@ async function cmdUpgrade(args) {
272
272
  npm_config_fund: "false",
273
273
  },
274
274
  })
275
+
276
+ // ETARGET:版本刚发布,CDN 节点尚未同步,fallback 到 @latest 重试一次
277
+ if (r.status !== 0 && latestVersion !== null) {
278
+ const fallbackArgs = ["install", "-g", "@andyqiu/codeforge@latest", "--no-audit", "--no-fund", "--prefer-offline"]
279
+ log(`版本 ${latestVersion} 暂未同步,尝试 @latest...`)
280
+ r = spawnSync(npmCmd, fallbackArgs, {
281
+ stdio: "inherit",
282
+ env: {
283
+ ...process.env,
284
+ npm_config_audit: "false",
285
+ npm_config_fund: "false",
286
+ },
287
+ })
288
+ }
289
+
275
290
  if (r.status !== 0) {
276
291
  err(`npm install 失败 (exit=${r.status ?? 1})`)
277
292
  err(`提示:可手动跑 npm install -g ${installTarget}`)