@gmcb/cli 0.4.2 → 0.4.3
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/CHANGELOG.md +10 -1
- package/README.md +22 -22
- package/lib/actions/build.js +21 -7
- package/lib/actions/config.d.ts +5 -0
- package/lib/actions/publish.js +5 -0
- package/package.json +2 -2
- package/schema.json +25 -1
- package/LICENSE +0 -21
package/CHANGELOG.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
## [0.4.
|
|
6
|
+
## [0.4.3](http://10.10.10.16/caoben/front-end/compare/@gmcb/cli@0.4.2...@gmcb/cli@0.4.3) (2026-06-10)
|
|
7
7
|
|
|
8
8
|
**Note:** Version bump only for package @gmcb/cli
|
|
9
9
|
|
|
@@ -12,6 +12,15 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
|
|
15
|
+
## [0.4.2](http://10.10.10.16/caoben/front-end/compare/@gmcb/cli@0.4.1...@gmcb/cli@0.4.2) (2026-06-03)
|
|
16
|
+
|
|
17
|
+
**Note:** Version bump only for package @gmcb/cli
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
15
24
|
## [0.4.1](http://10.10.10.16/caoben/front-end/compare/@gmcb/cli@0.3.4...@gmcb/cli@0.4.1) (2026-06-02)
|
|
16
25
|
|
|
17
26
|
**Note:** Version bump only for package @gmcb/cli
|
package/README.md
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
# @gmcb/cli
|
|
2
|
-
|
|
3
|
-
工茂草本前端命令行工具
|
|
4
|
-
|
|
5
|
-
## 安装
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
npm i @gmcb/cli -g
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## 命令总览
|
|
12
|
-
|
|
13
|
-
| 命令 | 描述 |
|
|
14
|
-
|---|---|
|
|
15
|
-
| `gmcb create` | 创建项目框架 |
|
|
16
|
-
| `gmcb dev` | 应用程序开发 |
|
|
17
|
-
| `gmcb build` | 应用程序构建 |
|
|
18
|
-
| `gmcb publish` | 应用程序发布 |
|
|
19
|
-
| `gmcb copy` | 复制资源到指定目录 |
|
|
20
|
-
| `gmcb config` | 配置管理 |
|
|
21
|
-
| `gmcb skill sync` | 同步技能到本地项目 |
|
|
22
|
-
| `gmcb skill list` | 列出当前项目所有技能 |
|
|
1
|
+
# @gmcb/cli
|
|
2
|
+
|
|
3
|
+
工茂草本前端命令行工具
|
|
4
|
+
|
|
5
|
+
## 安装
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm i @gmcb/cli -g
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## 命令总览
|
|
12
|
+
|
|
13
|
+
| 命令 | 描述 |
|
|
14
|
+
|---|---|
|
|
15
|
+
| `gmcb create` | 创建项目框架 |
|
|
16
|
+
| `gmcb dev` | 应用程序开发 |
|
|
17
|
+
| `gmcb build` | 应用程序构建 |
|
|
18
|
+
| `gmcb publish` | 应用程序发布 |
|
|
19
|
+
| `gmcb copy` | 复制资源到指定目录 |
|
|
20
|
+
| `gmcb config` | 配置管理 |
|
|
21
|
+
| `gmcb skill sync` | 同步技能到本地项目 |
|
|
22
|
+
| `gmcb skill list` | 列出当前项目所有技能 |
|
package/lib/actions/build.js
CHANGED
|
@@ -74,7 +74,10 @@ async function getCommands(...args) {
|
|
|
74
74
|
const currentName = (0, path_1.basename)(utils_1.COMMAND_PATH);
|
|
75
75
|
const projectName = opts.project || currentName;
|
|
76
76
|
if (opts.compiler === 'uni') {
|
|
77
|
-
if (projectName === currentName &&
|
|
77
|
+
if (projectName === currentName &&
|
|
78
|
+
utils_1.HAS_SRC &&
|
|
79
|
+
(!opts.platform?.startsWith('app') ||
|
|
80
|
+
(opts.platform === 'app' && (!opts.wgt || !opts.res || !opts.custom)))) {
|
|
78
81
|
commands = [...commands, bin, 'build -p', opts.platform];
|
|
79
82
|
}
|
|
80
83
|
else {
|
|
@@ -176,15 +179,25 @@ async function getCommands(...args) {
|
|
|
176
179
|
}
|
|
177
180
|
return commands;
|
|
178
181
|
}
|
|
179
|
-
async function createZip() {
|
|
182
|
+
async function createZip(compiler, platform) {
|
|
180
183
|
const spinner = (0, ora_1.default)(`正在生成资源文件...`).start();
|
|
181
184
|
await (0, delay_1.default)(1000);
|
|
182
185
|
const pkg = (0, fs_extra_1.readJsonSync)(utils_1.PACKAGE_PATH);
|
|
183
186
|
const manifest = (0, utils_1.readManifest)();
|
|
184
187
|
const zip = new adm_zip_1.default();
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
+
let zipConfig;
|
|
189
|
+
let defaultSource;
|
|
190
|
+
if (compiler === 'uni' && platform === 'h5') {
|
|
191
|
+
zipConfig = config.h5?.zip || {};
|
|
192
|
+
defaultSource = utils_1.HAS_SRC ? 'dist/build/h5' : 'unpackage/dist/build/web';
|
|
193
|
+
}
|
|
194
|
+
else {
|
|
195
|
+
zipConfig = config.app?.zip || {};
|
|
196
|
+
defaultSource = 'dist/win-unpacked/resources';
|
|
197
|
+
}
|
|
198
|
+
const name = zipConfig.name || `${manifest['appid'] || pkg.name}.zip`;
|
|
199
|
+
const source = (0, path_1.join)(utils_1.COMMAND_PATH, zipConfig.source ?? defaultSource);
|
|
200
|
+
const dest = (0, path_1.join)(utils_1.COMMAND_PATH, `${zipConfig.path ?? 'unpackage/release'}/${name}`);
|
|
188
201
|
if ((0, fs_1.existsSync)(dest)) {
|
|
189
202
|
(0, fs_1.unlinkSync)(dest);
|
|
190
203
|
}
|
|
@@ -207,8 +220,9 @@ async function default_1(...args) {
|
|
|
207
220
|
utils_1.log.error('检测到您的HbuilderX未启动或项目管理器中未发现构建项目,请检查后重试!');
|
|
208
221
|
}
|
|
209
222
|
}
|
|
210
|
-
if (opts.compiler === 'electron-vite' && opts.zip)
|
|
211
|
-
|
|
223
|
+
if ((opts.compiler === 'electron-vite' && opts.zip) ||
|
|
224
|
+
(opts.compiler === 'uni' && opts.platform === 'h5' && opts.zip)) {
|
|
225
|
+
await createZip(opts.compiler, opts.platform);
|
|
212
226
|
}
|
|
213
227
|
return commands;
|
|
214
228
|
}
|
package/lib/actions/config.d.ts
CHANGED
package/lib/actions/publish.js
CHANGED
|
@@ -135,6 +135,11 @@ async function default_1(...args) {
|
|
|
135
135
|
if (opts.platform?.startsWith('mp')) {
|
|
136
136
|
commands.push((0, path_1.join)(scriptPath, opts.platform));
|
|
137
137
|
}
|
|
138
|
+
else if (opts.platform === 'h5') {
|
|
139
|
+
if (opts.zip) {
|
|
140
|
+
commands.push((0, path_1.join)(scriptPath, 'h5-zip'));
|
|
141
|
+
}
|
|
142
|
+
}
|
|
138
143
|
else if (opts.platform?.startsWith('app')) {
|
|
139
144
|
if (opts.wgt) {
|
|
140
145
|
commands.push((0, path_1.join)(scriptPath, 'app-wgt'));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gmcb/cli",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.3",
|
|
4
4
|
"description": "工茂草本前端命令行工具",
|
|
5
5
|
"author": "yinjiazeng@163.com",
|
|
6
6
|
"license": "MIT",
|
|
@@ -54,5 +54,5 @@
|
|
|
54
54
|
"@types/rimraf": "^4.0.5",
|
|
55
55
|
"@types/user-home": "^2.0.2"
|
|
56
56
|
},
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "5b19a61c4b70d57066625722469020b1e424395e"
|
|
58
58
|
}
|
package/schema.json
CHANGED
|
@@ -220,7 +220,7 @@
|
|
|
220
220
|
},
|
|
221
221
|
"zip": {
|
|
222
222
|
"type": "object",
|
|
223
|
-
"description": "
|
|
223
|
+
"description": "桌面应用热更新资源配置,仅在compiler为electron-vite且开启--zip时生效",
|
|
224
224
|
"properties": {
|
|
225
225
|
"name": {
|
|
226
226
|
"type": "string",
|
|
@@ -297,6 +297,30 @@
|
|
|
297
297
|
}
|
|
298
298
|
}
|
|
299
299
|
},
|
|
300
|
+
"h5": {
|
|
301
|
+
"type": "object",
|
|
302
|
+
"description": "h5配置",
|
|
303
|
+
"properties": {
|
|
304
|
+
"zip": {
|
|
305
|
+
"type": "object",
|
|
306
|
+
"description": "h5打包资源配置,仅在compiler为uni且platform为h5且开启--zip时生效",
|
|
307
|
+
"properties": {
|
|
308
|
+
"name": {
|
|
309
|
+
"type": "string",
|
|
310
|
+
"description": "导出文件名称,例如app.zip,默认为[appid].zip或[name].zip"
|
|
311
|
+
},
|
|
312
|
+
"path": {
|
|
313
|
+
"type": "string",
|
|
314
|
+
"description": "导出路径,默认unpackage/release"
|
|
315
|
+
},
|
|
316
|
+
"source": {
|
|
317
|
+
"type": "string",
|
|
318
|
+
"description": "资源路径,默认dist/build/h5(有src目录)或unpackage/dist/build/web(无src目录)"
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
},
|
|
300
324
|
"mp": {
|
|
301
325
|
"type": "object",
|
|
302
326
|
"description": "小程序配置",
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2024 aniu
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|