@gmcb/cli 0.9.1 → 0.9.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 CHANGED
@@ -3,270 +3,290 @@
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.9.1](http://10.10.10.16/caoben/front-end/compare/@gmcb/cli@0.9.0...@gmcb/cli@0.9.1) (2026-10-29)
6
+ ## [0.9.3](http://10.10.10.16/caoben/front-end-tools/compare/@gmcb/cli@0.9.2...@gmcb/cli@0.9.3) (2026-11-04)
7
7
 
8
- **Note:** Version bump only for package @gmcb/cli
9
-
10
-
11
-
12
-
13
-
14
- # [0.9.0](http://10.10.10.16/caoben/front-end/compare/@gmcb/cli@0.8.13...@gmcb/cli@0.9.0) (2026-10-29)
15
-
16
-
17
- ### Features
18
-
19
- * 增加splash命令,可配置app启动图 ([74f06b9](http://10.10.10.16/caoben/front-end/commits/74f06b98216ae9fa9f567abb96909ccb766f1240))
20
-
21
-
22
-
23
-
24
-
25
- ## [0.8.13](http://10.10.10.16/caoben/front-end/compare/@gmcb/cli@0.8.12...@gmcb/cli@0.8.13) (2026-08-17)
26
-
27
- **Note:** Version bump only for package @gmcb/cli
28
-
29
-
30
-
31
-
32
-
33
- ## [0.8.12](http://10.10.10.16/caoben/front-end/compare/@gmcb/cli@0.8.11...@gmcb/cli@0.8.12) (2026-08-17)
34
-
35
- **Note:** Version bump only for package @gmcb/cli
36
-
37
-
38
-
39
-
40
-
41
- ## [0.8.11](http://10.10.10.16/caoben/front-end/compare/@gmcb/cli@0.8.10...@gmcb/cli@0.8.11) (2026-07-16)
42
-
43
- **Note:** Version bump only for package @gmcb/cli
44
-
45
-
46
-
47
-
48
-
49
- ## [0.8.10](http://10.10.10.16/caoben/front-end/compare/@gmcb/cli@0.8.9...@gmcb/cli@0.8.10) (2026-07-16)
50
-
51
- **Note:** Version bump only for package @gmcb/cli
52
-
53
-
54
-
55
-
56
-
57
- ## [0.8.9](http://10.10.10.16/caoben/front-end/compare/@gmcb/cli@0.8.8...@gmcb/cli@0.8.9) (2026-07-16)
58
-
59
- **Note:** Version bump only for package @gmcb/cli
60
-
61
-
62
-
63
-
64
-
65
- ## [0.8.8](http://10.10.10.16/caoben/front-end/compare/@gmcb/cli@0.8.7...@gmcb/cli@0.8.8) (2026-07-16)
66
-
67
- **Note:** Version bump only for package @gmcb/cli
68
-
69
-
70
-
71
-
72
-
73
- ## [0.8.7](http://10.10.10.16/caoben/front-end/compare/@gmcb/cli@0.8.6...@gmcb/cli@0.8.7) (2026-07-15)
74
-
75
- **Note:** Version bump only for package @gmcb/cli
76
-
77
-
78
-
79
-
80
-
81
- ## [0.8.6](http://10.10.10.16/caoben/front-end/compare/@gmcb/cli@0.8.5...@gmcb/cli@0.8.6) (2026-07-15)
82
-
83
- **Note:** Version bump only for package @gmcb/cli
84
-
85
-
86
-
87
-
88
-
89
- ## [0.8.5](http://10.10.10.16/caoben/front-end/compare/@gmcb/cli@0.8.4...@gmcb/cli@0.8.5) (2026-07-15)
90
-
91
- **Note:** Version bump only for package @gmcb/cli
92
-
93
-
94
-
95
-
96
-
97
- ## [0.8.4](http://10.10.10.16/caoben/front-end/compare/@gmcb/cli@0.8.3...@gmcb/cli@0.8.4) (2026-07-15)
98
-
99
- **Note:** Version bump only for package @gmcb/cli
100
-
101
-
102
-
103
-
104
-
105
- ## [0.8.3](http://10.10.10.16/caoben/front-end/compare/@gmcb/cli@0.8.2...@gmcb/cli@0.8.3) (2026-07-15)
106
-
107
- **Note:** Version bump only for package @gmcb/cli
108
-
109
-
110
-
111
-
112
-
113
- ## [0.8.2](http://10.10.10.16/caoben/front-end/compare/@gmcb/cli@0.8.1...@gmcb/cli@0.8.2) (2026-07-15)
114
-
115
- **Note:** Version bump only for package @gmcb/cli
116
-
117
-
118
-
119
-
120
-
121
- ## [0.8.1](http://10.10.10.16/caoben/front-end/compare/@gmcb/cli@0.8.0...@gmcb/cli@0.8.1) (2026-07-14)
122
-
123
- **Note:** Version bump only for package @gmcb/cli
124
-
125
-
126
-
127
-
128
-
129
- # [0.8.0](http://10.10.10.16/caoben/front-end/compare/@gmcb/cli@0.7.12...@gmcb/cli@0.8.0) (2026-07-14)
130
-
131
-
132
- ### Features
133
-
134
- * 增加icon命令 ([243a52a](http://10.10.10.16/caoben/front-end/commits/243a52a05d4b35b5d73419d4b5e29ea48f242493))
135
-
136
-
137
-
138
-
139
-
140
- ## [0.7.12](http://10.10.10.16/caoben/front-end/compare/@gmcb/cli@0.7.11...@gmcb/cli@0.7.12) (2026-07-14)
141
8
 
142
- **Note:** Version bump only for package @gmcb/cli
143
-
144
-
145
-
146
-
147
-
148
- ## [0.7.11](http://10.10.10.16/caoben/front-end/compare/@gmcb/cli@0.7.10...@gmcb/cli@0.7.11) (2026-07-13)
149
-
150
- **Note:** Version bump only for package @gmcb/cli
151
-
152
-
153
-
154
-
155
-
156
- ## [0.7.10](http://10.10.10.16/caoben/front-end/compare/@gmcb/cli@0.7.9...@gmcb/cli@0.7.10) (2026-07-12)
157
-
158
- **Note:** Version bump only for package @gmcb/cli
159
-
160
-
161
-
162
-
163
-
164
- ## [0.7.9](http://10.10.10.16/caoben/front-end/compare/@gmcb/cli@0.7.7...@gmcb/cli@0.7.9) (2026-07-12)
165
-
166
- **Note:** Version bump only for package @gmcb/cli
167
-
168
-
169
-
170
-
171
-
172
- ## [0.7.8](http://10.10.10.16/caoben/front-end/compare/@gmcb/cli@0.7.7...@gmcb/cli@0.7.8) (2026-07-09)
173
-
174
- **Note:** Version bump only for package @gmcb/cli
175
-
176
-
177
-
178
-
179
-
180
- ## [0.7.7](http://10.10.10.16/caoben/front-end/compare/@gmcb/cli@0.7.6...@gmcb/cli@0.7.7) (2026-07-09)
181
-
182
- **Note:** Version bump only for package @gmcb/cli
183
-
184
-
185
-
186
-
187
-
188
- ## [0.7.6](http://10.10.10.16/caoben/front-end/compare/@gmcb/cli@0.7.5...@gmcb/cli@0.7.6) (2026-07-09)
189
-
190
- **Note:** Version bump only for package @gmcb/cli
191
-
192
-
193
-
194
-
195
-
196
- ## [0.7.5](http://10.10.10.16/caoben/front-end/compare/@gmcb/cli@0.7.4...@gmcb/cli@0.7.5) (2026-07-09)
197
-
198
- **Note:** Version bump only for package @gmcb/cli
199
-
200
-
201
-
202
-
203
-
204
- ## [0.7.4](http://10.10.10.16/caoben/front-end/compare/@gmcb/cli@0.7.3...@gmcb/cli@0.7.4) (2026-07-09)
205
-
206
- **Note:** Version bump only for package @gmcb/cli
9
+ ### Bug Fixes
207
10
 
208
-
209
-
210
-
211
-
212
- ## [0.7.3](http://10.10.10.16/caoben/front-end/compare/@gmcb/cli@0.7.2...@gmcb/cli@0.7.3) (2026-07-09)
213
-
214
- **Note:** Version bump only for package @gmcb/cli
215
-
216
-
217
-
218
-
219
-
220
- ## [0.7.2](http://10.10.10.16/caoben/front-end/compare/@gmcb/cli@0.7.1...@gmcb/cli@0.7.2) (2026-07-07)
221
-
222
- **Note:** Version bump only for package @gmcb/cli
223
-
224
-
225
-
226
-
227
-
228
- ## [0.7.1](http://10.10.10.16/caoben/front-end/compare/@gmcb/cli@0.7.0...@gmcb/cli@0.7.1) (2026-07-06)
229
-
230
- **Note:** Version bump only for package @gmcb/cli
231
-
232
-
233
-
234
-
235
-
236
- # [0.7.0](http://10.10.10.16/caoben/front-end/compare/@gmcb/cli@0.5.5...@gmcb/cli@0.7.0) (2026-07-06)
237
-
238
-
239
- ### Features
240
-
241
- * 优化cli ([676ac43](http://10.10.10.16/caoben/front-end/commits/676ac4381ca645ef232936b86e3b77124337a03c))
242
-
243
-
244
-
245
-
246
-
247
- ## [0.6.4](http://10.10.10.16/caoben/front-end/compare/@gmcb/cli@0.5.5...@gmcb/cli@0.6.4) (2026-07-06)
248
-
249
-
250
- ### Features
251
-
252
- * 优化cli ([676ac43](http://10.10.10.16/caoben/front-end/commits/676ac4381ca645ef232936b86e3b77124337a03c))
253
-
254
-
255
-
256
-
257
-
258
- ## [0.6.3](http://10.10.10.16/caoben/front-end/compare/@gmcb/cli@0.5.5...@gmcb/cli@0.6.3) (2026-07-06)
259
-
260
-
261
- ### Features
262
-
263
- * 优化cli ([676ac43](http://10.10.10.16/caoben/front-end/commits/676ac4381ca645ef232936b86e3b77124337a03c))
11
+ * 合并 CLI 调整(image/config 命令、gradlew 构建流程与 uni-app x 路由) ([4e1734b](http://10.10.10.16/caoben/front-end-tools/commits/4e1734b7ae1ec0c3f2a910c27d9220f1ea7010ec))
264
12
 
265
13
 
266
14
 
267
15
 
268
16
 
269
17
 
18
+ ## [0.9.2](http://10.10.10.16/caoben/front-end-tools/compare/@gmcb/cli@0.9.1...@gmcb/cli@0.9.2) (2026-11-02)
19
+
20
+ **Note:** Version bump only for package @gmcb/cli
21
+
22
+
23
+
24
+
25
+
26
+ ## [0.9.1](http://10.10.10.16/caoben/front-end/compare/@gmcb/cli@0.9.0...@gmcb/cli@0.9.1) (2026-10-29)
27
+
28
+ **Note:** Version bump only for package @gmcb/cli
29
+
30
+
31
+
32
+
33
+
34
+ # [0.9.0](http://10.10.10.16/caoben/front-end/compare/@gmcb/cli@0.8.13...@gmcb/cli@0.9.0) (2026-10-29)
35
+
36
+
37
+ ### Features
38
+
39
+ * 增加splash命令,可配置app启动图 ([74f06b9](http://10.10.10.16/caoben/front-end/commits/74f06b98216ae9fa9f567abb96909ccb766f1240))
40
+
41
+
42
+
43
+
44
+
45
+ ## [0.8.13](http://10.10.10.16/caoben/front-end/compare/@gmcb/cli@0.8.12...@gmcb/cli@0.8.13) (2026-08-17)
46
+
47
+ **Note:** Version bump only for package @gmcb/cli
48
+
49
+
50
+
51
+
52
+
53
+ ## [0.8.12](http://10.10.10.16/caoben/front-end/compare/@gmcb/cli@0.8.11...@gmcb/cli@0.8.12) (2026-08-17)
54
+
55
+ **Note:** Version bump only for package @gmcb/cli
56
+
57
+
58
+
59
+
60
+
61
+ ## [0.8.11](http://10.10.10.16/caoben/front-end/compare/@gmcb/cli@0.8.10...@gmcb/cli@0.8.11) (2026-07-16)
62
+
63
+ **Note:** Version bump only for package @gmcb/cli
64
+
65
+
66
+
67
+
68
+
69
+ ## [0.8.10](http://10.10.10.16/caoben/front-end/compare/@gmcb/cli@0.8.9...@gmcb/cli@0.8.10) (2026-07-16)
70
+
71
+ **Note:** Version bump only for package @gmcb/cli
72
+
73
+
74
+
75
+
76
+
77
+ ## [0.8.9](http://10.10.10.16/caoben/front-end/compare/@gmcb/cli@0.8.8...@gmcb/cli@0.8.9) (2026-07-16)
78
+
79
+ **Note:** Version bump only for package @gmcb/cli
80
+
81
+
82
+
83
+
84
+
85
+ ## [0.8.8](http://10.10.10.16/caoben/front-end/compare/@gmcb/cli@0.8.7...@gmcb/cli@0.8.8) (2026-07-16)
86
+
87
+ **Note:** Version bump only for package @gmcb/cli
88
+
89
+
90
+
91
+
92
+
93
+ ## [0.8.7](http://10.10.10.16/caoben/front-end/compare/@gmcb/cli@0.8.6...@gmcb/cli@0.8.7) (2026-07-15)
94
+
95
+ **Note:** Version bump only for package @gmcb/cli
96
+
97
+
98
+
99
+
100
+
101
+ ## [0.8.6](http://10.10.10.16/caoben/front-end/compare/@gmcb/cli@0.8.5...@gmcb/cli@0.8.6) (2026-07-15)
102
+
103
+ **Note:** Version bump only for package @gmcb/cli
104
+
105
+
106
+
107
+
108
+
109
+ ## [0.8.5](http://10.10.10.16/caoben/front-end/compare/@gmcb/cli@0.8.4...@gmcb/cli@0.8.5) (2026-07-15)
110
+
111
+ **Note:** Version bump only for package @gmcb/cli
112
+
113
+
114
+
115
+
116
+
117
+ ## [0.8.4](http://10.10.10.16/caoben/front-end/compare/@gmcb/cli@0.8.3...@gmcb/cli@0.8.4) (2026-07-15)
118
+
119
+ **Note:** Version bump only for package @gmcb/cli
120
+
121
+
122
+
123
+
124
+
125
+ ## [0.8.3](http://10.10.10.16/caoben/front-end/compare/@gmcb/cli@0.8.2...@gmcb/cli@0.8.3) (2026-07-15)
126
+
127
+ **Note:** Version bump only for package @gmcb/cli
128
+
129
+
130
+
131
+
132
+
133
+ ## [0.8.2](http://10.10.10.16/caoben/front-end/compare/@gmcb/cli@0.8.1...@gmcb/cli@0.8.2) (2026-07-15)
134
+
135
+ **Note:** Version bump only for package @gmcb/cli
136
+
137
+
138
+
139
+
140
+
141
+ ## [0.8.1](http://10.10.10.16/caoben/front-end/compare/@gmcb/cli@0.8.0...@gmcb/cli@0.8.1) (2026-07-14)
142
+
143
+ **Note:** Version bump only for package @gmcb/cli
144
+
145
+
146
+
147
+
148
+
149
+ # [0.8.0](http://10.10.10.16/caoben/front-end/compare/@gmcb/cli@0.7.12...@gmcb/cli@0.8.0) (2026-07-14)
150
+
151
+
152
+ ### Features
153
+
154
+ * 增加icon命令 ([243a52a](http://10.10.10.16/caoben/front-end/commits/243a52a05d4b35b5d73419d4b5e29ea48f242493))
155
+
156
+
157
+
158
+
159
+
160
+ ## [0.7.12](http://10.10.10.16/caoben/front-end/compare/@gmcb/cli@0.7.11...@gmcb/cli@0.7.12) (2026-07-14)
161
+
162
+ **Note:** Version bump only for package @gmcb/cli
163
+
164
+
165
+
166
+
167
+
168
+ ## [0.7.11](http://10.10.10.16/caoben/front-end/compare/@gmcb/cli@0.7.10...@gmcb/cli@0.7.11) (2026-07-13)
169
+
170
+ **Note:** Version bump only for package @gmcb/cli
171
+
172
+
173
+
174
+
175
+
176
+ ## [0.7.10](http://10.10.10.16/caoben/front-end/compare/@gmcb/cli@0.7.9...@gmcb/cli@0.7.10) (2026-07-12)
177
+
178
+ **Note:** Version bump only for package @gmcb/cli
179
+
180
+
181
+
182
+
183
+
184
+ ## [0.7.9](http://10.10.10.16/caoben/front-end/compare/@gmcb/cli@0.7.7...@gmcb/cli@0.7.9) (2026-07-12)
185
+
186
+ **Note:** Version bump only for package @gmcb/cli
187
+
188
+
189
+
190
+
191
+
192
+ ## [0.7.8](http://10.10.10.16/caoben/front-end/compare/@gmcb/cli@0.7.7...@gmcb/cli@0.7.8) (2026-07-09)
193
+
194
+ **Note:** Version bump only for package @gmcb/cli
195
+
196
+
197
+
198
+
199
+
200
+ ## [0.7.7](http://10.10.10.16/caoben/front-end/compare/@gmcb/cli@0.7.6...@gmcb/cli@0.7.7) (2026-07-09)
201
+
202
+ **Note:** Version bump only for package @gmcb/cli
203
+
204
+
205
+
206
+
207
+
208
+ ## [0.7.6](http://10.10.10.16/caoben/front-end/compare/@gmcb/cli@0.7.5...@gmcb/cli@0.7.6) (2026-07-09)
209
+
210
+ **Note:** Version bump only for package @gmcb/cli
211
+
212
+
213
+
214
+
215
+
216
+ ## [0.7.5](http://10.10.10.16/caoben/front-end/compare/@gmcb/cli@0.7.4...@gmcb/cli@0.7.5) (2026-07-09)
217
+
218
+ **Note:** Version bump only for package @gmcb/cli
219
+
220
+
221
+
222
+
223
+
224
+ ## [0.7.4](http://10.10.10.16/caoben/front-end/compare/@gmcb/cli@0.7.3...@gmcb/cli@0.7.4) (2026-07-09)
225
+
226
+ **Note:** Version bump only for package @gmcb/cli
227
+
228
+
229
+
230
+
231
+
232
+ ## [0.7.3](http://10.10.10.16/caoben/front-end/compare/@gmcb/cli@0.7.2...@gmcb/cli@0.7.3) (2026-07-09)
233
+
234
+ **Note:** Version bump only for package @gmcb/cli
235
+
236
+
237
+
238
+
239
+
240
+ ## [0.7.2](http://10.10.10.16/caoben/front-end/compare/@gmcb/cli@0.7.1...@gmcb/cli@0.7.2) (2026-07-07)
241
+
242
+ **Note:** Version bump only for package @gmcb/cli
243
+
244
+
245
+
246
+
247
+
248
+ ## [0.7.1](http://10.10.10.16/caoben/front-end/compare/@gmcb/cli@0.7.0...@gmcb/cli@0.7.1) (2026-07-06)
249
+
250
+ **Note:** Version bump only for package @gmcb/cli
251
+
252
+
253
+
254
+
255
+
256
+ # [0.7.0](http://10.10.10.16/caoben/front-end/compare/@gmcb/cli@0.5.5...@gmcb/cli@0.7.0) (2026-07-06)
257
+
258
+
259
+ ### Features
260
+
261
+ * 优化cli ([676ac43](http://10.10.10.16/caoben/front-end/commits/676ac4381ca645ef232936b86e3b77124337a03c))
262
+
263
+
264
+
265
+
266
+
267
+ ## [0.6.4](http://10.10.10.16/caoben/front-end/compare/@gmcb/cli@0.5.5...@gmcb/cli@0.6.4) (2026-07-06)
268
+
269
+
270
+ ### Features
271
+
272
+ * 优化cli ([676ac43](http://10.10.10.16/caoben/front-end/commits/676ac4381ca645ef232936b86e3b77124337a03c))
273
+
274
+
275
+
276
+
277
+
278
+ ## [0.6.3](http://10.10.10.16/caoben/front-end/compare/@gmcb/cli@0.5.5...@gmcb/cli@0.6.3) (2026-07-06)
279
+
280
+
281
+ ### Features
282
+
283
+ * 优化cli ([676ac43](http://10.10.10.16/caoben/front-end/commits/676ac4381ca645ef232936b86e3b77124337a03c))
284
+
285
+
286
+
287
+
288
+
289
+
270
290
  ## [0.6.2](http://10.10.10.16/caoben/front-end/compare/@gmcb/cli@0.5.5...@gmcb/cli@0.6.2) (2026-07-05)
271
291
 
272
292
 
package/LICENSE ADDED
@@ -0,0 +1,21 @@
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.
package/README.md CHANGED
@@ -29,16 +29,17 @@ npm i @gmcb/cli -g
29
29
 
30
30
  | 选项 | 描述 |
31
31
  |---|---|
32
- | `-p, --platform` | 编译平台,默认 h5 |
32
+ | `-p, --platform` | 编译平台,默认 h5(uni-app x 可用 web,等价 h5) |
33
33
  | `-c, --compiler` | 构建工具,默认 uni |
34
34
  | `-b, --branch` | Git 分支名称 |
35
35
  | `-e, --env` | 构建环境,默认 prod |
36
36
  | `--wgt` | 构建移动应用热更新资源 |
37
+ | `--res` | 构建移动应用本地资源(uni-app x 导出 appResource) |
37
38
  | `--zip` | 构建桌面应用热更新资源 |
38
39
  | `--apk` | 构建 Android 应用 |
39
40
  | `--nobuild` | 跳过构建步骤,仅执行后续流程(打包、远程资源拉取等) |
40
41
 
41
- 使用 `--wgt` 构建移动应用热更新资源时,会先通过 vite/uni 正常构建 app,再将构建产物(`dist/build/app` 或 `unpackage/dist/build/app-plus`)打包为 `.wgt` 文件,输出路径默认为 `unpackage/release`。
42
+ 使用 `--wgt` 构建移动应用热更新资源时,经典 uni-app 会先通过 vite/uni 正常构建 app,再将构建产物(`dist/build/app` 或 `unpackage/dist/build/app-plus`)打包为 `.wgt` 文件,输出路径默认为 `unpackage/release`;uni-app x 的 wgt 由 HBuilderX 直接导出(见「uni-app x 兼容」)。
42
43
 
43
44
  `uni.build.json` 中可通过 `app.wgt` 配置导出文件名和路径:
44
45
 
@@ -96,6 +97,74 @@ gmcb publish -p app --wgt -a
96
97
  - `pub`:基础发布配置(brand、type、status、platform、path)
97
98
  - `publish`:魔方发布配置(updateType、versionDesc、publishType、platform、path),配置后走魔方发布流程
98
99
 
100
+ ## uni-app x 兼容
101
+
102
+ `gmcb build` / `gmcb publish` 兼容 uni-app x 工程(`src` 布局与 HBuilderX 根目录布局均支持);**经典 uni-app 工程(无论有无 `src`)的打包逻辑保持不变**。uni-app x 的 App 平台一律由 HBuilderX 编译,H5 / 微信小程序保持原有的布局分流。
103
+
104
+ ### 识别与前提
105
+
106
+ - `src/manifest.json` 或项目根 `manifest.json` 含 `uni-app-x` 字段(如 `"uni-app-x": {}`)即识别为 uni-app x 工程
107
+ - **App 平台(`app` / `app-android` / `app-ios` / `app-harmony`)始终使用 `cli.hbuilderx` 编译**:无论工程有没有 `src` 目录,都走 `publish ... --type appResource|wgt` / `pack ...`,不需要 `--pack`
108
+ - H5 / 微信小程序按布局分流:含 `src` 走本地 npm CLI(`uni build`);无 `src` 走 `cli.hbuilderx publish ...`(传 `--pack` 或 `-P` 时也走 HBuilderX)
109
+ - HBuilderX 4.67+(蒸汽模式 wgt 需要 5.33+),需启动 HBuilderX 且项目已导入,CLI 路径用 `gmcb config --cli.hbuilderx <cli-path>` 配置;`src` 布局工程需在 HBuilderX 中被识别为 uni-app x(如 App 导出提示“不支持”,可在 HBuilderX 中调整项目类型)
110
+ - `-p web` 是 `-p h5` 的别名(仅 uni-app x)
111
+
112
+ ### 平台与命令行映射(HBuilderX 编译分支)
113
+
114
+ 下表为 App 平台(有无 `src` 均如此)以及无 `src`(或传 `--pack` / `-P`)时 H5 / 微信小程序实际执行的 HBuilderX 命令:
115
+
116
+ | `-p` 平台 | 附加参数 | 执行的 HBuilderX 命令 | 输出目录 |
117
+ |---|---|---|---|
118
+ | `h5` / `web` | - | `publish web` | `unpackage/dist/build/web` |
119
+ | `mp-weixin` | - | `publish mp-weixin [--appid ...]` | `unpackage/dist/build/mp-weixin` |
120
+ | `app` / `app-android` / `app-ios` | `--res` | `publish <app\|app-android\|app-ios> --type appResource` | `unpackage/resources/app-*`(`-p app` 同时导出 app-android、app-ios) |
121
+ | `app` / `app-android` / `app-ios` | `--wgt` | `publish <target> --type wgt` | `unpackage/release/<平台>/<AppID>.wgt`(平台为 app-android / app-ios,`-p app` 导出两个平台) |
122
+ | `app` / `app-android` / `app-ios` | 无 | `pack --platform android,ios\|android\|ios` | 云端打包 |
123
+ | `app-harmony` | `--res` / `--wgt` / 无 | `publish app-harmony --type appResource\|wgt` / `pack app-harmony` | `unpackage/resources/app-harmony` 等 |
124
+
125
+ - uni-app x 的 `--wgt` 仅蒸汽模式(`manifest.json` 的 `"uni-app-x": { "vapor": true }`)支持,由 HBuilderX 校验
126
+ - `--res` 产物结构随编译模式不同:VDOM 模式包含 `uniappx/app-android/src/**/*.kt` 等页面 Kotlin 源码;蒸汽模式(vapor)为 `__UNI__xxx/www/bytes/**/*.bytes` + `app-service.js`,不含 Kotlin 源码
127
+ - `--wgt` 产物按平台分子目录(`unpackage/release/app-android/<AppID>.wgt`、`app-ios/<AppID>.wgt`);`gmcb publish --wgt` 上传时可在 `uni.build.json` 的 `app.wgt.path` / `app.wgt.name` 指向对应平台目录与文件名(一次一个平台),或直接手动上传
128
+ - `mp-weixin` 的 `appid` 取 `manifest.json` 的 `mp-weixin.appid`,有值时才传 `--appid`;appid 为空时仍可编译出产物,但 HBuilderX 会尝试打开微信开发者工具并提示 appid 不存在,配置 appid 后即可正常使用;发布上传时为空会给出明确错误
129
+ - 云打包的证书/包名等配置与经典 uni-app 相同(`uni.build.json` 的 `app.android` / `app.ios`)
130
+ - 含 `src` 的工程执行上表 App 命令时会自动走 HBuilderX(`src` 布局的 H5 / `mp-weixin` 仍为本地 `uni build`,不会走 HBuilderX)
131
+ - 完整示例见 `examples/uniapp-x`(`src` 布局的蒸汽模式工程),可直接验证下列命令
132
+
133
+ ### 无 package.json 的工程
134
+
135
+ uni-app x 的无 `src` 布局(HBuilderX 工程)通常没有 `package.json`,`src` 布局工程通常有:
136
+
137
+ - `--latest` 从 `manifest.json` 读取并回写 `versionName` / `versionCode`,找不到 `appid` 时跳过同步
138
+ - `gmcb publish` 检测不到 `package.json` 时跳过依赖安装并提示,构建命令也不再依赖 `cross-env`
139
+ - 有 `package.json` 时保留原有的 `cross-env NODE_ENV=production BUILD_ENV=<env>` 前缀(与 npm script 用法一致)
140
+
141
+ 示例(完整可运行示例见 `examples/uniapp-x`,以下 App 命令在含 `src` 的工程中同样会自动调用 `cli.hbuilderx`,需先导入 HBuilderX 并配置 CLI 路径):
142
+
143
+ ```bash
144
+ # H5 / web
145
+ gmcb build -p h5
146
+ gmcb build -p web
147
+
148
+ # App 本地打包资源(-p app 同时导出 android/ios;app-android 只导出 Android)
149
+ gmcb build -p app --res
150
+ gmcb build -p app-android --res
151
+
152
+ # 蒸汽模式 wgt(产物在 unpackage/release/app-android、app-ios 平台子目录)
153
+ gmcb build -p app-android --wgt
154
+
155
+ # H5 资源 zip(unpackage/release/<AppID>.zip)
156
+ gmcb build -p h5 --zip
157
+
158
+ # App 云打包
159
+ gmcb build -p app-android -e prod
160
+
161
+ # 微信小程序
162
+ gmcb build -p mp-weixin
163
+
164
+ # 鸿蒙本地打包
165
+ gmcb build -p app-harmony
166
+ ```
167
+
99
168
  ## `gmcb icon`
100
169
 
101
170
  根据源图片生成带圆角的应用图标,可选输出 ICO 文件。
@@ -74,14 +74,20 @@ async function restoreLocalResources(restore) {
74
74
  }
75
75
  async function syncLatestVersion() {
76
76
  const spinner = (0, ora_1.default)('正在获取最新版本数据...').start();
77
- const pkg = (0, fs_extra_1.readJsonSync)(utils_1.PACKAGE_PATH);
78
- const appId = pkg.appId;
77
+ const hasPackage = (0, fs_1.existsSync)(utils_1.PACKAGE_PATH);
78
+ const pkg = hasPackage ? (0, fs_extra_1.readJsonSync)(utils_1.PACKAGE_PATH) : {};
79
+ const manifest = (0, utils_1.readManifest)();
80
+ const appId = pkg.appId || ((0, utils_1.isUniappXManifest)(manifest) ? manifest.appid : undefined);
81
+ if (!appId) {
82
+ spinner.warn('未在 package.json 或 manifest.json 中找到 appId/appid,跳过版本号同步');
83
+ return;
84
+ }
79
85
  const { versionName, versionCode, updateMode } = await (0, apis_1.fetchLatestVersion)({
80
86
  appId,
81
87
  platform: config_1.CONFIG_DATA.publish?.platform,
82
88
  publishType: config_1.CONFIG_DATA.publish?.publishType,
83
89
  });
84
- if (updateMode) {
90
+ if (updateMode && config_1.CONFIG_DATA.publish) {
85
91
  config_1.CONFIG_DATA.publish.updateMode = updateMode;
86
92
  }
87
93
  if (versionName && versionCode) {
@@ -95,7 +101,7 @@ async function syncLatestVersion() {
95
101
  (0, fs_1.writeFileSync)(utils_1.MAINFEST_PATH, content);
96
102
  }
97
103
  }
98
- else {
104
+ else if (hasPackage) {
99
105
  const localVersionCode = Number(pkg.versionCode || 0);
100
106
  if (localVersionCode < versionCode) {
101
107
  let pkgContent = (0, fs_1.readFileSync)(utils_1.PACKAGE_PATH, 'utf-8');
@@ -105,11 +111,45 @@ async function syncLatestVersion() {
105
111
  (0, fs_1.writeFileSync)(utils_1.PACKAGE_PATH, pkgContent);
106
112
  }
107
113
  }
114
+ else {
115
+ utils_1.log.warning('未找到 manifest.json 或 package.json,跳过版本号同步');
116
+ }
108
117
  }
109
118
  spinner.stop();
110
119
  }
120
+ /**
121
+ * 归一化 wgt 导出参数(uni-app x 新分支使用):正确识别 --path,保证只出现一次
122
+ */
123
+ function prepareWgtFlags(wgtFlags) {
124
+ const flags = [...wgtFlags];
125
+ const index = flags.findIndex((item) => item === '--path' || item.startsWith('--path '));
126
+ let dist;
127
+ if (index === -1) {
128
+ dist = (0, path_1.resolve)('unpackage/release');
129
+ flags.push('--path', dist);
130
+ }
131
+ else if (flags[index] === '--path') {
132
+ dist = flags[index + 1] || (0, path_1.resolve)('unpackage/release');
133
+ }
134
+ else {
135
+ dist = flags[index].slice('--path '.length);
136
+ }
137
+ (0, fs_extra_1.ensureDirSync)(dist);
138
+ const manifest = (0, utils_1.readManifest)();
139
+ if (manifest.appid) {
140
+ (0, fs_extra_1.removeSync)((0, path_1.join)(dist, `${manifest.appid}.wgt`));
141
+ }
142
+ return { flags, dist };
143
+ }
111
144
  async function getCommands(...args) {
112
145
  const opts = args[0];
146
+ const isUniappX = (0, utils_1.isUniappXManifest)();
147
+ if (isUniappX) {
148
+ // uni-app x 使用 HBuilderX 5.x 平台名:-p web 等价 -p h5(经典 uni-app 保持原有行为)
149
+ opts.platform = (0, utils_1.normalizePlatform)(opts.platform);
150
+ }
151
+ // uni-app x 的 App 平台(app/app-android/app-ios/app-harmony)必须由 HBuilderX 编译,与是否有 src 无关
152
+ const isUniappXApp = isUniappX && !!opts.platform?.startsWith('app');
113
153
  if (config_1.CONFIG_DATA.branch && config_1.CONFIG_DATA.branch !== 'false') {
114
154
  opts.branch = config_1.CONFIG_DATA.branch;
115
155
  }
@@ -138,11 +178,14 @@ async function getCommands(...args) {
138
178
  }
139
179
  const currentName = (0, path_1.basename)(utils_1.COMMAND_PATH);
140
180
  const projectName = opts.project || currentName;
181
+ let useHBuilderX = false;
141
182
  if (opts.compiler === 'uni') {
142
183
  if (!utils_1.HAS_SRC) {
143
184
  opts.pack = true;
144
185
  }
145
- if (projectName === currentName && !opts.pack) {
186
+ // uni-app x 的 App 平台必须由 HBuilderX 编译,与是否有 src 无关(不写 opts.pack,避免 publish 连续构建时影响 h5)
187
+ useHBuilderX = projectName !== currentName || !!opts.pack || isUniappXApp;
188
+ if (!useHBuilderX) {
146
189
  commands = [...commands, bin, 'build -p', opts.platform];
147
190
  }
148
191
  else {
@@ -150,7 +193,7 @@ async function getCommands(...args) {
150
193
  utils_1.log.error('HbuilderX Cli路径不正确,请执行“gmcb config --cli.hbuilderx <cli-path>”设置正确的路径!');
151
194
  }
152
195
  if (projectName !== currentName) {
153
- const sourcePath = (0, path_1.join)(utils_1.COMMAND_PATH, opts.source);
196
+ const sourcePath = opts.source ? (0, path_1.join)(utils_1.COMMAND_PATH, opts.source) : utils_1.COMMAND_PATH;
154
197
  envPath = (0, path_1.join)(sourcePath, 'buildenv');
155
198
  if (opts.source && opts.branch) {
156
199
  const git = (0, simple_git_1.default)(sourcePath);
@@ -169,7 +212,53 @@ async function getCommands(...args) {
169
212
  }
170
213
  (0, fs_1.writeFileSync)(envPath, buildEnv);
171
214
  }
172
- if (opts.platform.startsWith('app')) {
215
+ if (isUniappX) {
216
+ // uni-app x 使用 HBuilderX 5.x 子命令形式(经典 uni-app 分支保持不变)
217
+ const cleanFlags = (flags) => flags.filter((item) => !/^--[\w.]+ (\{\}|\[\]|)$/.test(item));
218
+ if (opts.platform === 'app-harmony') {
219
+ if (opts.wgt) {
220
+ cmds = ['publish', 'app-harmony', '--type', 'wgt', ...prepareWgtFlags(platform.app(opts).wgt).flags];
221
+ }
222
+ else if (opts.res) {
223
+ cmds = ['publish', 'app-harmony', '--type', 'appResource'];
224
+ }
225
+ else {
226
+ cmds = ['pack', 'app-harmony'];
227
+ }
228
+ }
229
+ else if (opts.platform.startsWith('app')) {
230
+ const app = platform.app(opts);
231
+ if (opts.wgt) {
232
+ cmds = ['publish', opts.platform, '--type', 'wgt', ...prepareWgtFlags(app.wgt).flags];
233
+ }
234
+ else if (opts.res) {
235
+ cmds = ['publish', opts.platform, '--type', 'appResource'];
236
+ }
237
+ else {
238
+ const packPlatform = opts.platform === 'app' ? 'android,ios' : opts.platform.replace('app-', '');
239
+ cmds = [
240
+ 'pack',
241
+ '--platform',
242
+ packPlatform,
243
+ ...cleanFlags(app.common),
244
+ ...cleanFlags(app.android),
245
+ ...cleanFlags(app.ios),
246
+ ];
247
+ }
248
+ }
249
+ else if (opts.platform === 'mp-weixin') {
250
+ const manifest = (0, utils_1.readManifest)();
251
+ const appid = manifest['mp-weixin']?.appid;
252
+ cmds = ['publish', 'mp-weixin', ...(appid ? ['--appid', appid] : []), ...platform.mp().common];
253
+ }
254
+ else if (opts.platform === 'h5') {
255
+ cmds = ['publish', 'web', ...platform.h5()];
256
+ }
257
+ else {
258
+ utils_1.log.error(`uni-app x 仅支持 h5/web、mp-weixin、app、app-android、app-ios、app-harmony 平台,当前平台:${opts.platform}`);
259
+ }
260
+ }
261
+ else if (opts.platform.startsWith('app')) {
173
262
  const app = platform.app(opts);
174
263
  if (opts.wgt) {
175
264
  if (opts.pack) {
@@ -255,6 +344,15 @@ async function getCommands(...args) {
255
344
  else {
256
345
  commands = [...commands, bin, 'build'];
257
346
  }
347
+ // 走 HBuilderX 且无 package.json 的 uni-app x 工程无法保证 cross-env 可执行,直接通过进程环境变量传递
348
+ if (isUniappX &&
349
+ opts.compiler === 'uni' &&
350
+ useHBuilderX &&
351
+ !(0, fs_1.existsSync)(utils_1.PACKAGE_PATH) &&
352
+ commands[0] === 'cross-env') {
353
+ process.env.NODE_ENV = 'production';
354
+ commands = commands.slice(2).filter((item) => !/^(NODE_ENV|BUILD_ENV)=/.test(item));
355
+ }
258
356
  return commands;
259
357
  }
260
358
  function generateH5Manifest() {
@@ -309,7 +407,7 @@ async function generatePackage(opts) {
309
407
  if ((0, fs_1.existsSync)(dest)) {
310
408
  (0, fs_1.unlinkSync)(dest);
311
409
  }
312
- const zipRoot = compiler === 'uni' && platform === 'h5' ? (pkg.appId || '') : '';
410
+ const zipRoot = compiler === 'uni' && platform === 'h5' ? pkg.appId || '' : '';
313
411
  zip.addLocalFolder(source, zipRoot);
314
412
  zip.writeZip(dest);
315
413
  }
@@ -319,18 +417,48 @@ async function generatePackage(opts) {
319
417
  function downloadFile(url, dest) {
320
418
  return new Promise((res, rej) => {
321
419
  const mod = url.startsWith('https') ? https_1.default : http_1.default;
322
- mod.get(url, (response) => {
420
+ mod
421
+ .get(url, (response) => {
323
422
  if (response.statusCode === 301 || response.statusCode === 302) {
324
423
  downloadFile(response.headers.location, dest).then(res, rej);
325
424
  return;
326
425
  }
327
426
  const ws = require('fs').createWriteStream(dest);
328
427
  response.pipe(ws);
329
- ws.on('finish', () => { ws.close(); res(); });
428
+ ws.on('finish', () => {
429
+ ws.close();
430
+ res();
431
+ });
330
432
  ws.on('error', rej);
331
- }).on('error', rej);
433
+ })
434
+ .on('error', rej);
332
435
  });
333
436
  }
437
+ /**
438
+ * 调用 HBuilderX CLI 对 .repo 工程执行 project open/close
439
+ * - open 用于让 HBuilderX 加载最新的 manifest.json / package.json
440
+ * - close 用于构建后释放项目
441
+ * 错误在本函数内处理:open 失败提示并退出,close 失败仅告警
442
+ */
443
+ function runHBuilderXProject(action, repoDir) {
444
+ const hbuilderxCli = config_1.CONFIG_DATA?.cli?.hbuilderx;
445
+ if (!hbuilderxCli) {
446
+ utils_1.log.error('HbuilderX Cli路径不正确,请执行“gmcb config --cli.hbuilderx <cli-path>”设置正确的路径!');
447
+ return;
448
+ }
449
+ try {
450
+ (0, child_process_1.execSync)(`"${hbuilderxCli}" project ${action} --path "${repoDir}"`, { cwd: repoDir, stdio: 'inherit' });
451
+ }
452
+ catch (err) {
453
+ const message = err?.message || String(err);
454
+ if (action === 'open') {
455
+ utils_1.log.error(`打开 HBuilderX 项目失败:${message}`);
456
+ }
457
+ else {
458
+ utils_1.log.warning(`关闭 HBuilderX 项目失败:${message}`);
459
+ }
460
+ }
461
+ }
334
462
  async function pullRemoteResources(opts) {
335
463
  const spinner = (0, ora_1.default)(`正在拉取远程资源...`).start();
336
464
  const pkg = (0, fs_extra_1.readJsonSync)(utils_1.PACKAGE_PATH);
@@ -388,8 +516,13 @@ async function pullRemoteResources(opts) {
388
516
  if (!repoPkg.scripts)
389
517
  repoPkg.scripts = {};
390
518
  repoPkg.appId = appId;
391
- repoPkg.scripts['copy:h5'] = 'gmcb copy -s ./dist/build/h5 -d ../../out/renderer/{package.appId}/ --clean';
392
- repoPkg.scripts['copy:app'] = 'gmcb copy -s ./dist/build/app -d ../../app/src/main/assets/apps/{manifest.appid}/www/ --clean';
519
+ if (opts.compiler === 'electron-vite') {
520
+ repoPkg.scripts['copy:h5'] = 'gmcb copy -s ./dist/build/h5 -d ../../out/renderer/{package.appId}/ --clean';
521
+ }
522
+ if (opts.compiler === 'gradlew') {
523
+ repoPkg.scripts['copy:android'] =
524
+ 'gmcb copy -s ./dist/build/app -d ../../app/src/main/assets/apps/{manifest.appid}/www/ --clean';
525
+ }
393
526
  (0, fs_extra_1.writeJsonSync)(repoPkgPath, repoPkg, { spaces: 2 });
394
527
  // 7. 执行 npm install
395
528
  (0, child_process_1.execSync)('npm install', { cwd: repoDir, stdio: 'inherit' });
@@ -416,9 +549,11 @@ async function pullRemoteResources(opts) {
416
549
  }
417
550
  }
418
551
  if (opts.compiler === 'gradlew') {
419
- // 构建 App 并拷贝
420
- (0, child_process_1.execSync)(`npm run build:app:${buildEnv}`, { cwd: repoDir, stdio: 'inherit' });
421
- (0, child_process_1.execSync)('npm run copy:app', { cwd: repoDir, stdio: 'inherit' });
552
+ // 构建 App 并拷贝:构建前 open 让 HBuilderX 加载最新工程信息,构建后 close
553
+ runHBuilderXProject('open', repoDir);
554
+ (0, child_process_1.execSync)(`npm run build:android:${buildEnv}`, { cwd: repoDir, stdio: 'inherit' });
555
+ runHBuilderXProject('close', repoDir);
556
+ (0, child_process_1.execSync)('npm run copy:android', { cwd: repoDir, stdio: 'inherit' });
422
557
  // 修改主项目 strings.xml 中的应用名称
423
558
  const stringsPath = (0, path_1.join)(utils_1.COMMAND_PATH, 'app', 'src', 'main', 'res', 'values', 'strings.xml');
424
559
  let stringsContent = (0, fs_1.readFileSync)(stringsPath, 'utf-8');
@@ -471,6 +606,8 @@ async function default_1(...args) {
471
606
  const deferRestore = args[args.length - 1] === true;
472
607
  const commands = await getCommands(...args);
473
608
  const command = commands.join(' ');
609
+ // uni-app x 的 App 产物(含 wgt)由 HBuilderX 产出,不再走本地二次打包
610
+ const isUniappXApp = (0, utils_1.isUniappXManifest)() && !!opts.platform?.startsWith('app');
474
611
  remoteBackups.clear();
475
612
  if (opts.latest) {
476
613
  await syncLatestVersion();
@@ -483,7 +620,7 @@ async function default_1(...args) {
483
620
  const time = Date.now();
484
621
  (0, utils_1.spawnSync)(command);
485
622
  if ((Date.now() - time) / 1000 <= 1) {
486
- if (command.includes(config_1.CONFIG_DATA.cli.hbuilderx)) {
623
+ if (config_1.CONFIG_DATA.cli?.hbuilderx && command.includes(config_1.CONFIG_DATA.cli.hbuilderx)) {
487
624
  utils_1.log.error('检测到您的HbuilderX未启动或项目管理器中未发现构建项目,请检查后重试!');
488
625
  }
489
626
  }
@@ -497,8 +634,8 @@ async function default_1(...args) {
497
634
  }
498
635
  if ((opts.compiler === 'electron-vite' && (opts.zip || opts.win)) ||
499
636
  (opts.compiler === 'uni' && opts.platform === 'h5' && opts.zip) ||
500
- (opts.compiler === 'uni' && opts.platform?.startsWith('app') && opts.wgt && !opts.pack) ||
501
- opts.compiler === 'gradlew' && opts.apk) {
637
+ (opts.compiler === 'uni' && opts.platform?.startsWith('app') && opts.wgt && !opts.pack && !isUniappXApp) ||
638
+ (opts.compiler === 'gradlew' && opts.apk)) {
502
639
  await generatePackage(opts);
503
640
  }
504
641
  return commands;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = default_1;
4
+ const flat_1 = require("flat");
5
+ const config_1 = require("../utils/config");
6
+ async function default_1(...args) {
7
+ if (args[0] === 'list') {
8
+ const obj = (0, flat_1.flatten)(config_1.CONFIG_DATA);
9
+ Object.keys(obj).forEach((key) => {
10
+ console.log(`${key}=${obj[key]}`);
11
+ });
12
+ }
13
+ else if (args[0]) {
14
+ const obj = (0, flat_1.flatten)(config_1.CONFIG_DATA);
15
+ if (obj[args[0]] != null) {
16
+ console.log(obj[args[0]]);
17
+ }
18
+ }
19
+ else if (args[1]) {
20
+ (0, config_1.setConfig)((0, flat_1.unflatten)(args[1]));
21
+ }
22
+ }
@@ -0,0 +1 @@
1
+ export default function (...args: any[]): Promise<void>;
@@ -27,12 +27,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
29
  exports.default = default_1;
30
+ const fs_1 = require("fs");
30
31
  const inquirer_1 = __importDefault(require("inquirer"));
31
32
  const utils_1 = require("../utils");
32
33
  const build_1 = __importStar(require("./build"));
33
34
  const config_1 = require("../utils/config");
34
35
  async function default_1(...args) {
35
36
  const opts = args[0];
37
+ if ((0, utils_1.isUniappXManifest)()) {
38
+ // uni-app x 使用 HBuilderX 5.x 平台名:-p web 等价 -p h5(经典 uni-app 保持原有行为)
39
+ opts.platform = (0, utils_1.normalizePlatform)(opts.platform);
40
+ }
36
41
  const isPublishFlow = !!config_1.CONFIG_DATA.publish;
37
42
  const isAuto = opts.skip || !!config_1.CONFIG_DATA.skip;
38
43
  const pub = { platform: 0, status: 0, updateType: 0, updateMode: 0 };
@@ -181,7 +186,13 @@ async function default_1(...args) {
181
186
  install = false;
182
187
  }
183
188
  if (install) {
184
- (0, utils_1.spawnSync)(config_1.CONFIG_DATA.install || 'npm install');
189
+ if ((0, fs_1.existsSync)(utils_1.PACKAGE_PATH)) {
190
+ (0, utils_1.spawnSync)(config_1.CONFIG_DATA.install || 'npm install');
191
+ }
192
+ else {
193
+ // uni-app x 的 HBuilderX 工程通常没有 package.json,无需安装依赖
194
+ utils_1.log.warning('未检测到 package.json,跳过依赖安装');
195
+ }
185
196
  }
186
197
  // 更新 CONFIG_DATA(build 之前,确保 fetchRemoteResources 能读取到)
187
198
  if (isPublishFlow) {
@@ -228,8 +239,8 @@ async function default_1(...args) {
228
239
  else {
229
240
  cmds = await (0, build_1.default)(opts, true);
230
241
  }
231
- // 从 cmds 提取 buildEnv
232
- const buildEnv = cmds[2]?.split('=')[1];
242
+ // 从 cmds 提取 buildEnv:无 package.json 的 uni-app x 工程命令中没有 cross-env/BUILD_ENV,回退到进程环境变量
243
+ const buildEnv = cmds.find((cmd) => cmd.startsWith('BUILD_ENV='))?.split('=')[1] || process.env.BUILD_ENV;
233
244
  if (!buildEnv || !['dev', 'sit', 'uat', 'pre', 'pro', 'prod'].includes(buildEnv)) {
234
245
  utils_1.log.error('没有检测到需要发布的环境,无法完成上传,请切换到dev/sit/uat/pre/master分支再次执行脚本,或者您可以选择手动上传!');
235
246
  }
package/lib/bin.js CHANGED
@@ -10,10 +10,10 @@ const create_1 = __importDefault(require("./actions/create"));
10
10
  const dev_1 = __importDefault(require("./actions/dev"));
11
11
  const build_1 = __importDefault(require("./actions/build"));
12
12
  const publish_1 = __importDefault(require("./actions/publish"));
13
- const config_1 = __importDefault(require("./utils/config"));
13
+ const config_1 = __importDefault(require("./actions/config"));
14
14
  const copy_1 = __importDefault(require("./actions/copy"));
15
15
  const icon_1 = __importDefault(require("./actions/icon"));
16
- const splash_1 = __importDefault(require("./actions/splash"));
16
+ const image_1 = __importDefault(require("./actions/image"));
17
17
  const skill_1 = require("./actions/skill");
18
18
  const commands_1 = require("./commands");
19
19
  const utils_1 = require("./utils");
@@ -120,7 +120,7 @@ program
120
120
  .option(...commands_1.left)
121
121
  .option(...commands_1.top)
122
122
  .option(...commands_1.bg)
123
- .action(splash_1.default);
123
+ .action(image_1.default);
124
124
  const skillCmd = program.command('skill').description('技能管理');
125
125
  skillCmd
126
126
  .command('sync')
@@ -18,7 +18,7 @@ export declare const mac: readonly ["--mac", "是否构建MacOS应用"];
18
18
  export declare const linux: readonly ["--linux", "是否构建Linux应用"];
19
19
  export declare const zip: readonly ["--zip", "是否构建桌面应用热更新资源"];
20
20
  export declare const custom: readonly ["--custom", "是否构建自定义基座"];
21
- export declare const pack: readonly ["--pack", "是否使用hbuilderx构建应用"];
21
+ export declare const pack: readonly ["--pack", "是否使用HBuilderX构建应用(uni-app x 的 App 平台始终使用 HBuilderX)"];
22
22
  export declare const wgt: readonly ["--wgt", "是否构建移动应用热更新资源"];
23
23
  export declare const res: readonly ["--res", "是否构建移动应用本地资源"];
24
24
  export declare const apk: readonly ["--apk", "是否构建Android应用"];
@@ -20,7 +20,7 @@ exports.mac = ['--mac', '是否构建MacOS应用'];
20
20
  exports.linux = ['--linux', '是否构建Linux应用'];
21
21
  exports.zip = ['--zip', '是否构建桌面应用热更新资源'];
22
22
  exports.custom = ['--custom', '是否构建自定义基座'];
23
- exports.pack = ['--pack', '是否使用hbuilderx构建应用'];
23
+ exports.pack = ['--pack', '是否使用HBuilderX构建应用(uni-app x 的 App 平台始终使用 HBuilderX)'];
24
24
  exports.wgt = ['--wgt', '是否构建移动应用热更新资源'];
25
25
  exports.res = ['--res', '是否构建移动应用本地资源'];
26
26
  exports.apk = ['--apk', '是否构建Android应用'];
@@ -9,8 +9,13 @@ const config_1 = require("../utils/config");
9
9
  async function default_1() {
10
10
  const buildEnv = process.env.BUILD_ENV || '';
11
11
  const manifest = (0, utils_1.readManifest)();
12
+ const appid = manifest['mp-weixin']?.appid;
13
+ // uni-app x 的 appid 为空时 miniprogram-ci 报错难以理解,这里提前给出明确提示(经典 uni-app 保持原有行为)
14
+ if (!appid && (0, utils_1.isUniappXManifest)(manifest)) {
15
+ utils_1.log.error('manifest.json 中未配置 mp-weixin.appid,无法上传微信小程序,请先在 manifest.json 的 mp-weixin 节点中配置 appid!');
16
+ }
12
17
  const project = new miniprogram_ci_1.Project({
13
- appid: manifest['mp-weixin']?.appid,
18
+ appid,
14
19
  type: config_1.CONFIG_DATA?.mp?.weixin?.type ?? 'miniProgram',
15
20
  projectPath: (0, path_1.join)(process.cwd(), const_1.HAS_SRC ? '' : 'unpackage', 'dist/build/mp-weixin'),
16
21
  privateKeyPath: (0, path_1.resolve)(config_1.CONFIG_DATA?.mp?.weixin?.privatekey ?? ''),
@@ -117,5 +117,4 @@ export declare function getLocalConfig(): Config;
117
117
  export declare function getMergeConfig(conf?: {}): Config;
118
118
  export declare const CONFIG_DATA: Config;
119
119
  export declare function setConfig(config: Config): void;
120
- export default function (...args: any[]): Promise<void>;
121
120
  export {};
@@ -5,11 +5,9 @@ exports.getConfig = getConfig;
5
5
  exports.getLocalConfig = getLocalConfig;
6
6
  exports.getMergeConfig = getMergeConfig;
7
7
  exports.setConfig = setConfig;
8
- exports.default = default_1;
9
8
  const fs_1 = require("fs");
10
9
  const path_1 = require("path");
11
10
  const lodash_1 = require("lodash");
12
- const flat_1 = require("flat");
13
11
  const fs_extra_1 = require("fs-extra");
14
12
  const const_1 = require("./const");
15
13
  function getConfig() {
@@ -73,20 +71,3 @@ function setConfig(config) {
73
71
  const conf = getConfig();
74
72
  (0, fs_extra_1.writeJsonSync)(const_1.CONFIG_PATH, (0, lodash_1.merge)({}, conf, config), { spaces: 2 });
75
73
  }
76
- async function default_1(...args) {
77
- if (args[0] === 'list') {
78
- const obj = (0, flat_1.flatten)(exports.CONFIG_DATA);
79
- Object.keys(obj).forEach((key) => {
80
- console.log(`${key}=${obj[key]}`);
81
- });
82
- }
83
- else if (args[0]) {
84
- const obj = (0, flat_1.flatten)(exports.CONFIG_DATA);
85
- if (obj[args[0]] != null) {
86
- console.log(obj[args[0]]);
87
- }
88
- }
89
- else if (args[1]) {
90
- setConfig((0, flat_1.unflatten)(args[1]));
91
- }
92
- }
@@ -1,4 +1,12 @@
1
1
  export declare function readManifest(): Record<string, unknown>;
2
+ /**
3
+ * 是否 uni-app x 工程(manifest.json 含 uni-app-x 字段,空对象也算)
4
+ */
5
+ export declare function isUniappXManifest(manifest?: Record<string, unknown>): boolean;
6
+ /**
7
+ * 平台名归一化:web 是 HBuilderX 5.x 的平台名,等价 h5
8
+ */
9
+ export declare function normalizePlatform(platform?: string): string;
2
10
  export declare function objectToCommand(obj?: Record<string, any>): {};
3
11
  export declare function filterToArray(obj?: Record<string, any>): any[];
4
12
  export declare function spawnSync(command?: string): import("child_process").SpawnSyncReturns<Buffer>;
@@ -4,6 +4,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.readManifest = readManifest;
7
+ exports.isUniappXManifest = isUniappXManifest;
8
+ exports.normalizePlatform = normalizePlatform;
7
9
  exports.objectToCommand = objectToCommand;
8
10
  exports.filterToArray = filterToArray;
9
11
  exports.spawnSync = spawnSync;
@@ -26,6 +28,21 @@ function readManifest() {
26
28
  }
27
29
  return {};
28
30
  }
31
+ /**
32
+ * 是否 uni-app x 工程(manifest.json 含 uni-app-x 字段,空对象也算)
33
+ */
34
+ function isUniappXManifest(manifest = readManifest()) {
35
+ return Object.prototype.hasOwnProperty.call(manifest, 'uni-app-x');
36
+ }
37
+ /**
38
+ * 平台名归一化:web 是 HBuilderX 5.x 的平台名,等价 h5
39
+ */
40
+ function normalizePlatform(platform) {
41
+ if (!platform) {
42
+ return 'h5';
43
+ }
44
+ return platform === 'web' ? 'h5' : platform;
45
+ }
29
46
  function objectToCommand(obj = {}) {
30
47
  const object = (0, flat_1.flatten)(obj);
31
48
  const res = {};
@@ -2,5 +2,5 @@ export * from './const';
2
2
  export * from './function';
3
3
  export * from './config';
4
4
  export * from './png2ico';
5
- export * from './splash';
5
+ export * from './image';
6
6
  export * as log from './log';
@@ -31,5 +31,5 @@ __exportStar(require("./const"), exports);
31
31
  __exportStar(require("./function"), exports);
32
32
  __exportStar(require("./config"), exports);
33
33
  __exportStar(require("./png2ico"), exports);
34
- __exportStar(require("./splash"), exports);
34
+ __exportStar(require("./image"), exports);
35
35
  exports.log = __importStar(require("./log"));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gmcb/cli",
3
- "version": "0.9.1",
3
+ "version": "0.9.3",
4
4
  "description": "工茂草本前端命令行工具",
5
5
  "author": "yinjiazeng@163.com",
6
6
  "license": "MIT",
@@ -8,7 +8,6 @@
8
8
  "bin": {
9
9
  "gmcb": "lib/bin.js"
10
10
  },
11
- "homepage": "https://git.keeprisk.cn/gmcb/front-end/tree/master/packages/cli",
12
11
  "publishConfig": {
13
12
  "access": "public"
14
13
  },
@@ -58,5 +57,6 @@
58
57
  "@types/inquirer": "^9.0.7",
59
58
  "@types/rimraf": "^4.0.5",
60
59
  "@types/user-home": "^2.0.2"
61
- }
60
+ },
61
+ "gitHead": "859bef47f814cd811f1f24ade77c9e8a2fb86e23"
62
62
  }
File without changes
File without changes
File without changes
File without changes