collabdocchat 2.4.6 → 2.4.8
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/cli.js +1 -1
- package/package.json +1 -1
- package/scripts/start-app.js +48 -33
package/bin/cli.js
CHANGED
package/package.json
CHANGED
package/scripts/start-app.js
CHANGED
|
@@ -33,7 +33,7 @@ function installDevDependencies() {
|
|
|
33
33
|
const install = spawn(npmCmd, ['install'], {
|
|
34
34
|
cwd: rootDir,
|
|
35
35
|
stdio: 'inherit',
|
|
36
|
-
shell:
|
|
36
|
+
shell: isWindows // Windows 需要 shell
|
|
37
37
|
});
|
|
38
38
|
|
|
39
39
|
install.on('close', (code) => {
|
|
@@ -187,16 +187,16 @@ async function main() {
|
|
|
187
187
|
process.exit(1);
|
|
188
188
|
}
|
|
189
189
|
|
|
190
|
-
//
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
190
|
+
// 检查是否有开发依赖(全局安装时可能没有)
|
|
191
|
+
const hasDevDeps = checkDevDependencies();
|
|
192
|
+
|
|
193
|
+
if (!hasDevDeps) {
|
|
194
|
+
console.log('⚠️ 检测到全局安装模式(无开发依赖)');
|
|
195
|
+
console.log('💡 将只启动服务器,不启动客户端\n');
|
|
196
|
+
console.log('📝 如需完整开发环境,请:');
|
|
197
|
+
console.log(' 1. 克隆项目到本地目录');
|
|
198
|
+
console.log(' 2. 运行 npm install');
|
|
199
|
+
console.log(' 3. 运行 npm run dev\n');
|
|
200
200
|
}
|
|
201
201
|
|
|
202
202
|
// 启动服务器
|
|
@@ -211,38 +211,53 @@ async function main() {
|
|
|
211
211
|
process.exit(1);
|
|
212
212
|
}
|
|
213
213
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
214
|
+
let client = null;
|
|
215
|
+
|
|
216
|
+
// 只有在有开发依赖时才启动客户端
|
|
217
|
+
if (hasDevDeps) {
|
|
218
|
+
// 启动客户端
|
|
219
|
+
client = startClient();
|
|
220
|
+
|
|
221
|
+
// 等待客户端就绪后打开浏览器
|
|
222
|
+
setTimeout(async () => {
|
|
223
|
+
try {
|
|
224
|
+
await waitForServer(CLIENT_URL, 20, 500);
|
|
225
|
+
console.log(`\n🌐 正在打开浏览器: ${CLIENT_URL}`);
|
|
226
|
+
openBrowser(CLIENT_URL);
|
|
227
|
+
console.log('\n✅ 应用启动成功!');
|
|
228
|
+
console.log('\n💡 提示:');
|
|
229
|
+
console.log(` • 服务器: http://localhost:${PORT}`);
|
|
230
|
+
console.log(' • 客户端: http://localhost:5173');
|
|
231
|
+
console.log(' • 默认账号: admin / admin123');
|
|
232
|
+
console.log('\n⚠️ 按 Ctrl+C 停止服务\n');
|
|
233
|
+
} catch (error) {
|
|
234
|
+
console.log(`\n⚠️ 客户端可能还在启动中,请手动访问: ${CLIENT_URL}`);
|
|
235
|
+
openBrowser(CLIENT_URL);
|
|
236
|
+
}
|
|
237
|
+
}, 3000);
|
|
238
|
+
} else {
|
|
239
|
+
// 全局安装模式,只有服务器
|
|
240
|
+
console.log('\n✅ 服务器启动成功!');
|
|
241
|
+
console.log('\n💡 提示:');
|
|
242
|
+
console.log(` • API 服务器: http://localhost:${PORT}`);
|
|
243
|
+
console.log(' • 默认账号: admin / admin123');
|
|
244
|
+
console.log('\n📝 注意:');
|
|
245
|
+
console.log(' 全局安装模式仅提供 API 服务器');
|
|
246
|
+
console.log(' 如需完整的前端界面,请在本地项目中运行');
|
|
247
|
+
console.log('\n⚠️ 按 Ctrl+C 停止服务\n');
|
|
248
|
+
}
|
|
234
249
|
|
|
235
250
|
// 处理退出信号
|
|
236
251
|
process.on('SIGINT', () => {
|
|
237
252
|
console.log('\n\n🛑 正在关闭服务器...');
|
|
238
253
|
server.kill();
|
|
239
|
-
client.kill();
|
|
254
|
+
if (client) client.kill();
|
|
240
255
|
process.exit(0);
|
|
241
256
|
});
|
|
242
257
|
|
|
243
258
|
process.on('SIGTERM', () => {
|
|
244
259
|
server.kill();
|
|
245
|
-
client.kill();
|
|
260
|
+
if (client) client.kill();
|
|
246
261
|
process.exit(0);
|
|
247
262
|
});
|
|
248
263
|
}
|