@zhuan-ai/zhuanspec 2.13.0 → 2.15.0
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/dist/core/hooks/init.js +4 -4
- package/package.json +1 -1
package/dist/core/hooks/init.js
CHANGED
|
@@ -32,9 +32,9 @@ async function checkVersionUpdate() {
|
|
|
32
32
|
const pkgContent = JSON.parse(await fs.promises.readFile(pkgPath, 'utf-8'));
|
|
33
33
|
current = pkgContent.version;
|
|
34
34
|
}
|
|
35
|
-
//
|
|
36
|
-
//
|
|
37
|
-
const { stdout } = await execAsync('npm view @zhuan-ai/zhuanspec version', { timeout: 5000 });
|
|
35
|
+
// 强制查询 npmjs.org 公共源,避免用户本地 registry 指向私有仓库时
|
|
36
|
+
// 拿到过期版本号,永远误报"版本过旧"。
|
|
37
|
+
const { stdout } = await execAsync('npm view @zhuan-ai/zhuanspec version --registry=https://registry.npmjs.org/', { timeout: 5000 });
|
|
38
38
|
const latest = stdout.trim();
|
|
39
39
|
if (!latest || !current)
|
|
40
40
|
return null;
|
|
@@ -44,7 +44,7 @@ async function checkVersionUpdate() {
|
|
|
44
44
|
const isOutdated = lM !== cM ? lM > cM : lm !== cm ? lm > cm : lp > cp;
|
|
45
45
|
if (!isOutdated)
|
|
46
46
|
return `✓ ZhuanSpec v${current} 已是最新版本,开始 happy coding 吧~`;
|
|
47
|
-
return `⚠️ ZhuanSpec 版本过旧!\n 当前版本: v${current} → 最新版本: v${latest}\n 请执行: 1) npm i -g @zhuan-ai/zhuanspec 2) zhuanspec init(同步最新模板到本项目)`;
|
|
47
|
+
return `⚠️ ZhuanSpec 版本过旧!\n 当前版本: v${current} → 最新版本: v${latest}\n 请执行: 1) npm i -g @zhuan-ai/zhuanspec@latest 2) zhuanspec update / init(同步最新模板到本项目)`;
|
|
48
48
|
}
|
|
49
49
|
catch {
|
|
50
50
|
return null;
|