@gientech/modual 1.4.7 → 1.5.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/dist/assets/GientechStreamReader-KtCNi1G3.js +447 -0
- package/dist/assets/Input-CNqIA41v.js +236 -0
- package/dist/assets/index-Bof0D4vl.js +1088 -0
- package/dist/assets/{index-BVENTW1Q.js → index-C5RhLYRh.js} +1 -1
- package/dist/assets/index-COcmK9my.js +1 -0
- package/dist/assets/index-CysDmrpo.js +1798 -0
- package/dist/assets/{index-7rZAt9P3.js → index-DP8Ki8qW.js} +1 -1
- package/dist/assets/index-pybYlMAT.js +11 -0
- package/dist/assets/{plus-CrtEUXaQ.js → plus-CzbYbK8K.js} +1 -1
- package/dist/assets/style3.css +1 -1
- package/dist/assets/worker-BbpylX7l.js +13 -0
- package/dist/assets/{x-Dr3EBTzJ.js → x-DdRafKQU.js} +1 -1
- package/dist/chat.d.ts +17 -0
- package/dist/chat.js +2539 -52
- package/dist/database.js +2 -2
- package/dist/databaseId.js +1 -11
- package/dist/databaseTable.js +2 -2
- package/dist/index.d.ts +4 -0
- package/dist/index.js +1 -14
- package/dist/modelManage.js +1 -1
- package/dist/package.json +1 -1
- package/dist/sensitive.js +1 -1
- package/dist/streamFilesReader.js +1 -1
- package/dist/worker/pdf.worker1.min.js +23 -0
- package/package.json +6 -6
- package/public/worker/pdf.worker1.min.js +23 -0
- package/scripts/README.md +133 -133
- package/scripts/build-demo.js +88 -88
- package/scripts/demo-selector.js +216 -216
- package/scripts/preview-demo.js +130 -130
- package/scripts/run-demo.bat +34 -34
- package/src/assets/img/close.png +0 -0
- package/src/assets/img/database.png +0 -0
- package/src/assets/img/downLoad.png +0 -0
- package/src/assets/img/graphIcon.png +0 -0
- package/src/assets/img/pdf.png +0 -0
- package/src/assets/img/singleQa.png +0 -0
- package/src/assets/img/webSearch.png +0 -0
- package/src/examples/chat/index.tsx +5 -29
- package/src/main.tsx.backup +5 -5
- package/src/modules/chat/ReferenceBar.tsx +522 -0
- package/src/modules/chat/constants.tsx +29 -6
- package/src/modules/chat/index.tsx +118 -4
- package/src/modules/chat/referenceCom/DeleteModal.tsx +75 -0
- package/src/modules/chat/referenceCom/DrawerContent.tsx +136 -0
- package/src/modules/chat/referenceCom/DrawerDatabase.tsx +110 -0
- package/src/modules/chat/referenceCom/DrawerGraphPreview.tsx +86 -0
- package/src/modules/chat/referenceCom/DrawerPreview.tsx +73 -0
- package/src/modules/chat/referenceCom/DrawerTitle.tsx +26 -0
- package/src/modules/chat/referenceCom/RenameModal.tsx +86 -0
- package/src/modules/chat/referenceCom/TagCom.tsx +30 -0
- package/src/modules/chat/style.css +3 -0
- package/src/modules/chat/utils/index.ts +326 -0
- package/src/utils/gientechCommon/components/Messages/GientechNewChatWelcome.tsx +231 -18
- package/src/utils/testconfigs/index.ts +1 -1
- package/stats.html +1 -1
- package/dist/assets/AppLoading-mci3gLZt.js +0 -414
- package/dist/assets/GientechStreamReader-4496nAm0.js +0 -446
- package/dist/assets/index-Bb8_WB-l.js +0 -1
- package/dist/assets/index-BpJ9Bm5x.js +0 -21
- package/dist/assets/index-CNxDI4h-.js +0 -1078
- package/dist/assets/index-CWzpBU29.js +0 -1
- package/dist/assets/index-D1m34Ij7.js +0 -1429
- package/dist/assets/index-_gBtdXQV.js +0 -585
- package/dist/assets/style4.css +0 -1
package/scripts/README.md
CHANGED
|
@@ -1,133 +1,133 @@
|
|
|
1
|
-
# XViewer 演示脚本使用说明
|
|
2
|
-
|
|
3
|
-
## 概述
|
|
4
|
-
|
|
5
|
-
这套脚本用于运行 XViewer 组件的演示示例,支持跨平台运行(Windows、macOS、Linux)。
|
|
6
|
-
|
|
7
|
-
## 脚本文件
|
|
8
|
-
|
|
9
|
-
- `demo-selector.js` - 示例选择器,扫描并选择要运行的示例
|
|
10
|
-
- `dev-demo.js` - 开发模式演示
|
|
11
|
-
- `build-demo.js` - 打包模式演示
|
|
12
|
-
- `preview-demo.js` - 预览模式演示
|
|
13
|
-
- `run-demo.bat` - Windows 批处理文件(备用方案)
|
|
14
|
-
|
|
15
|
-
## 使用方法
|
|
16
|
-
|
|
17
|
-
### 方法一:使用 npm 脚本(推荐)
|
|
18
|
-
|
|
19
|
-
```bash
|
|
20
|
-
# 开发模式
|
|
21
|
-
pnpm run dev:demo
|
|
22
|
-
|
|
23
|
-
# 打包模式
|
|
24
|
-
pnpm run build:demo
|
|
25
|
-
|
|
26
|
-
# 预览模式
|
|
27
|
-
pnpm run preview:demo
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
### 方法二:直接运行 Node.js 脚本
|
|
31
|
-
|
|
32
|
-
```bash
|
|
33
|
-
# 开发模式
|
|
34
|
-
node scripts/dev-demo.js
|
|
35
|
-
|
|
36
|
-
# 打包模式
|
|
37
|
-
node scripts/build-demo.js
|
|
38
|
-
|
|
39
|
-
# 预览模式
|
|
40
|
-
node scripts/preview-demo.js
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
### 方法三:Windows 批处理文件
|
|
44
|
-
|
|
45
|
-
```cmd
|
|
46
|
-
# 开发模式
|
|
47
|
-
scripts\run-demo.bat dev-demo
|
|
48
|
-
|
|
49
|
-
# 打包模式
|
|
50
|
-
scripts\run-demo.bat build-demo
|
|
51
|
-
|
|
52
|
-
# 预览模式
|
|
53
|
-
scripts\run-demo.bat preview-demo
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
## 示例文件格式
|
|
57
|
-
|
|
58
|
-
脚本支持两种示例文件格式:
|
|
59
|
-
|
|
60
|
-
1. **单文件模式**: `src/Example_XXXX.tsx`
|
|
61
|
-
2. **文件夹模式**:
|
|
62
|
-
- `src/examples/XXXX/index.tsx`
|
|
63
|
-
- `src/examples/XXXX/XXXX.tsx`
|
|
64
|
-
|
|
65
|
-
## Windows 兼容性
|
|
66
|
-
|
|
67
|
-
### 已解决的问题
|
|
68
|
-
|
|
69
|
-
1. ✅ **依赖包缺失** - 已添加 `inquirer` 和 `fs-extra` 依赖
|
|
70
|
-
2. ✅ **Shell 执行** - Windows 下使用 `shell: true` 选项
|
|
71
|
-
3. ✅ **环境变量** - 自动设置 `NODE_OPTIONS` 环境变量
|
|
72
|
-
4. ✅ **路径处理** - 使用 `path.join()` 确保跨平台兼容
|
|
73
|
-
5. ✅ **调试信息** - 添加详细的调试输出
|
|
74
|
-
|
|
75
|
-
### 调试信息
|
|
76
|
-
|
|
77
|
-
脚本运行时会显示以下调试信息:
|
|
78
|
-
- Node.js 版本
|
|
79
|
-
- 操作系统类型
|
|
80
|
-
- 当前工作目录
|
|
81
|
-
- 脚本目录
|
|
82
|
-
- Windows 模式标识
|
|
83
|
-
|
|
84
|
-
## 故障排除
|
|
85
|
-
|
|
86
|
-
### 问题 1:脚本执行没有反应
|
|
87
|
-
|
|
88
|
-
**解决方案**:
|
|
89
|
-
1. 确保已安装依赖:`pnpm install`
|
|
90
|
-
2. 检查 Node.js 版本:`node --version`(需要 >= 22)
|
|
91
|
-
3. 使用调试模式查看详细信息
|
|
92
|
-
|
|
93
|
-
### 问题 2:Windows 下 pnpm 命令无法识别
|
|
94
|
-
|
|
95
|
-
**解决方案**:
|
|
96
|
-
1. 确保 pnpm 已全局安装:`npm install -g pnpm`
|
|
97
|
-
2. 检查 PATH 环境变量
|
|
98
|
-
3. 使用批处理文件:`scripts\run-demo.bat`
|
|
99
|
-
|
|
100
|
-
### 问题 3:内存不足错误
|
|
101
|
-
|
|
102
|
-
**解决方案**:
|
|
103
|
-
1. 脚本已自动设置 `NODE_OPTIONS=--max-old-space-size=16384`
|
|
104
|
-
2. 如需调整,修改脚本中的环境变量设置
|
|
105
|
-
|
|
106
|
-
### 问题 4:示例文件扫描失败
|
|
107
|
-
|
|
108
|
-
**解决方案**:
|
|
109
|
-
1. 确保示例文件格式正确
|
|
110
|
-
2. 检查文件路径和权限
|
|
111
|
-
3. 查看调试信息中的路径信息
|
|
112
|
-
|
|
113
|
-
## 开发说明
|
|
114
|
-
|
|
115
|
-
### 添加新示例
|
|
116
|
-
|
|
117
|
-
1. 在 `src/examples/` 下创建新文件夹
|
|
118
|
-
2. 添加 `index.tsx` 或 `[文件夹名].tsx` 文件
|
|
119
|
-
3. 脚本会自动扫描并显示
|
|
120
|
-
|
|
121
|
-
### 修改脚本
|
|
122
|
-
|
|
123
|
-
1. 所有脚本都支持跨平台运行
|
|
124
|
-
2. 使用 `process.platform === 'win32'` 检测 Windows
|
|
125
|
-
3. 使用 `path.join()` 处理路径
|
|
126
|
-
4. 使用 `shell: isWindows` 设置 spawn 选项
|
|
127
|
-
|
|
128
|
-
## 技术细节
|
|
129
|
-
|
|
130
|
-
- **Node.js 版本要求**: >= 22
|
|
131
|
-
- **依赖包**: inquirer, fs-extra
|
|
132
|
-
- **支持平台**: Windows, macOS, Linux
|
|
133
|
-
- **脚本类型**: ES Modules
|
|
1
|
+
# XViewer 演示脚本使用说明
|
|
2
|
+
|
|
3
|
+
## 概述
|
|
4
|
+
|
|
5
|
+
这套脚本用于运行 XViewer 组件的演示示例,支持跨平台运行(Windows、macOS、Linux)。
|
|
6
|
+
|
|
7
|
+
## 脚本文件
|
|
8
|
+
|
|
9
|
+
- `demo-selector.js` - 示例选择器,扫描并选择要运行的示例
|
|
10
|
+
- `dev-demo.js` - 开发模式演示
|
|
11
|
+
- `build-demo.js` - 打包模式演示
|
|
12
|
+
- `preview-demo.js` - 预览模式演示
|
|
13
|
+
- `run-demo.bat` - Windows 批处理文件(备用方案)
|
|
14
|
+
|
|
15
|
+
## 使用方法
|
|
16
|
+
|
|
17
|
+
### 方法一:使用 npm 脚本(推荐)
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
# 开发模式
|
|
21
|
+
pnpm run dev:demo
|
|
22
|
+
|
|
23
|
+
# 打包模式
|
|
24
|
+
pnpm run build:demo
|
|
25
|
+
|
|
26
|
+
# 预览模式
|
|
27
|
+
pnpm run preview:demo
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### 方法二:直接运行 Node.js 脚本
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
# 开发模式
|
|
34
|
+
node scripts/dev-demo.js
|
|
35
|
+
|
|
36
|
+
# 打包模式
|
|
37
|
+
node scripts/build-demo.js
|
|
38
|
+
|
|
39
|
+
# 预览模式
|
|
40
|
+
node scripts/preview-demo.js
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### 方法三:Windows 批处理文件
|
|
44
|
+
|
|
45
|
+
```cmd
|
|
46
|
+
# 开发模式
|
|
47
|
+
scripts\run-demo.bat dev-demo
|
|
48
|
+
|
|
49
|
+
# 打包模式
|
|
50
|
+
scripts\run-demo.bat build-demo
|
|
51
|
+
|
|
52
|
+
# 预览模式
|
|
53
|
+
scripts\run-demo.bat preview-demo
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## 示例文件格式
|
|
57
|
+
|
|
58
|
+
脚本支持两种示例文件格式:
|
|
59
|
+
|
|
60
|
+
1. **单文件模式**: `src/Example_XXXX.tsx`
|
|
61
|
+
2. **文件夹模式**:
|
|
62
|
+
- `src/examples/XXXX/index.tsx`
|
|
63
|
+
- `src/examples/XXXX/XXXX.tsx`
|
|
64
|
+
|
|
65
|
+
## Windows 兼容性
|
|
66
|
+
|
|
67
|
+
### 已解决的问题
|
|
68
|
+
|
|
69
|
+
1. ✅ **依赖包缺失** - 已添加 `inquirer` 和 `fs-extra` 依赖
|
|
70
|
+
2. ✅ **Shell 执行** - Windows 下使用 `shell: true` 选项
|
|
71
|
+
3. ✅ **环境变量** - 自动设置 `NODE_OPTIONS` 环境变量
|
|
72
|
+
4. ✅ **路径处理** - 使用 `path.join()` 确保跨平台兼容
|
|
73
|
+
5. ✅ **调试信息** - 添加详细的调试输出
|
|
74
|
+
|
|
75
|
+
### 调试信息
|
|
76
|
+
|
|
77
|
+
脚本运行时会显示以下调试信息:
|
|
78
|
+
- Node.js 版本
|
|
79
|
+
- 操作系统类型
|
|
80
|
+
- 当前工作目录
|
|
81
|
+
- 脚本目录
|
|
82
|
+
- Windows 模式标识
|
|
83
|
+
|
|
84
|
+
## 故障排除
|
|
85
|
+
|
|
86
|
+
### 问题 1:脚本执行没有反应
|
|
87
|
+
|
|
88
|
+
**解决方案**:
|
|
89
|
+
1. 确保已安装依赖:`pnpm install`
|
|
90
|
+
2. 检查 Node.js 版本:`node --version`(需要 >= 22)
|
|
91
|
+
3. 使用调试模式查看详细信息
|
|
92
|
+
|
|
93
|
+
### 问题 2:Windows 下 pnpm 命令无法识别
|
|
94
|
+
|
|
95
|
+
**解决方案**:
|
|
96
|
+
1. 确保 pnpm 已全局安装:`npm install -g pnpm`
|
|
97
|
+
2. 检查 PATH 环境变量
|
|
98
|
+
3. 使用批处理文件:`scripts\run-demo.bat`
|
|
99
|
+
|
|
100
|
+
### 问题 3:内存不足错误
|
|
101
|
+
|
|
102
|
+
**解决方案**:
|
|
103
|
+
1. 脚本已自动设置 `NODE_OPTIONS=--max-old-space-size=16384`
|
|
104
|
+
2. 如需调整,修改脚本中的环境变量设置
|
|
105
|
+
|
|
106
|
+
### 问题 4:示例文件扫描失败
|
|
107
|
+
|
|
108
|
+
**解决方案**:
|
|
109
|
+
1. 确保示例文件格式正确
|
|
110
|
+
2. 检查文件路径和权限
|
|
111
|
+
3. 查看调试信息中的路径信息
|
|
112
|
+
|
|
113
|
+
## 开发说明
|
|
114
|
+
|
|
115
|
+
### 添加新示例
|
|
116
|
+
|
|
117
|
+
1. 在 `src/examples/` 下创建新文件夹
|
|
118
|
+
2. 添加 `index.tsx` 或 `[文件夹名].tsx` 文件
|
|
119
|
+
3. 脚本会自动扫描并显示
|
|
120
|
+
|
|
121
|
+
### 修改脚本
|
|
122
|
+
|
|
123
|
+
1. 所有脚本都支持跨平台运行
|
|
124
|
+
2. 使用 `process.platform === 'win32'` 检测 Windows
|
|
125
|
+
3. 使用 `path.join()` 处理路径
|
|
126
|
+
4. 使用 `shell: isWindows` 设置 spawn 选项
|
|
127
|
+
|
|
128
|
+
## 技术细节
|
|
129
|
+
|
|
130
|
+
- **Node.js 版本要求**: >= 22
|
|
131
|
+
- **依赖包**: inquirer, fs-extra
|
|
132
|
+
- **支持平台**: Windows, macOS, Linux
|
|
133
|
+
- **脚本类型**: ES Modules
|
package/scripts/build-demo.js
CHANGED
|
@@ -1,88 +1,88 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import { spawn } from 'child_process';
|
|
4
|
-
import { main, restoreMainFile } from './demo-selector.js';
|
|
5
|
-
import path from 'path';
|
|
6
|
-
import { fileURLToPath } from 'url';
|
|
7
|
-
|
|
8
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
9
|
-
const __dirname = path.dirname(__filename);
|
|
10
|
-
|
|
11
|
-
// 检测操作系统
|
|
12
|
-
const isWindows = process.platform === 'win32';
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* 执行打包
|
|
16
|
-
*/
|
|
17
|
-
function runBuild() {
|
|
18
|
-
console.log('\n🔨 正在执行打包...\n');
|
|
19
|
-
console.log('🔧 调试信息:');
|
|
20
|
-
console.log(' 操作系统:', process.platform);
|
|
21
|
-
console.log(' Windows 模式:', isWindows);
|
|
22
|
-
console.log(' 工作目录:', path.resolve(__dirname, '..'));
|
|
23
|
-
console.log('');
|
|
24
|
-
|
|
25
|
-
const buildProcess = spawn('pnpm', ['run', 'build:app'], {
|
|
26
|
-
stdio: 'inherit',
|
|
27
|
-
shell: isWindows, // Windows 下需要 shell: true
|
|
28
|
-
cwd: path.resolve(__dirname, '..'),
|
|
29
|
-
env: {
|
|
30
|
-
...process.env,
|
|
31
|
-
NODE_OPTIONS: '--max-old-space-size=16384'
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
buildProcess.on('close', (code) => {
|
|
36
|
-
if (code === 0) {
|
|
37
|
-
console.log('\n✅ 打包完成!');
|
|
38
|
-
console.log('📁 输出目录: dist-app/');
|
|
39
|
-
} else {
|
|
40
|
-
console.error(`\n❌ 打包失败 (退出码: ${code})`);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
// 恢复原始 main.tsx 文件
|
|
44
|
-
restoreMainFile();
|
|
45
|
-
process.exit(code);
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
buildProcess.on('error', (error) => {
|
|
49
|
-
console.error('❌ 执行打包失败:', error);
|
|
50
|
-
restoreMainFile();
|
|
51
|
-
process.exit(1);
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
// 处理进程退出信号
|
|
55
|
-
process.on('SIGINT', () => {
|
|
56
|
-
console.log('\n🔄 正在取消打包...');
|
|
57
|
-
buildProcess.kill('SIGINT');
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
process.on('SIGTERM', () => {
|
|
61
|
-
console.log('\n🔄 正在取消打包...');
|
|
62
|
-
buildProcess.kill('SIGTERM');
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* 主函数
|
|
68
|
-
*/
|
|
69
|
-
async function runBuildDemo() {
|
|
70
|
-
try {
|
|
71
|
-
// 先选择示例
|
|
72
|
-
await main();
|
|
73
|
-
|
|
74
|
-
// 执行打包
|
|
75
|
-
runBuild();
|
|
76
|
-
} catch (error) {
|
|
77
|
-
console.error('❌ 打包模式启动失败:', error);
|
|
78
|
-
restoreMainFile();
|
|
79
|
-
process.exit(1);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
// 如果直接运行此脚本
|
|
84
|
-
if (import.meta.url === `file://${process.argv[1]}`) {
|
|
85
|
-
runBuildDemo();
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
export { runBuildDemo };
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { spawn } from 'child_process';
|
|
4
|
+
import { main, restoreMainFile } from './demo-selector.js';
|
|
5
|
+
import path from 'path';
|
|
6
|
+
import { fileURLToPath } from 'url';
|
|
7
|
+
|
|
8
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
9
|
+
const __dirname = path.dirname(__filename);
|
|
10
|
+
|
|
11
|
+
// 检测操作系统
|
|
12
|
+
const isWindows = process.platform === 'win32';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* 执行打包
|
|
16
|
+
*/
|
|
17
|
+
function runBuild() {
|
|
18
|
+
console.log('\n🔨 正在执行打包...\n');
|
|
19
|
+
console.log('🔧 调试信息:');
|
|
20
|
+
console.log(' 操作系统:', process.platform);
|
|
21
|
+
console.log(' Windows 模式:', isWindows);
|
|
22
|
+
console.log(' 工作目录:', path.resolve(__dirname, '..'));
|
|
23
|
+
console.log('');
|
|
24
|
+
|
|
25
|
+
const buildProcess = spawn('pnpm', ['run', 'build:app'], {
|
|
26
|
+
stdio: 'inherit',
|
|
27
|
+
shell: isWindows, // Windows 下需要 shell: true
|
|
28
|
+
cwd: path.resolve(__dirname, '..'),
|
|
29
|
+
env: {
|
|
30
|
+
...process.env,
|
|
31
|
+
NODE_OPTIONS: '--max-old-space-size=16384'
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
buildProcess.on('close', (code) => {
|
|
36
|
+
if (code === 0) {
|
|
37
|
+
console.log('\n✅ 打包完成!');
|
|
38
|
+
console.log('📁 输出目录: dist-app/');
|
|
39
|
+
} else {
|
|
40
|
+
console.error(`\n❌ 打包失败 (退出码: ${code})`);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// 恢复原始 main.tsx 文件
|
|
44
|
+
restoreMainFile();
|
|
45
|
+
process.exit(code);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
buildProcess.on('error', (error) => {
|
|
49
|
+
console.error('❌ 执行打包失败:', error);
|
|
50
|
+
restoreMainFile();
|
|
51
|
+
process.exit(1);
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
// 处理进程退出信号
|
|
55
|
+
process.on('SIGINT', () => {
|
|
56
|
+
console.log('\n🔄 正在取消打包...');
|
|
57
|
+
buildProcess.kill('SIGINT');
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
process.on('SIGTERM', () => {
|
|
61
|
+
console.log('\n🔄 正在取消打包...');
|
|
62
|
+
buildProcess.kill('SIGTERM');
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* 主函数
|
|
68
|
+
*/
|
|
69
|
+
async function runBuildDemo() {
|
|
70
|
+
try {
|
|
71
|
+
// 先选择示例
|
|
72
|
+
await main();
|
|
73
|
+
|
|
74
|
+
// 执行打包
|
|
75
|
+
runBuild();
|
|
76
|
+
} catch (error) {
|
|
77
|
+
console.error('❌ 打包模式启动失败:', error);
|
|
78
|
+
restoreMainFile();
|
|
79
|
+
process.exit(1);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// 如果直接运行此脚本
|
|
84
|
+
if (import.meta.url === `file://${process.argv[1]}`) {
|
|
85
|
+
runBuildDemo();
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export { runBuildDemo };
|