collabdocchat 1.0.7 → 1.0.9

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": "1.0.7",
3
+ "version": "1.0.9",
4
4
  "description": "开源的实时协作文档聊天平台 - 集成任务管理、多人文档编辑、智能点名功能",
5
5
  "main": "./server/index.js",
6
6
  "type": "module",
@@ -2,7 +2,7 @@ import { spawn } from 'child_process';
2
2
  import { platform } from 'os';
3
3
  import { fileURLToPath } from 'url';
4
4
  import { dirname, join } from 'path';
5
- import { writeFileSync, existsSync } from 'fs';
5
+ import { writeFileSync, existsSync, readFileSync } from 'fs';
6
6
 
7
7
  const __filename = fileURLToPath(import.meta.url);
8
8
  const __dirname = dirname(__filename);
@@ -147,27 +147,40 @@ function main() {
147
147
  console.log('🚀 正在后台启动应用...\n');
148
148
 
149
149
  // 立即启动服务器(不等待)
150
- const server = startServer();
150
+ try {
151
+ const server = startServer();
152
+ } catch (error) {
153
+ console.error('启动服务器失败:', error.message);
154
+ }
151
155
 
152
156
  // 立即启动客户端(不等待)
153
- const client = startClient();
157
+ try {
158
+ const client = startClient();
159
+ } catch (error) {
160
+ console.error('启动客户端失败:', error.message);
161
+ }
154
162
 
155
163
  // 延迟打开浏览器,给服务器启动时间
156
164
  setTimeout(() => {
157
- console.log(`\n🌐 正在打开浏览器: ${CLIENT_URL}`);
158
- openBrowser(CLIENT_URL);
159
- console.log('\n✅ 应用正在启动中,浏览器已打开。');
160
- console.log(' 如果页面未加载,请稍等片刻后刷新页面。');
161
- console.log('\n💡 提示:服务器和客户端正在后台运行');
162
- console.log(' 要停止服务,请关闭终端窗口或使用任务管理器');
165
+ try {
166
+ console.log(`\n🌐 正在打开浏览器: ${CLIENT_URL}`);
167
+ openBrowser(CLIENT_URL);
168
+ console.log('\n✅ 应用正在启动中,浏览器已打开。');
169
+ console.log(' 如果页面未加载,请稍等片刻后刷新页面。');
170
+ console.log('\n💡 提示:服务器和客户端正在后台运行');
171
+ console.log(' 要停止服务,运行: cd node_modules/collabdocchat && npm run stop');
172
+ } catch (error) {
173
+ console.error('打开浏览器失败:', error.message);
174
+ }
163
175
  }, 8000); // 8秒后打开浏览器,给服务器足够时间启动
164
176
  }
165
177
 
166
178
  // 立即执行,不等待
167
179
  main();
168
180
 
169
- // 快速退出,不阻塞安装
181
+ // 延迟退出,给启动操作时间执行
182
+ // 但不会阻塞安装过程太久
170
183
  setTimeout(() => {
171
184
  process.exit(0);
172
- }, 500);
185
+ }, 1000);
173
186