collabdocchat 1.2.0 → 1.2.2

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/QUICK_START.md ADDED
@@ -0,0 +1,147 @@
1
+ # CollabDocChat 快速启动指南 🚀
2
+
3
+ ## 方法一:使用一键启动脚本(推荐)
4
+
5
+ ### Windows 用户
6
+
7
+ 1. 下载启动脚本:
8
+ ```bash
9
+ curl -O https://raw.githubusercontent.com/shijinghao/collabdocchat/main/install-and-start.bat
10
+ ```
11
+
12
+ 2. 双击运行 `install-and-start.bat`
13
+
14
+ 或者在命令行中运行:
15
+ ```bash
16
+ install-and-start.bat
17
+ ```
18
+
19
+ ### Linux/Mac 用户
20
+
21
+ 1. 下载启动脚本:
22
+ ```bash
23
+ curl -O https://raw.githubusercontent.com/shijinghao/collabdocchat/main/install-and-start.sh
24
+ chmod +x install-and-start.sh
25
+ ```
26
+
27
+ 2. 运行脚本:
28
+ ```bash
29
+ ./install-and-start.sh
30
+ ```
31
+
32
+ ---
33
+
34
+ ## 方法二:手动安装并启动
35
+
36
+ ### 1. 安装(跳过 postinstall 脚本)
37
+
38
+ ```bash
39
+ npm install collabdocchat --ignore-scripts
40
+ ```
41
+
42
+ ### 2. 启动
43
+
44
+ ```bash
45
+ cd node_modules/collabdocchat
46
+ node scripts/quick-start.js
47
+ ```
48
+
49
+ 或者手动分别启动:
50
+
51
+ **启动后端:**
52
+ ```bash
53
+ cd node_modules/collabdocchat
54
+ node server/index.js
55
+ ```
56
+
57
+ **启动前端(新终端):**
58
+ ```bash
59
+ cd node_modules/collabdocchat
60
+ npm run client
61
+ ```
62
+
63
+ **打开浏览器:**
64
+ 访问 `http://localhost:5173`
65
+
66
+ ---
67
+
68
+ ## 方法三:一行命令
69
+
70
+ ### Windows (PowerShell)
71
+
72
+ ```powershell
73
+ npm install collabdocchat --ignore-scripts; cd node_modules\collabdocchat; Start-Process node -ArgumentList "server/index.js" -WindowStyle Hidden; Start-Sleep -Seconds 3; Start-Process npm -ArgumentList "run","client" -WindowStyle Hidden; Start-Sleep -Seconds 8; Start-Process "http://localhost:5173"
74
+ ```
75
+
76
+ ### Linux/Mac
77
+
78
+ ```bash
79
+ npm install collabdocchat --ignore-scripts && cd node_modules/collabdocchat && node server/index.js & sleep 3 && npm run client & sleep 8 && open http://localhost:5173
80
+ ```
81
+
82
+ ---
83
+
84
+ ## 停止服务
85
+
86
+ ### Windows
87
+
88
+ ```bash
89
+ taskkill /F /IM node.exe
90
+ ```
91
+
92
+ ### Linux/Mac
93
+
94
+ ```bash
95
+ pkill -f node
96
+ ```
97
+
98
+ 或者:
99
+
100
+ ```bash
101
+ cd node_modules/collabdocchat
102
+ npm run stop
103
+ ```
104
+
105
+ ---
106
+
107
+ ## 注意事项
108
+
109
+ - 确保 MongoDB 已启动
110
+ - 确保端口 3000 和 5173 未被占用
111
+ - 首次运行需要配置 `.env` 文件(可选)
112
+
113
+ ---
114
+
115
+ ## 常见问题
116
+
117
+ ### Q: 安装卡住了怎么办?
118
+
119
+ A: 使用 `--ignore-scripts` 选项:
120
+ ```bash
121
+ npm install collabdocchat --ignore-scripts
122
+ ```
123
+
124
+ ### Q: 浏览器没有自动打开?
125
+
126
+ A: 手动访问 `http://localhost:5173`
127
+
128
+ ### Q: 如何查看是否启动成功?
129
+
130
+ A: 检查端口占用:
131
+ ```bash
132
+ # Windows
133
+ netstat -ano | findstr :3000
134
+ netstat -ano | findstr :5173
135
+
136
+ # Linux/Mac
137
+ lsof -i:3000
138
+ lsof -i:5173
139
+ ```
140
+
141
+ ---
142
+
143
+ **提示**: 推荐使用一键启动脚本,最简单快捷!
144
+
145
+
146
+
147
+
package/bin/cli.js ADDED
@@ -0,0 +1,82 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { spawn } from 'child_process';
4
+ import { platform } from 'os';
5
+ import { fileURLToPath } from 'url';
6
+ import { dirname, join } from 'path';
7
+ import { existsSync } from 'fs';
8
+
9
+ const __filename = fileURLToPath(import.meta.url);
10
+ const __dirname = dirname(__filename);
11
+ const rootDir = join(__dirname, '..');
12
+ const CLIENT_URL = 'http://localhost:5173';
13
+ const isWindows = platform() === 'win32';
14
+
15
+ // 打开浏览器
16
+ function openBrowser(url) {
17
+ const command = isWindows ? 'cmd' : (platform() === 'darwin' ? 'open' : 'xdg-open');
18
+ const args = isWindows ? ['/c', 'start', url] : [url];
19
+ const browser = spawn(command, args, { stdio: 'ignore', detached: true });
20
+ browser.unref();
21
+ }
22
+
23
+ // 检查是否在正确的目录
24
+ function checkEnvironment() {
25
+ const serverPath = join(rootDir, 'server', 'index.js');
26
+ if (!existsSync(serverPath)) {
27
+ console.error('❌ 错误:找不到服务器文件');
28
+ console.error(' 请确保在正确的目录运行此命令');
29
+ process.exit(1);
30
+ }
31
+ }
32
+
33
+ console.log('\n🎉 欢迎使用 CollabDocChat!\n');
34
+ console.log('📦 开源的实时协作文档聊天平台\n');
35
+ console.log('🚀 正在启动服务器和客户端...\n');
36
+
37
+ checkEnvironment();
38
+
39
+ // 启动服务器
40
+ const server = spawn('node', ['server/index.js'], {
41
+ cwd: rootDir,
42
+ stdio: 'inherit',
43
+ detached: true,
44
+ windowsHide: true
45
+ });
46
+ server.unref();
47
+
48
+ // 启动客户端
49
+ const client = spawn(isWindows ? 'npm.cmd' : 'npm', ['run', 'client'], {
50
+ cwd: rootDir,
51
+ stdio: 'inherit',
52
+ detached: true,
53
+ windowsHide: true
54
+ });
55
+ client.unref();
56
+
57
+ // 8秒后打开浏览器
58
+ setTimeout(() => {
59
+ console.log(`\n🌐 正在打开浏览器: ${CLIENT_URL}`);
60
+ openBrowser(CLIENT_URL);
61
+ console.log('\n✅ 应用已启动成功!');
62
+ console.log(' 如果页面未加载,请稍等片刻后刷新页面。');
63
+ console.log('\n💡 提示:');
64
+ console.log(' • 服务器运行在: http://localhost:3000');
65
+ console.log(' • 客户端运行在: http://localhost:5173');
66
+ console.log(' • 默认管理员账号: admin / admin123');
67
+ console.log('\n📖 更多信息请访问: https://github.com/shijinghao/collabdocchat');
68
+ console.log('\n⚠️ 要停止服务,请运行: npm run stop');
69
+ console.log(' 或者关闭终端窗口\n');
70
+ }, 8000);
71
+
72
+ // 处理退出信号
73
+ process.on('SIGINT', () => {
74
+ console.log('\n\n👋 正在关闭应用...');
75
+ process.exit(0);
76
+ });
77
+
78
+ process.on('SIGTERM', () => {
79
+ console.log('\n\n👋 正在关闭应用...');
80
+ process.exit(0);
81
+ });
82
+
package/index.html CHANGED
@@ -1,14 +1,16 @@
1
- <!DOCTYPE html>
2
- <html lang="zh-CN">
3
- <head>
4
- <meta charset="UTF-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>CollabDocChat - 协作文档聊天平台</title>
7
- <link rel="stylesheet" href="/src/styles/main.css">
8
- </head>
9
- <body>
10
- <div id="app"></div>
11
- <script type="module" src="/src/main.js"></script>
12
- </body>
13
- </html>
14
-
1
+ <!DOCTYPE html>
2
+ <html lang="zh-CN">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>CollabDocChat - 协作文档聊天平台</title>
7
+ <link href="https://cdn.quilljs.com/1.3.6/quill.snow.css" rel="stylesheet">
8
+ <script src="https://cdn.quilljs.com/1.3.6/quill.js"></script>
9
+ <link rel="stylesheet" href="/src/styles/main.css">
10
+ </head>
11
+ <body>
12
+ <div id="app"></div>
13
+ <script type="module" src="/src/main.js"></script>
14
+ </body>
15
+ </html>
16
+
@@ -45,3 +45,6 @@ echo - 要停止服务,请关闭所有 node 进程
45
45
  echo.
