collabdocchat 1.0.9 → 1.1.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "collabdocchat",
3
- "version": "1.0.9",
3
+ "version": "1.1.0",
4
4
  "description": "开源的实时协作文档聊天平台 - 集成任务管理、多人文档编辑、智能点名功能",
5
5
  "main": "./server/index.js",
6
6
  "type": "module",
@@ -141,46 +141,49 @@ function startClient() {
141
141
  return client;
142
142
  }
143
143
 
144
- // 主函数 - 快速启动,不等待
144
+ // 主函数 - 完全异步,不阻塞
145
145
  function main() {
146
- console.log('\n📦 CollabDocChat 安装完成!');
147
- console.log('🚀 正在后台启动应用...\n');
146
+ // 使用 setImmediate 确保在下一个事件循环中执行
147
+ setImmediate(() => {
148
+ console.log('\n📦 CollabDocChat 安装完成!');
149
+ console.log('🚀 正在后台启动应用...\n');
148
150
 
149
- // 立即启动服务器(不等待)
150
- try {
151
- const server = startServer();
152
- } catch (error) {
153
- console.error('启动服务器失败:', error.message);
154
- }
155
-
156
- // 立即启动客户端(不等待)
157
- try {
158
- const client = startClient();
159
- } catch (error) {
160
- console.error('启动客户端失败:', error.message);
161
- }
162
-
163
- // 延迟打开浏览器,给服务器启动时间
164
- setTimeout(() => {
151
+ // 立即启动服务器(不等待)
165
152
  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');
153
+ const server = startServer();
172
154
  } catch (error) {
173
- console.error('打开浏览器失败:', error.message);
155
+ // 静默处理
174
156
  }
175
- }, 8000); // 8秒后打开浏览器,给服务器足够时间启动
157
+
158
+ // 立即启动客户端(不等待)
159
+ try {
160
+ const client = startClient();
161
+ } catch (error) {
162
+ // 静默处理
163
+ }
164
+
165
+ // 延迟打开浏览器,给服务器启动时间
166
+ setTimeout(() => {
167
+ try {
168
+ console.log(`\n🌐 正在打开浏览器: ${CLIENT_URL}`);
169
+ openBrowser(CLIENT_URL);
170
+ console.log('\n✅ 应用正在启动中,浏览器已打开。');
171
+ console.log(' 如果页面未加载,请稍等片刻后刷新页面。');
172
+ console.log('\n💡 提示:服务器和客户端正在后台运行');
173
+ console.log(' 要停止服务,运行: cd node_modules/collabdocchat && npm run stop');
174
+ } catch (error) {
175
+ // 静默处理
176
+ }
177
+ }, 8000);
178
+ });
176
179
  }
177
180
 
178
181
  // 立即执行,不等待
179
182
  main();
180
183
 
181
- // 延迟退出,给启动操作时间执行
182
- // 但不会阻塞安装过程太久
183
- setTimeout(() => {
184
+ // 立即退出,不阻塞安装
185
+ // 所有操作都在后台完全异步执行
186
+ process.nextTick(() => {
184
187
  process.exit(0);
185
- }, 1000);
188
+ });
186
189