@qingtian/qtcli 1.0.0 → 1.0.2-beta.1

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/README.md CHANGED
@@ -1,193 +1,260 @@
1
- # QTCli
1
+ # 🔐 文件加密解密工具
2
2
 
3
- QTCli 是一款基于 Node.js 的前端工程化底座,提供了完整的项目构建、开发和部署解决方案。
3
+ 一个基于 Node.js 的安全文件加密解密工具,使用 AES-256-CBC 算法保护您的敏感文件。
4
4
 
5
- ## 特性
5
+ ## ✨ 功能特性
6
6
 
7
- - 🚀 快速创建和初始化项目
8
- - 📦 内置 Webpack 构建配置
9
- - 🔥 支持 React + TypeScript 开发
10
- - 🎨 支持 LessSassCSS Modules
11
- - 📱 支持移动端适配
12
- - 🔍 内置 ESLint、StyleLint 代码规范检查
13
- - 🛠 支持自定义配置和插件扩展
7
+ - 🔒 **安全加密**: 使用 AES-256-CBC 加密算法
8
+ - 🔑 **密码保护**: 支持密码输入和验证
9
+ - 📁 **文件完整性**: 保持原始文件内容完全不变
10
+ - 🌍 **跨平台**: 支持 WindowsmacOSLinux
11
+ - 💻 **命令行界面**: 简单易用的 CLI 工具
12
+ - 🔍 **文件验证**: 自动检测加密文件格式
13
+ - 📊 **文件信息**: 显示详细的文件信息
14
14
 
15
- ## 安装
15
+ ## 📋 系统要求
16
16
 
17
+ - Node.js >= 14.0.0
18
+ - npm (通常随 Node.js 一起安装)
19
+
20
+ ## 🚀 快速开始
21
+
22
+ ### 1. 查看帮助信息
17
23
  ```bash
18
- npm install -g qtcli
24
+ node file-crypto.js
19
25
  ```
20
26
 
21
- ## 使用方法
27
+ ### 2. 加密文件
28
+ ```bash
29
+ # 交互式输入密码
30
+ node file-crypto.js encrypt test.txt test.enc
22
31
 
23
- ### 查看帮助
32
+ # 直接指定密码
33
+ node file-crypto.js encrypt test.txt test.enc mypassword
34
+ ```
24
35
 
36
+ ### 3. 解密文件
25
37
  ```bash
26
- qtcli --help
38
+ # 交互式输入密码
39
+ node file-crypto.js decrypt test.enc test_decrypted.txt
40
+
41
+ # 直接指定密码
42
+ node file-crypto.js decrypt test.enc test_decrypted.txt mypassword
27
43
  ```
28
44
 
29
- ### 初始化项目
45
+ ### 4. 查看文件信息
46
+ ```bash
47
+ node file-crypto.js info test.txt
48
+ ```
30
49
 
50
+ ### 5. 验证加密文件
31
51
  ```bash
32
- qtcli init [options]
52
+ node file-crypto.js verify test.enc
33
53
  ```
34
54
 
35
- ### 开发模式
55
+ ## 📖 详细用法
36
56
 
57
+ ### 命令格式
37
58
  ```bash
38
- qtcli dev [options]
59
+ node file-crypto.js <命令> [参数...]
39
60
  ```
40
61
 
41
- ### 构建项目
62
+ ### 可用命令
42
63
 
