collabdocchat 2.4.2 → 2.4.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "collabdocchat",
3
- "version": "2.4.2",
3
+ "version": "2.4.3",
4
4
  "description": "开源的实时协作文档聊天平台 - 集成任务管理、多人文档编辑、智能点名功能",
5
5
  "main": "./server/index.js",
6
6
  "type": "module",
@@ -91,4 +91,4 @@
91
91
  "open": "^11.0.0",
92
92
  "vite": "^5.0.8"
93
93
  }
94
- }
94
+ }
@@ -0,0 +1,63 @@
1
+ import fs from 'fs';
2
+ import path from 'path';
3
+ import { fileURLToPath } from 'url';
4
+ import { execSync } from 'child_process';
5
+
6
+ const __filename = fileURLToPath(import.meta.url);
7
+ const __dirname = path.dirname(__filename);
8
+ const rootDir = path.join(__dirname, '..');
9
+
10
+ console.log('🚀 开始自动发布流程...\n');
11
+
12
+ // 1. 读取当前版本
13
+ const packagePath = path.join(rootDir, 'package.json');
14
+ const packageJson = JSON.parse(fs.readFileSync(packagePath, 'utf8'));
15
+ const currentVersion = packageJson.version;
16
+ const versionParts = currentVersion.split('.');
17
+ const newPatch = parseInt(versionParts[2]) + 1;
18
+ const newVersion = `${versionParts[0]}.${versionParts[1]}.${newPatch}`;
19
+
20
+ console.log(`📦 当前版本: ${currentVersion}`);
21
+ console.log(`📦 新版本: ${newVersion}\n`);
22
+
23
+ // 2. 更新版本号
24
+ packageJson.version = newVersion;
25
+ fs.writeFileSync(packagePath, JSON.stringify(packageJson, null, 2), 'utf8');
26
+ console.log('✅ 版本号已更新\n');
27
+
28
+ // 3. 更新 CHANGELOG
29
+ const changelogPath = path.join(rootDir, 'CHANGELOG.md');
30
+ let changelog = fs.readFileSync(changelogPath, 'utf8');
31
+ const today = new Date().toISOString().split('T')[0];
32
+ const newEntry = `# 更新日志
33
+
34
+ 所有重要的项目更改都将记录在此文件中。
35
+
36
+ ## [${newVersion}] - ${today}
37
+
38
+ ### 🐛 Bug 修复
39
+ - 修复 auth.js 端口配置问题
40
+ - 确保所有 API 调用使用正确的端口 8765
41
+
42
+ `;
43
+
44
+ changelog = newEntry + changelog.substring(changelog.indexOf('\n## ['));
45
+ fs.writeFileSync(changelogPath, changelog, 'utf8');
46
+ console.log('✅ CHANGELOG 已更新\n');
47
+
48
+ // 4. 发布到 npm
49
+ console.log('📤 正在发布到 npm...\n');
50
+ try {
51
+ execSync('npm publish --access public', {
52
+ cwd: rootDir,
53
+ stdio: 'inherit'
54
+ });
55
+ console.log('\n✅ 发布成功!\n');
56
+ console.log(`🎉 版本 ${newVersion} 已发布到 npm\n`);
57
+ console.log('📝 安装命令:');
58
+ console.log(` npm install -g collabdocchat@${newVersion} --registry=https://registry.npmmirror.com\n`);
59
+ } catch (error) {
60
+ console.error('\n❌ 发布失败:', error.message);
61
+ process.exit(1);
62
+ }
63
+
@@ -1,4 +1,4 @@
1
- const API_URL = 'http://localhost:3000/api';
1
+ const API_URL = 'http://localhost:8765/api';
2
2
 
3
3
  export class AuthService {
4
4
  async login(username, password) {