46
46
  pause
47
47
 
48
+
49
+
50
+
@@ -1,49 +1,52 @@
1
- #!/bin/bash
2
-
3
- echo "========================================"
4
- echo " CollabDocChat 一键安装并启动"
5
- echo "========================================"
6
- echo ""
7
-
8
- echo "[1/3] 正在安装 CollabDocChat..."
9
- npm install collabdocchat@latest --ignore-scripts
10
- if [ $? -ne 0 ]; then
11
- echo "安装失败!"
12
- exit 1
13
- fi
14
-
15
- echo ""
16
- echo "[2/3] 安装完成!正在启动应用..."
17
- cd node_modules/collabdocchat
18
-
19
- echo ""
20
- echo "[3/3] 启动服务器和客户端..."
21
- node server/index.js &
22
- sleep 3
23
- npm run client &
24
-
25
- echo ""
26
- echo "等待服务器启动..."
27
- sleep 8
28
-
29
- echo ""
30
- echo "正在打开浏览器..."
31
- if [[ "$OSTYPE" == "darwin"* ]]; then
32
- open http://localhost:5173
33
- elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
34
- xdg-open http://localhost:5173
35
- fi
36
-
37
- echo ""
38
- echo "========================================"
39
- echo " 启动完成!"
40
- echo "========================================"
41
- echo ""
42
- echo "浏览器已打开,访问: http://localhost:5173"
43
- echo ""
44
- echo "提示:"
45
- echo " - 服务器运行在端口 3000"
46
- echo " - 客户端运行在端口 5173"
47
- echo " - 按 Ctrl+C 停止服务"
48
- echo ""
49
-
1
+ #!/bin/bash
2
+
3
+ echo "========================================"
4
+ echo " CollabDocChat 一键安装并启动"
5
+ echo "========================================"
6
+ echo ""
7
+
8
+ echo "[1/3] 正在安装 CollabDocChat..."
9
+ npm install collabdocchat@latest --ignore-scripts
10
+ if [ $? -ne 0 ]; then
11
+ echo "安装失败!"
12
+ exit 1
13
+ fi
14
+
15
+ echo ""
16
+ echo "[2/3] 安装完成!正在启动应用..."
17
+ cd node_modules/collabdocchat
18
+
19
+ echo ""
20
+ echo "[3/3] 启动服务器和客户端..."
21
+ node server/index.js &
22
+ sleep 3
23
+ npm run client &
24
+
25
+ echo ""
26
+ echo "等待服务器启动..."
27
+ sleep 8
28
+
29
+ echo ""
30
+ echo "正在打开浏览器..."
31
+ if [[ "$OSTYPE" == "darwin"* ]]; then
32
+ open http://localhost:5173
33
+ elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
34
+ xdg-open http://localhost:5173
35
+ fi
36
+
37
+ echo ""
38
+ echo "========================================"
39
+ echo " 启动完成!"
40
+ echo "========================================"
41
+ echo ""
42
+ echo "浏览器已打开,访问: http://localhost:5173"
43
+ echo ""
44
+ echo "提示:"
45
+ echo " - 服务器运行在端口 3000"
46
+ echo " - 客户端运行在端口 5173"
47
+ echo " - 按 Ctrl+C 停止服务"
48
+ echo ""
49
+
50
+
51
+
52
+
package/package.json CHANGED
@@ -1,10 +1,14 @@
1
1
  {
2
2
  "name": "collabdocchat",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
4
4
  "description": "开源的实时协作文档聊天平台 - 集成任务管理、多人文档编辑、智能点名功能",
5
5
  "main": "./server/index.js",
6
6
  "type": "module",
7
+ "bin": {
8
+ "collabdocchat": "./bin/cli.js"
9
+ },
7
10
  "files": [
11
+ "bin",
8
12
  "server",
9
13
  "src",
10
14
  "scripts",
@@ -1,7 +1,7 @@
1
1
  import { ApiService } from '../services/api.js';
2
2
  import { AuthService } from '../services/auth.js';
3
- import Quill from 'quill';
4
- import 'quill/dist/quill.snow.css';
3
+ // import Quill from 'quill/dist/quill.js';
4
+ // import 'quill/dist/quill.snow.css';
5
5
  import 'emoji-picker-element';
6
6
 
7
7
  export function renderAdminDashboard(user, wsService) {