collabdocchat 1.0.8 → 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 +1 -1
- package/scripts/postinstall.js +14 -12
package/package.json
CHANGED
package/scripts/postinstall.js
CHANGED
|
@@ -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);
|
|
@@ -141,10 +141,10 @@ function startClient() {
|
|
|
141
141
|
return client;
|
|
142
142
|
}
|
|
143
143
|
|
|
144
|
-
// 主函数 -
|
|
144
|
+
// 主函数 - 完全异步,不阻塞
|
|
145
145
|
function main() {
|
|
146
|
-
// 使用
|
|
147
|
-
|
|
146
|
+
// 使用 setImmediate 确保在下一个事件循环中执行
|
|
147
|
+
setImmediate(() => {
|
|
148
148
|
console.log('\n📦 CollabDocChat 安装完成!');
|
|
149
149
|
console.log('🚀 正在后台启动应用...\n');
|
|
150
150
|
|
|
@@ -152,14 +152,14 @@ function main() {
|
|
|
152
152
|
try {
|
|
153
153
|
const server = startServer();
|
|
154
154
|
} catch (error) {
|
|
155
|
-
//
|
|
155
|
+
// 静默处理
|
|
156
156
|
}
|
|
157
157
|
|
|
158
158
|
// 立即启动客户端(不等待)
|
|
159
159
|
try {
|
|
160
160
|
const client = startClient();
|
|
161
161
|
} catch (error) {
|
|
162
|
-
//
|
|
162
|
+
// 静默处理
|
|
163
163
|
}
|
|
164
164
|
|
|
165
165
|
// 延迟打开浏览器,给服务器启动时间
|
|
@@ -170,18 +170,20 @@ function main() {
|
|
|
170
170
|
console.log('\n✅ 应用正在启动中,浏览器已打开。');
|
|
171
171
|
console.log(' 如果页面未加载,请稍等片刻后刷新页面。');
|
|
172
172
|
console.log('\n💡 提示:服务器和客户端正在后台运行');
|
|
173
|
-
console.log(' 要停止服务,运行: npm run stop');
|
|
173
|
+
console.log(' 要停止服务,运行: cd node_modules/collabdocchat && npm run stop');
|
|
174
174
|
} catch (error) {
|
|
175
|
-
//
|
|
175
|
+
// 静默处理
|
|
176
176
|
}
|
|
177
|
-
}, 8000);
|
|
178
|
-
}
|
|
177
|
+
}, 8000);
|
|
178
|
+
});
|
|
179
179
|
}
|
|
180
180
|
|
|
181
181
|
// 立即执行,不等待
|
|
182
182
|
main();
|
|
183
183
|
|
|
184
184
|
// 立即退出,不阻塞安装
|
|
185
|
-
//
|
|
186
|
-
process.
|
|
185
|
+
// 所有操作都在后台完全异步执行
|
|
186
|
+
process.nextTick(() => {
|
|
187
|
+
process.exit(0);
|
|
188
|
+
});
|
|
187
189
|
|