64
+ #### `encrypt` - 加密文件
43
65
  ```bash
44
- qtcli build [options]
45
- ```
46
-
47
- ### 全局选项
48
-
49
- - `-V, --version`: 显示版本号
50
- - `-D, --debug`: 启用调试模式
51
- - `-h, --help`: 显示帮助信息
52
-
53
- ## 项目结构
54
-
55
- ```
56
- my-project/
57
- ├── src/ # 源代码目录
58
- ├── public/ # 静态资源目录
59
- ├── dist/ # 构建输出目录
60
- └── qt.conf.js # 项目配置文件
61
- ```
62
-
63
- ## 配置说明
64
-
65
- 在项目根目录创建 `qt.conf.js` 文件进行自定义配置:
66
-
67
- ```javascript
68
- export default {
69
- // 构建类型
70
- buildType: 'WEB',
71
-
72
- // 解决方案名称
73
- solutionName: 'my-project',
74
-
75
- // 构建模式
76
- buildMode: {
77
- development: 'DEVELOPMENT',
78
- production: 'PRODUCTION',
79
- test: 'TEST',
80
- analyze: 'ANALYZE'
81
- },
82
-
83
- // 项目配置
84
- config: {
85
- // HTML 注入配置
86
- htmlInject: {
87
- head: [
88
- // meta 标签
89
- {
90
- tag: 'meta',
91
- attrs: {
92
- charset: 'utf-8'
93
- }
94
- },
95
- {
96
- tag: 'meta',
97
- attrs: {
98
- name: 'viewport',
99
- content: 'width=device-width, initial-scale=1'
100
- }
101
- },
102
- // link 标签
103
- {
104
- tag: 'link',
105
- attrs: {
106
- rel: 'stylesheet',
107
- href: '/static/css/global.css'
108
- }
109
- }
110
- ],
111
- body: [
112
- // body 中的 script
113
- {
114
- tag: 'script',
115
- attrs: {
116
- src: '/static/js/init.js'
117
- }
118
- }
119
- ]
120
- },
121
-
122
- // JavaScript 代码片段注入配置
123
- jsInject: {
124
- head: [
125
- {
126
- code: `window.APP_CONFIG = {
127
- version: '1.0.0',
128
- env: '${process.env.NODE_ENV}',
129
- apiUrl: '${process.env.API_URL}'
130
- };`
131
- }
132
- ],
133
- body: [
134
- {
135
- code: `document.addEventListener('DOMContentLoaded', function() {
136
- console.log('DOM loaded');
137
- });`
138
- }
139
- ]
140
- },
141
-
142
- // 环境变量配置
143
- env: {
144
- development: {
145
- NODE_ENV: 'development',
146
- API_URL: 'http://dev-api.example.com'
147
- },
148
- production: {
149
- NODE_ENV: 'production',
150
- API_URL: 'http://api.example.com'
151
- }
152
- }
153
- },
154
-
155
- // webpack 配置
156
- webpackConfig: {
157
- // 开发服务器配置
158
- devServer: {
159
- port: 3000,
160
- host: 'localhost'
161
- },
162
- // 解析配置
163
- resolve: {
164
- alias: {
165
- '@components': './src/components',
166
- '@utils': './src/utils'
167
- }
168
- },
169
- // 模块规则
170
- module: {
171
- rules: []
172
- },
173
- // 插件配置
174
- plugins: []
175
- }
176
- }
177
- ```
178
-
179
- ## 开发环境要求
66
+ node file-crypto.js encrypt <输入文件> <输出文件> [密码]
67
+ ```
68
+ - **输入文件**: 要加密的原始文件路径
69
+ - **输出文件**: 加密后的文件保存路径
70
+ - **密码**: 可选,如果不提供会提示输入
180
71
 
181
- - Node.js >= 14.0.0
182
- - npm >= 6.0.0
72
+ #### `decrypt` - 解密文件
73
+ ```bash
74
+ node file-crypto.js decrypt <输入文件> <输出文件> [密码]
75
+ ```
76
+ - **输入文件**: 要解密的加密文件路径
77
+ - **输出文件**: 解密后的文件保存路径
78
+ - **密码**: 可选,如果不提供会提示输入
79
+
80
+ #### `info` - 显示文件信息
81
+ ```bash
82
+ node file-crypto.js info <文件路径>
83
+ ```
84
+ 显示文件的详细信息,包括:
85
+ - 文件大小
86
+ - 文件类型
87
+ - 修改时间
88
+ - 加密状态
89
+
90
+ #### `verify` - 验证加密文件
91
+ ```bash
92
+ node file-crypto.js verify <文件路径>
93
+ ```
94
+ 检查文件是否为有效的加密文件格式。
95
+
96
+ ## 🔧 技术细节
97
+
98
+ ### 加密算法
99
+ - **算法**: AES-256-CBC
100
+ - **密钥派生**: 使用 scrypt 从密码生成密钥
101
+ - **IV**: 随机生成的 16 字节初始化向量
102
+ - **输出格式**: `IV:加密数据` (十六进制编码)
103
+
104
+ ### 安全特性
105
+ - ✅ 每次加密使用不同的随机 IV
106
+ - ✅ 使用强密钥派生函数 (scrypt)
107
+ - ✅ 支持任意大小的文件
108
+ - ✅ 密码输入时隐藏显示
109
+ - ✅ 文件格式验证
110
+
111
+ ### 文件格式
112
+ 加密后的文件格式为:
113
+ ```
114
+ <IV十六进制>:<加密数据十六进制>
115
+ ```
116
+
117
+ ## 📝 使用示例
118
+
119
+ ### 示例 1: 基本加密解密
120
+ ```bash
121
+ # 1. 创建测试文件
122
+ echo "这是一个秘密文件" > secret.txt
123
+
124
+ # 2. 加密文件
125
+ node file-crypto.js encrypt secret.txt secret.enc
126
+
127
+ # 3. 查看加密文件信息
128
+ node file-crypto.js info secret.enc
129
+
130
+ # 4. 验证加密文件
131
+ node file-crypto.js verify secret.enc
132
+
133
+ # 5. 解密文件
134
+ node file-crypto.js decrypt secret.enc secret_decrypted.txt
135
+
136
+ # 6. 验证解密结果
137
+ diff secret.txt secret_decrypted.txt
138
+ ```
139
+
140
+ ### 示例 2: 批量处理
141
+ ```bash
142
+ # 批量加密当前目录下的所有 .txt 文件
143
+ for file in *.txt; do
144
+ node file-crypto.js encrypt "$file" "${file}.enc"
145
+ done
146
+
147
+ # 批量解密所有 .enc 文件
148
+ for file in *.enc; do
149
+ base_name=$(basename "$file" .enc)
150
+ node file-crypto.js decrypt "$file" "${base_name}_decrypted.txt"
151
+ done
152
+ ```
153
+
154
+ ### 示例 3: 自动化脚本
155
+ ```bash
156
+ #!/bin/bash
157
+ # encrypt-all.sh
158
+
159
+ for file in "$@"; do
160
+ if [ -f "$file" ]; then
161
+ echo "加密文件: $file"
162
+ node file-crypto.js encrypt "$file" "${file}.enc"
163
+ fi
164
+ done
165
+ ```
166
+
167
+ ## ⚠️ 安全注意事项
168
+
169
+ ### 密码安全
170
+ - 🔒 请妥善保管密码,密码丢失将无法解密
171
+ - 🔒 建议使用强密码(包含大小写字母、数字、特殊字符)
172
+ - 🔒 不要在命令行历史中留下密码
173
+ - 🔒 定期更换密码
174
+
175
+ ### 文件安全
176
+ - 🔒 加密文件不要与原始文件放在同一位置
177
+ - 🔒 定期备份重要的加密文件
178
+ - 🔒 删除原始文件前确保加密成功
179
+ - 🔒 使用安全的存储介质
180
+
181
+ ### 环境安全
182
+ - 🔒 在安全的计算机上使用
183
+ - 🔒 避免在公共网络传输加密文件
184
+ - 🔒 定期更新 Node.js 版本
185
+
186
+ ## 🐛 常见问题
187
+
188
+ ### Q: 加密失败怎么办?
189
+ A: 检查以下几点:
190
+ - 输入文件是否存在
191
+ - 是否有足够的磁盘空间
192
+ - 是否有文件读写权限
193
+ - 密码是否包含特殊字符
194
+
195
+ ### Q: 解密失败怎么办?
196
+ A: 可能的原因:
197
+ - 密码错误
198
+ - 文件不是有效的加密文件
199
+ - 文件已损坏
200
+ - 使用了不同的加密算法
201
+
202
+ ### Q: 如何验证加密是否成功?
203
+ A: 使用以下命令:
204
+ ```bash
205
+ node file-crypto.js verify <加密文件>
206
+ node file-crypto.js info <加密文件>
207
+ ```
208
+
209
+ ### Q: 支持哪些文件类型?
210
+ A: 支持所有类型的文件,包括:
211
+ - 文本文件 (.txt, .md, .js, .py 等)
212
+ - 图片文件 (.jpg, .png, .gif 等)
213
+ - 文档文件 (.pdf, .doc, .xls 等)
214
+ - 压缩文件 (.zip, .rar 等)
215
+ - 任何二进制文件
216
+
217
+ ## 🔄 错误处理
218
+
219
+ ### 常见错误信息
220
+ ```
221
+ ❌ 加密失败: 输入文件不存在: input.txt
222
+ ❌ 解密失败: 文件格式错误,无法解密
223
+ ❌ 解密失败: 密码错误
224
+ ❌ 无法获取文件信息: file.txt
225
+ ```
226
+
227
+ ### 错误代码
228
+ - **文件不存在**: 检查文件路径是否正确
229
+ - **权限不足**: 检查文件读写权限
230
+ - **磁盘空间不足**: 清理磁盘空间
231
+ - **密码错误**: 确认密码正确性
232
+
233
+ ## 📄 许可证
234
+
235
+ MIT License
236
+
237
+ ## 🤝 贡献
238
+
239
+ 欢迎提交 Issue 和 Pull Request!
240
+
241
+ ## 📞 支持
183
242
 
184
- ## 作者
243
+ 如果您遇到问题或有建议,请:
244
+ 1. 查看本文档的常见问题部分
245
+ 2. 提交 GitHub Issue
246
+ 3. 联系开发者
185
247
 
186
- - yujie.guo - 初始作者
248
+ ## 📈 更新日志
187
249
 
188
- ## 问题反馈
250
+ ### v1.0.0 (2024-01-01)
251
+ - 🎉 初始版本发布
252
+ - ✨ 支持基本的文件加密解密
253
+ - 🔐 使用 AES-256-CBC 算法
254
+ - 💻 命令行界面
255
+ - 🔍 文件验证功能
256
+ - 📊 文件信息显示
189
257
 
190
- 如果你遇到任何问题或有任何建议,请通过以下方式联系我们:
258
+ ---
191
259
 
192
- - 提交 Issue: [GitHub Issues](https://gitee.com/fengrengame/qtnode/issues)
193
- - 邮件联系: 296963166@qq.com
260
+ **注意**: 这是一个演示工具,用于学习和测试目的。在生产环境中使用前,请确保了解相关的安全风险。
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qingtian/qtcli",
3
- "version": "1.0.0",
3
+ "version": "1.0.2-beta.1",
4
4
  "description": "QTCli是一款基于node的前端工程化底座",
5
5
  "homepage": "https://gitee.com/fengrengame/qtnode#readme",
6
6
  "bugs": {
@@ -72,12 +72,12 @@
72
72
  "@babel/preset-env": "7.18.2",
73
73
  "@babel/preset-react": "7.17.12",
74
74
  "@babel/preset-typescript": "7.17.12",
75
+ "@commitlint/cli": "^19.8.0",
75
76
  "@pmmmwh/react-refresh-webpack-plugin": "^0.5.3",
76
77
  "@svgr/webpack": "^5.5.0",
77
78
  "@types/react": "18.0.12",
78
79
  "@types/react-dom": "18.0.5",
79
80
  "autoprefixer": "10.4.7",
80
- "babel-jest": "^27.4.2",
81
81
  "babel-loader": "^8.2.3",
82
82
  "babel-plugin-import": "1.13.8",
83
83
  "babel-plugin-named-asset-import": "^0.3.8",
@@ -110,12 +110,10 @@
110
110
  "fs-extra": "^10.0.0",
111
111
  "glob-all": "3.3.1",
112
112
  "html-webpack-plugin": "^5.5.0",
113
+ "html-webpack-tags-plugin": "^3.0.0",
113
114
  "husky": "8.0.3",
114
115
  "identity-obj-proxy": "^3.0.0",
115
116
  "inquirer": "8.0.0",
116
- "jest": "^27.4.3",
117
- "jest-resolve": "^27.4.2",
118
- "jest-watch-typeahead": "^1.0.0",
119
117
  "less": "4.1.3",
120
118
  "less-loader": "11.0.0",
121
119
  "lint-staged": "15.5.1",
@@ -162,10 +160,10 @@
162
160
  "webpack-manifest-plugin": "^4.0.2",
163
161
  "webpack-merge": "5.8.0",
164
162
  "workbox-webpack-plugin": "^6.4.1",
163
+ "xlsx": "^0.18.5",
165
164
  "yamljs": "0.3.0"
166
165
  },
167
166
  "devDependencies": {
168
- "@commitlint/cli": "^19.8.0",
169
167
  "@types/autoprefixer": "10.2.0",
170
168
  "@types/cli-progress": "3.11.5",
171
169
  "@types/colors": "1.2.1",
@@ -194,16 +192,10 @@
194
192
  "@types/webpack-dev-server": "4.7.2",
195
193
  "@types/webpack-merge": "5.0.0",
196
194
  "@types/yamljs": "0.2.34",
197
- "commitlint-config-ali": "^1.1.0",
198
- "eslint": "^8.56.0",
199
- "eslint-config-ali": "^15.1.0",
200
- "eslint-config-prettier": "^9.1.0",
201
- "eslint-plugin-prettier": "^5.3.1",
202
- "html-webpack-tags-plugin": "^3.0.0",
203
- "husky": "^8.0.3",
204
- "lint-staged": "^15.5.1",
205
- "prettier": "^3.5.3",
206
- "prettier-config-ali": "^1.3.4"
195
+ "babel-jest": "^27.4.2",
196
+ "jest": "^27.4.3",
197
+ "jest-resolve": "^27.4.2",
198
+ "jest-watch-typeahead": "^1.0.0"
207
199
  },
208
200
  "email": "296963166@qq.com"
209
201
  }
package/dist/qt.conf.js CHANGED
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = {
2
+ module.exports = {
4
3
  buildType: 'WEB',
5
4
  solutionName: 'qtnode',
6
5
  buildMode: {
@@ -86,7 +85,9 @@ exports.default = {
86
85
  },
87
86
  // webpack 配置
88
87
  webpackConfig: {
89
- devServer: {},
88
+ devServer: {
89
+ port: 3001,
90
+ },
90
91
  resolve: {
91
92
  alias: {
92
93
  '@components': './src/components',
@@ -48,10 +48,10 @@ exports.default = (function () {
48
48
  var heat = new commander_1.default.Command('dev');
49
49
  heat
50
50
  .description('开启本地调试服务器')
51
- .option('--https [http]', '启用https', false)
52
- .option('-p, --port <port>', '绑定端口', false)
53
- .option('-d, --domain <host>', '绑定域名', 'localhost')
54
- .option('-o, --open <open>', '自动打开浏览器', false)
51
+ .option('--https [https]', '启用https')
52
+ .option('-p, --port <port>', '绑定端口')
53
+ .option('-d, --domain <host>', '绑定域名')
54
+ .option('-o, --open <open>', '自动打开浏览器')
55
55
  .action(function (options, cmd) { return __awaiter(void 0, void 0, void 0, function () {
56
56
  var cm;
57
57
  return __generator(this, function (_a) {
@@ -43,6 +43,7 @@ var ProcessEnvLoader = /** @class */ (function () {
43
43
  try {
44
44
  // 加载 qtcli.config.js
45
45
  var qtConfigPath = path_1.default.join(rootDir, 'qt.conf.js');
46
+ console.log('qtconfigpat', qtConfigPath, rootDir);
46
47
  if (fs_1.default.existsSync(qtConfigPath)) {
47
48
  this.qtConfig = require(qtConfigPath);
48
49
  // 将 qtConfig 中的环境变量添加到 process.env
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
14
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
15
+ if (ar || !(i in from)) {
16
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
17
+ ar[i] = from[i];
18
+ }
19
+ }
20
+ return to.concat(ar || Array.prototype.slice.call(from));
21
+ };
22
+ Object.defineProperty(exports, "__esModule", { value: true });
23
+ exports.deepMerge = void 0;
24
+ /**
25
+ * 深度合并对象
26
+ * @param target 目标对象
27
+ * @param source 源对象
28
+ * @returns 合并后的对象
29
+ */
30
+ function deepMerge(target, source) {
31
+ var result = __assign({}, target);
32
+ for (var key in source) {
33
+ var sourceValue = source[key];
34
+ var targetValue = target[key];
35
+ if (sourceValue !== null &&
36
+ typeof sourceValue === 'object' &&
37
+ targetValue !== null &&
38
+ typeof targetValue === 'object') {
39
+ // 如果是数组,直接合并
40
+ if (Array.isArray(sourceValue)) {
41
+ result[key] = __spreadArray(__spreadArray([], targetValue, true), sourceValue, true);
42
+ }
43
+ else {
44
+ // 递归合并对象
45
+ result[key] = deepMerge(targetValue, sourceValue);
46
+ }
47
+ }
48
+ else if (sourceValue !== undefined) {
49
+ // 如果源对象的值不是 undefined,则使用源对象的值
50
+ result[key] = sourceValue;
51
+ }
52
+ }
53
+ return result;
54
+ }
55
+ exports.deepMerge = deepMerge;
@@ -114,11 +114,18 @@ var formatESLintMessages = function (results, severity) {
114
114
  var severityText = m.severity === 2 ? colors_1.default.red('error') : colors_1.default.yellow('warning');
115
115
  var location = colors_1.default.gray.underline("".concat(m.line, ":").concat(m.column));
116
116
  var ruleId = m.ruleId ? colors_1.default.cyan(" ".concat(m.ruleId)) : '';
117
- return "".concat(severityText, " in ").concat(colors_1.default.white(r.filePath), "\n").concat(colors_1.default.gray(m.message)).concat(ruleId, " ").concat(location);
117
+ return " ".concat(severityText, " ").concat(colors_1.default.gray(m.message)).concat(ruleId, " ").concat(location);
118
118
  });
119
- return messages.join('\n');
119
+ return "".concat(colors_1.default.white(r.filePath), "\n").concat(messages.join('\n'));
120
120
  })
121
- .join('\n');
121
+ .join('\n\n');
122
+ };
123
+ var getStatus = function (errorCount, warningCount) {
124
+ if (errorCount > 0)
125
+ return 'error';
126
+ if (warningCount > 0)
127
+ return 'warning';
128
+ return 'success';
122
129
  };
123
130
  exports.formatOutput = {
124
131
  build: function (output) { return __awaiter(void 0, void 0, void 0, function () {
@@ -127,7 +134,9 @@ exports.formatOutput = {
127
134
  return __generator(this, function (_c) {
128
135
  nodes = [];
129
136
  errorMessages = output.errors > 0
130
- ? ((_a = output.buildErrors) === null || _a === void 0 ? void 0 : _a.map(function (error) { return "".concat(colors_1.default.red('ERROR'), " in ").concat(colors_1.default.white("".concat(error.moduleName, "\n").concat(error.message)), "\n").concat(error === null || error === void 0 ? void 0 : error.stack); }).join('\n')) || "".concat(colors_1.default.red(String(output.errors)), " \u4E2A\u9519\u8BEF")
137
+ ? ((_a = output.buildErrors) === null || _a === void 0 ? void 0 : _a.map(function (error) {
138
+ return "".concat(colors_1.default.red('ERROR'), " in ").concat(colors_1.default.white("".concat(error.moduleName, "\n").concat(error.message)), "\n").concat(error === null || error === void 0 ? void 0 : error.stack);
139
+ }).join('\n')) || "".concat(colors_1.default.red(String(output.errors)), " \u4E2A\u9519\u8BEF")
131
140
  : '无错误';
132
141
  nodes.push((0, exports.formatNode)({
133
142
  type: 'process',
@@ -175,23 +184,17 @@ exports.formatOutput = {
175
184
  });
176
185
  }); },
177
186
  eslint: function (output) { return __awaiter(void 0, void 0, void 0, function () {
178
- var nodes, errorMessages, warningMessages, errorText, warningText, timeText, status;
187
+ var nodes, errorMessages, warningMessages, errorText, warningText, timeText;
179
188
  return __generator(this, function (_a) {
180
189
  nodes = [];
181
- errorMessages = output.errorCount > 0
182
- ? formatESLintMessages(output.results, 2) ||
183
- "".concat(colors_1.default.red(String(output.errorCount)), " \u4E2A\u9519\u8BEF")
184
- : '无错误';
190
+ errorMessages = output.errorCount > 0 ? formatESLintMessages(output.results, 2) : '无错误';
185
191
  nodes.push((0, exports.formatNode)({
186
192
  type: 'process',
187
193
  title: 'ESLint错误',
188
194
  content: errorMessages,
189
195
  status: output.errorCount > 0 ? 'error' : 'success',
190
196
  }));
191
- warningMessages = output.warningCount > 0
192
- ? formatESLintMessages(output.results, 1) ||
193
- "".concat(colors_1.default.yellow(String(output.warningCount)), " \u4E2A\u8B66\u544A")
194
- : '无警告';
197
+ warningMessages = output.warningCount > 0 ? formatESLintMessages(output.results, 1) : '无警告';
195
198
  nodes.push((0, exports.formatNode)({
196
199
  type: 'process',
197
200
  title: 'ESLint警告',
@@ -201,18 +204,11 @@ exports.formatOutput = {
201
204
  errorText = colors_1.default.red("".concat(output.errorCount, " \u9519\u8BEF"));
202
205
  warningText = colors_1.default.yellow("".concat(output.warningCount, " \u8B66\u544A"));
203
206
  timeText = output.time ? colors_1.default.green("\u8017\u65F6 ".concat((output.time / 1000).toFixed(2), "s")) : '';
204
- status = 'success';
205
- if (output.errorCount > 0) {
206
- status = 'error';
207
- }
208
- else if (output.warningCount > 0) {
209
- status = 'warning';
210
- }
211
207
  nodes.push((0, exports.formatNode)({
212
208
  type: 'process',
213
209
  title: 'ESLint检查完成',
214
210
  content: "".concat(errorText, " ").concat(warningText, " ").concat(timeText),
215
- status: status,
211
+ status: getStatus(output.errorCount, output.warningCount),
216
212
  }));
217
213
  return [2 /*return*/, nodes.join('\n')];
218
214
  });
@@ -29,12 +29,12 @@ var formatOutput_1 = require("../utils/formatOutput");
29
29
  var logStart = function () {
30
30
  console.log((0, formatOutput_1.formatNode)({
31
31
  type: 'start',
32
- title: 'QTCli 工程底座',
32
+ title: "QTCli \u5DE5\u7A0B\u5E95\u5EA7 ".concat(pkg.version),
33
33
  }));
34
34
  console.log((0, formatOutput_1.formatNode)({
35
- type: 'process3',
36
- title: '版本',
37
- content: pkg.version,
35
+ type: 'process',
36
+ title: '环境信息',
37
+ content: "\u5F53\u524D\u73AF\u5883: ".concat(process.env.NODE_ENV || 'development', "\nNode\u7248\u672C: ").concat(process.version),
38
38
  }));
39
39
  };
40
40
  exports.logStart = logStart;
@@ -0,0 +1,171 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var teamData = [
4
+ {
5
+ projectName: 'AC项目',
6
+ teams: [
7
+ {
8
+ teamName: '古墓丽影战队',
9
+ members: [
10
+ { name: '刘茜苑', type: '战队队员' },
11
+ { name: '黄孝文', type: '战队队员' },
12
+ { name: '张大千', type: '战队队员' },
13
+ { name: '李智', type: '战队队长' },
14
+ { name: '辛义海', type: '战队队员' },
15
+ { name: '郑全超', type: '战队队员' },
16
+ ],
17
+ },
18
+ {
19
+ teamName: '多维巡航者',
20
+ members: [
21
+ { name: '苗凯', type: '战队队员' },
22
+ { name: '王祥祥', type: '战队队员' },
23
+ { name: '宋文婷', type: '战队队员' },
24
+ { name: '刘帅鑫', type: '战队队员' },
25
+ { name: '任晓青', type: '战队队员' },
26
+ { name: '孔令贵', type: '战队队员' },
27
+ { name: '赖楠楠', type: '战队队员' },
28
+ { name: '赵文龙', type: '战队队员' },
29
+ { name: '李冠华', type: '战队队员' },
30
+ { name: '范亨举', type: '战队队长' },
31
+ { name: '吴如军', type: '战队队员' },
32
+ { name: '王海阔', type: '战队队员' },
33
+ ],
34
+ },
35
+ {
36
+ teamName: '方块空间战队',
37
+ members: [
38
+ { name: '刘钰雪', type: '战队队长' },
39
+ { name: '谭鑫鑫', type: '战队队员' },
40
+ { name: '侯明江', type: '战队队员' },
41
+ ],
42
+ },
43
+ {
44
+ teamName: '三消数据战队',
45
+ members: [
46
+ { name: '王杰', type: '战队队员' },
47
+ { name: '李朋飞', type: '战队队员' },
48
+ { name: '吴永辉', type: '战队队员' },
49
+ ],
50
+ },
51
+ {
52
+ teamName: '神威战队',
53
+ members: [
54
+ { name: '张远波', type: '战队队员' },
55
+ { name: '衣光辉', type: '战队队长' },
56
+ { name: '刘军', type: '战队队员' },
57
+ { name: '房佳龙', type: '战队队员' },
58
+ { name: '王浩', type: '战队队员' },
59
+ { name: '缪呈祥', type: '战队队员' },
60
+ { name: '黄思灵', type: '战队队长' },
61
+ { name: '郭宇杰', type: 'CEO' },
62
+ ],
63
+ },
64
+ {
65
+ teamName: '数据猎鹰战队',
66
+ members: [{ name: '刘翀', type: '战队队员' }],
67
+ },
68
+ ],
69
+ members: [
70
+ { name: '袁旭道', type: 'Buddy' },
71
+ { name: '李强强', type: '军团指挥官' },
72
+ { name: '石军强', type: '军团指挥官' },
73
+ ],
74
+ },
75
+ {
76
+ projectName: 'EM项目',
77
+ teams: [
78
+ {
79
+ teamName: '财富开拓者战队',
80
+ members: [
81
+ { name: '邓照', type: '战队队员' },
82
+ { name: '马金涛', type: '战队队员' },
83
+ { name: '陈守肖', type: '战队队员' },
84
+ { name: '崔福权', type: '战队队员' },
85
+ { name: '孙若尘', type: '战队长' },
86
+ { name: '李阳阳', type: '战队队员' },
87
+ ],
88
+ },
89
+ {
90
+ teamName: '共鸣之声战队',
91
+ members: [
92
+ { name: '黄海', type: '战队队员' },
93
+ { name: '周浩', type: '战队队员' },
94
+ { name: '王琛', type: '战队队员' },
95
+ { name: '强敏', type: '战队队员' },
96
+ { name: '陈璇', type: '战队队长' },
97
+ { name: '钟勇飞', type: '战队队员' },
98
+ ],
99
+ },
100
+ {
101
+ teamName: '烈焰之笔战队',
102
+ members: [
103
+ { name: '刘腾飞', type: '战队队员' },
104
+ { name: '颜丙峰', type: '战队队员' },
105
+ { name: '张超', type: '战队队员' },
106
+ { name: '姜兆珍', type: '战队队员' },
107
+ { name: '兰喆', type: '战队队员' },
108
+ { name: '莫玉涛', type: '战队队员' },
109
+ { name: '王伟', type: '战队队长' },
110
+ { name: '唐杰', type: '战队队员' },
111
+ { name: '麻俊鹏', type: '战队队员' },
112
+ { name: '刘卜蔚', type: '战队队员' },
113
+ ],
114
+ },
115
+ {
116
+ teamName: '精算战鹰战队',
117
+ members: [
118
+ { name: '郭维祎', type: '战队队员' },
119
+ { name: '温绍琨', type: '战队队长' },
120
+ { name: '马天', type: '战队队员' },
121
+ { name: '孙峥嵘', type: '战队队员' },
122
+ { name: '郝翌', type: '战队队员' },
123
+ ],
124
+ },
125
+ {
126
+ teamName: '成长守护者战队',
127
+ members: [
128
+ { name: '单宝龙', type: '战队队员' },
129
+ { name: '邵鹏', type: '战队队员' },
130
+ { name: '竺文杰', type: '战队队长' },
131
+ { name: '丁浩', type: '战队队员' },
132
+ { name: '杨在茂', type: '战队队员' },
133
+ ],
134
+ },
135
+ {
136
+ teamName: '节日猎手战队',
137
+ members: [
138
+ { name: '李子昂', type: '战队队员' },
139
+ { name: '卢中原', type: '战队队员' },
140
+ { name: '王圆凯', type: '战队队员' },
141
+ { name: '赵文煊', type: '战队队长' },
142
+ { name: '王鹏', type: '战队队员' },
143
+ { name: '姚彦铭', type: '战队队员' },
144
+ { name: '丁逸俊', type: '战队队员' },
145
+ { name: '严学致', type: '战队队员' },
146
+ ],
147
+ },
148
+ {
149
+ teamName: '竞技之刃战队',
150
+ members: [
151
+ { name: '王顺祥', type: '战队队员' },
152
+ { name: '冯钦伟', type: '战队队员' },
153
+ { name: '崔永祺', type: '战队队员' },
154
+ { name: '李文超', type: '战队队长' },
155
+ { name: '解志辉', type: '战队队员' },
156
+ { name: '张胜杰', type: '战队队员' },
157
+ ],
158
+ },
159
+ {
160
+ teamName: '模块构造者战队',
161
+ members: [{ name: '石军强', type: '军团指挥官' }],
162
+ },
163
+ {
164
+ teamName: '创世者战队',
165
+ members: [{ name: '吴桥', type: '战队员' }],
166
+ },
167
+ ],
168
+ members: [{ name: '石军强', type: '军团指挥官' }],
169
+ },
170
+ ];
171
+ exports.default = teamData;
@@ -58,7 +58,7 @@ function dev() {
58
58
  Object.assign(devServerOptions, {
59
59
  open: (_c = (_b = argCmd === null || argCmd === void 0 ? void 0 : argCmd.open) !== null && _b !== void 0 ? _b : devServerOptions.open) !== null && _c !== void 0 ? _c : false,
60
60
  port: (argCmd === null || argCmd === void 0 ? void 0 : argCmd.port) || process.env.PORT || devServerOptions.port || 'auto',
61
- server: (argCmd === null || argCmd === void 0 ? void 0 : argCmd.http) ? 'https' : devServerOptions.server || 'http',
61
+ server: (argCmd === null || argCmd === void 0 ? void 0 : argCmd.https) ? 'https' : devServerOptions.server || 'http',
62
62
  host: (argCmd === null || argCmd === void 0 ? void 0 : argCmd.domain) || devServerOptions.host || 'localhost',
63
63
  });
64
64
  // 合并代理配置
@@ -22,10 +22,11 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
22
22
  var __importDefault = (this && this.__importDefault) || function (mod) {
23
23
  return (mod && mod.__esModule) ? mod : { "default": mod };
24
24
  };
25
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
25
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
26
26
  Object.defineProperty(exports, "__esModule", { value: true });
27
27
  var loader_1 = require("../../processEnv/loader");
28
28
  var manager_1 = require("../../processEnv/manager");
29
+ var deepMerge_1 = require("../../utils/deepMerge");
29
30
  var DonePlugin_1 = __importDefault(require("../plugins/DonePlugin"));
30
31
  var FileListPlugin_1 = __importDefault(require("../plugins/FileListPlugin"));
31
32
  var InjectScriptPlugin_1 = __importDefault(require("../plugins/InjectScriptPlugin"));
@@ -405,7 +406,7 @@ var config = {
405
406
  ], false).filter(Boolean),
406
407
  resolve: {
407
408
  modules: ['node_modules', path.resolve(__dirname, '../../../node_modules')],
408
- extensions: ['.jsx', '.js', '.tsx', '.ts', '.less', '.scss'],
409
+ extensions: ['.tsx', '.ts', '.jsx', '.js', '.less', '.scss'],
409
410
  alias: __assign({ '@': path.resolve(process.cwd(), './src'), react: path.resolve(process.cwd(), './node_modules/react') }, (_p = (_o = qtConfig === null || qtConfig === void 0 ? void 0 : qtConfig.webpackConfig) === null || _o === void 0 ? void 0 : _o.resolve) === null || _p === void 0 ? void 0 : _p.alias),
410
411
  },
411
412
  resolveLoader: {
@@ -413,7 +414,5 @@ var config = {
413
414
  },
414
415
  };
415
416
  // 合并 webpack 配置
416
- var finalConfig = __assign(__assign(__assign({}, config), (qtConfig.webpackConfig || {})), {
417
- // 确保某些配置不被覆盖
418
- entry: config.entry, output: __assign(__assign({}, config.output), (((_q = qtConfig.webpackConfig) === null || _q === void 0 ? void 0 : _q.output) || {})), module: __assign(__assign({}, config.module), { rules: __spreadArray(__spreadArray([], (((_r = config.module) === null || _r === void 0 ? void 0 : _r.rules) || []), true), (((_t = (_s = qtConfig.webpackConfig) === null || _s === void 0 ? void 0 : _s.module) === null || _t === void 0 ? void 0 : _t.rules) || []), true) }), plugins: __spreadArray(__spreadArray([], (config.plugins || []), true), (((_u = qtConfig.webpackConfig) === null || _u === void 0 ? void 0 : _u.plugins) || []), true) });
417
+ var finalConfig = (0, deepMerge_1.deepMerge)(config, qtConfig.webpackConfig || {});
419
418
  exports.default = finalConfig;
@@ -5,14 +5,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  var mini_css_extract_plugin_1 = __importDefault(require("mini-css-extract-plugin"));
7
7
  var path = require('path');
8
- var globAll = require('glob-all');
8
+ // const globAll = require('glob-all');
9
9
  var CompressionPlugin = require('compression-webpack-plugin');
10
10
  var merge = require('webpack-merge').merge;
11
11
  var baseConfig = require('./webpack.base').default;
12
12
  var CopyPlugin = require('copy-webpack-plugin');
13
13
  var CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
14
14
  var TerserPlugin = require('terser-webpack-plugin');
15
- var PurgeCSSPlugin = require('purgecss-webpack-plugin');
15
+ // const PurgeCSSPlugin = require('purgecss-webpack-plugin');
16
16
  exports.default = merge(baseConfig, {
17
17
  mode: 'production',
18
18
  plugins: [
@@ -30,16 +30,16 @@ exports.default = merge(baseConfig, {
30
30
  new mini_css_extract_plugin_1.default({
31
31
  filename: 'static/css/[name].[contenthash].css',
32
32
  }),
33
- new PurgeCSSPlugin({
34
- paths: globAll.sync([
35
- "".concat(path.join(process.cwd(), './src'), "/**/*.tsx"),
36
- "".concat(path.join(process.cwd(), './src'), "/**/*.jsx"),
37
- path.join(process.cwd(), './public/index.html'),
38
- ]),
39
- safelist: {
40
- standard: [/^ant-/],
41
- },
42
- }),
33
+ // new PurgeCSSPlugin({
34
+ // paths: globAll.sync([
35
+ // `${path.join(process.cwd(), './src')}/**/*.tsx`,
36
+ // `${path.join(process.cwd(), './src')}/**/*.jsx`,
37
+ // path.join(process.cwd(), './public/index.html'),
38
+ // ]),
39
+ // safelist: {
40
+ // standard: [/^ant-/],
41
+ // },
42
+ // }),
43
43
  new CompressionPlugin({
44
44
  test: /.(js|css)$/,
45
45
  filename: '[path][base].gz',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qingtian/qtcli",
3
- "version": "1.0.0",
3
+ "version": "1.0.2-beta.1",
4
4
  "description": "QTCli是一款基于node的前端工程化底座",
5
5
  "homepage": "https://gitee.com/fengrengame/qtnode#readme",
6
6
  "bugs": {
@@ -72,12 +72,12 @@
72
72
  "@babel/preset-env": "7.18.2",
73
73
  "@babel/preset-react": "7.17.12",
74
74
  "@babel/preset-typescript": "7.17.12",
75
+ "@commitlint/cli": "^19.8.0",
75
76
  "@pmmmwh/react-refresh-webpack-plugin": "^0.5.3",
76
77
  "@svgr/webpack": "^5.5.0",
77
78
  "@types/react": "18.0.12",
78
79
  "@types/react-dom": "18.0.5",
79
80
  "autoprefixer": "10.4.7",
80
- "babel-jest": "^27.4.2",
81
81
  "babel-loader": "^8.2.3",
82
82
  "babel-plugin-import": "1.13.8",
83
83
  "babel-plugin-named-asset-import": "^0.3.8",
@@ -110,12 +110,10 @@
110
110
  "fs-extra": "^10.0.0",
111
111
  "glob-all": "3.3.1",
112
112
  "html-webpack-plugin": "^5.5.0",
113
+ "html-webpack-tags-plugin": "^3.0.0",
113
114
  "husky": "8.0.3",
114
115
  "identity-obj-proxy": "^3.0.0",
115
116
  "inquirer": "8.0.0",
116
- "jest": "^27.4.3",
117
- "jest-resolve": "^27.4.2",
118
- "jest-watch-typeahead": "^1.0.0",
119
117
  "less": "4.1.3",
120
118
  "less-loader": "11.0.0",
121
119
  "lint-staged": "15.5.1",
@@ -162,10 +160,10 @@
162
160
  "webpack-manifest-plugin": "^4.0.2",
163
161
  "webpack-merge": "5.8.0",
164
162
  "workbox-webpack-plugin": "^6.4.1",
163
+ "xlsx": "^0.18.5",
165
164
  "yamljs": "0.3.0"
166
165
  },
167
166
  "devDependencies": {
168
- "@commitlint/cli": "^19.8.0",
169
167
  "@types/autoprefixer": "10.2.0",
170
168
  "@types/cli-progress": "3.11.5",
171
169
  "@types/colors": "1.2.1",
@@ -194,16 +192,10 @@
194
192
  "@types/webpack-dev-server": "4.7.2",
195
193
  "@types/webpack-merge": "5.0.0",
196
194
  "@types/yamljs": "0.2.34",
197
- "commitlint-config-ali": "^1.1.0",
198
- "eslint": "^8.56.0",
199
- "eslint-config-ali": "^15.1.0",
200
- "eslint-config-prettier": "^9.1.0",
201
- "eslint-plugin-prettier": "^5.3.1",
202
- "html-webpack-tags-plugin": "^3.0.0",
203
- "husky": "^8.0.3",
204
- "lint-staged": "^15.5.1",
205
- "prettier": "^3.5.3",
206
- "prettier-config-ali": "^1.3.4"
195
+ "babel-jest": "^27.4.2",
196
+ "jest": "^27.4.3",
197
+ "jest-resolve": "^27.4.2",
198
+ "jest-watch-typeahead": "^1.0.0"
207
199
  },
208
200
  "email": "296963166@qq.com"
209
201
  }