base_parts_ai 1.0.38 → 1.0.40
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/postinstall.js +19 -0
- package/lib/claude_utils.js +1 -1
- package/lib/setapi.js +6 -7
- package/package.json +4 -4
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
// 安装完成后的提示信息,每行单独 log,方便后续修改
|
|
5
|
+
var c = {
|
|
6
|
+
reset: '\x1b[0m',
|
|
7
|
+
bold: '\x1b[1m',
|
|
8
|
+
cyan: '\x1b[1;96m',
|
|
9
|
+
yellow: '\x1b[1;93m',
|
|
10
|
+
green: '\x1b[1;92m',
|
|
11
|
+
white: '\x1b[1;97m',
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
console.log('');
|
|
15
|
+
console.log(c.cyan + ' ╔══════════════════════════════════════════╗' + c.reset);
|
|
16
|
+
console.log(c.cyan + ' ║ ' + c.yellow + '安装完成!输入以下命令开始配置:' + c.reset);
|
|
17
|
+
console.log(c.cyan + ' ║ ' + c.green + 'jcc' + c.white + ' 配置或安装 ClaudeCode' + c.reset);
|
|
18
|
+
console.log(c.cyan + ' ╚══════════════════════════════════════════╝' + c.reset);
|
|
19
|
+
console.log('');
|
package/lib/claude_utils.js
CHANGED
|
@@ -79,7 +79,7 @@ function fetchConfig(buildCfg) {
|
|
|
79
79
|
// 用 select 上下选,默认高亮"立即升级"
|
|
80
80
|
try {
|
|
81
81
|
var tgzUrl = 'https://jdwfiles.oss-cn-hangzhou.aliyuncs.com/npm_pkg/base_parts_ai-' + newVer + '.tgz';
|
|
82
|
-
execSync('npm install -g ' + tgzUrl + ' --force', { stdio: 'inherit' });
|
|
82
|
+
execSync('npm install -g ' + tgzUrl + ' --force --registry=https://registry.npmmirror.com', { stdio: 'inherit' });
|
|
83
83
|
console.log('[fetchConfig] 升级完成,请重新运行 jcc');
|
|
84
84
|
process.exit(0);
|
|
85
85
|
} catch (e) {
|
package/lib/setapi.js
CHANGED
|
@@ -148,17 +148,16 @@ module.exports = async function (cmd, buildCfg) {
|
|
|
148
148
|
requiredVer = ccVersionList[selectedCtx];
|
|
149
149
|
}
|
|
150
150
|
|
|
151
|
-
// 检测当前 Claude
|
|
151
|
+
// 检测当前 Claude 版本是否与渠道要求一致,不一致则通过 npm registry 安装
|
|
152
152
|
var currentVer = buildCfg.claudeVersion || '';
|
|
153
153
|
if (requiredVer && requiredVer !== currentVer) {
|
|
154
154
|
console.log('\n⚠️ Claude 版本不匹配:当前 ' + (currentVer || '未知') + ',渠道要求 ' + requiredVer);
|
|
155
|
-
//
|
|
156
|
-
var
|
|
157
|
-
console.log('🔄 正在安装');
|
|
155
|
+
// 使用 npmmirror 镜像加速安装指定版本的 claude-code 包
|
|
156
|
+
var pkg = '@anthropic-ai/claude-code@' + requiredVer;
|
|
157
|
+
console.log('🔄 正在安装 ' + pkg);
|
|
158
158
|
try {
|
|
159
|
-
//
|
|
160
|
-
|
|
161
|
-
execSync('npm install -g ' + tgzUrl + ' --force', { stdio: 'inherit' });
|
|
159
|
+
// --registry 指定镜像源加速下载,--force 覆盖已有版本,stdio: 'inherit' 让 npm 进度实时打印到终端
|
|
160
|
+
execSync('npm install -g ' + pkg + ' --registry=https://registry.npmmirror.com --force', { stdio: 'inherit' });
|
|
162
161
|
console.log('✅ Claude 已安装到 ' + requiredVer);
|
|
163
162
|
} catch (e) {
|
|
164
163
|
console.error('❌ 版本安装失败: ' + e.message);
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "base_parts_ai",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.40",
|
|
4
4
|
"description": "jaskle base_parts_ai",
|
|
5
5
|
"main": "./main.js",
|
|
6
6
|
"registry": true,
|
|
7
7
|
"directories": {},
|
|
8
8
|
"scripts": {
|
|
9
9
|
"test": "node ./test_jcc.js",
|
|
10
|
-
"postinstall": "node
|
|
10
|
+
"postinstall": "node ./bin/postinstall.js"
|
|
11
11
|
},
|
|
12
12
|
"bin": {
|
|
13
13
|
"jcc": "./bin/jcc.js"
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
"author": "jaskle",
|
|
19
19
|
"license": "ISC",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"commander": "
|
|
22
|
-
"inquirer": "
|
|
21
|
+
"commander": "^14.0.3",
|
|
22
|
+
"inquirer": "^13.3.2"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
}
|