@gmcb/cli 0.8.1 → 0.8.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,6 +3,22 @@
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.8.3](http://10.10.10.16/caoben/front-end/compare/@gmcb/cli@0.8.2...@gmcb/cli@0.8.3) (2026-07-15)
7
+
8
+ **Note:** Version bump only for package @gmcb/cli
9
+
10
+
11
+
12
+
13
+
14
+ ## [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)
15
+
16
+ **Note:** Version bump only for package @gmcb/cli
17
+
18
+
19
+
20
+
21
+
6
22
  ## [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)
7
23
 
8
24
  **Note:** Version bump only for package @gmcb/cli
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
@@ -93,7 +93,7 @@ gmcb publish -p app --wgt -a
93
93
  - `auto`:是否自动发布,跳过所有确认提示。支持 `true` / `1`(自动发布)或 `false` / `0` / 不传(交互确认)。CLI 传入 `--auto` 时会覆盖此配置
94
94
  - `install`:安装依赖的命令,默认为 `npm install`,可配置为 `pnpm install`、`yarn` 等
95
95
  - `pub`:基础发布配置(brand、type、status、platform、path)
96
- - `publish`:魔方发布配置(brandName、brandId、channel、updateType、versionDesc、publishType、platform、path),配置后走魔方发布流程
96
+ - `publish`:魔方发布配置(updateType、versionDesc、publishType、platform、path),配置后走魔方发布流程
97
97
 
98
98
  ## `gmcb icon`
99
99
 
@@ -273,15 +273,10 @@ async function fetchRemoteResources(opts) {
273
273
  // 查询版本数据,更新 package.json
274
274
  const appIdPkg = (0, fs_extra_1.readJsonSync)(utils_1.PACKAGE_PATH);
275
275
  const appId = appIdPkg.appId;
276
- const { versionName, versionCode, brandId } = await (0, apis_1.fetchLatestVersion)({
276
+ const { versionName, versionCode } = await (0, apis_1.fetchLatestVersion)({
277
277
  appId,
278
- brandId: config_1.CONFIG_DATA.publish?.brandId,
279
- brandName: config_1.CONFIG_DATA.publish?.brandName,
280
278
  platform: config_1.CONFIG_DATA.publish?.platform,
281
279
  });
282
- if (brandId) {
283
- config_1.CONFIG_DATA.publish.brandId = brandId;
284
- }
285
280
  if (versionName && versionCode) {
286
281
  let pkgContent = (0, fs_1.readFileSync)(utils_1.PACKAGE_PATH, 'utf-8');
287
282
  pkgContent = pkgContent.replace(/"version"\s*:\s*"[^"]*"/, `"version": "${versionName}"`);
@@ -60,7 +60,6 @@ export declare function postVersion(data: any): Promise<{
60
60
  export declare function getVersionPage(params: {
61
61
  appId: string;
62
62
  publishType: number;
63
- brandId?: number | string;
64
63
  platform?: number;
65
64
  pageNo?: number;
66
65
  pageSize?: number;
@@ -84,15 +83,18 @@ export declare function getAppPage(params: {
84
83
  /**
85
84
  * 查询版本历史
86
85
  */
87
- export declare function getVersionHistory(params: Record<string, any>): Promise<{
86
+ export declare function getVersionHistory(params: {
87
+ publishType: number;
88
+ appMofangId: string;
89
+ pageNo?: number;
90
+ pageSize?: number;
91
+ }): Promise<{
88
92
  code?: number;
89
93
  data?: any;
90
94
  msg?: string;
91
95
  }>;
92
96
  export interface VersionParams {
93
97
  brand?: string;
94
- brandId?: string;
95
- brandName?: string;
96
98
  appId?: string;
97
99
  username?: string;
98
100
  password?: string;
@@ -103,7 +105,6 @@ export interface VersionParams {
103
105
  remoteUrl?: string | string[];
104
106
  versionName?: string;
105
107
  versionCode?: string | number;
106
- channel?: string | number;
107
108
  updateType?: number | string;
108
109
  updateMode?: number | string;
109
110
  versionDesc?: string;
@@ -122,13 +123,10 @@ export declare function publishVersion(params: VersionParams): Promise<void>;
122
123
  */
123
124
  export declare function fetchLatestVersion(params: {
124
125
  appId: string;
125
- brandId?: string;
126
- brandName?: string;
127
126
  platform?: number;
128
127
  }): Promise<{
129
128
  versionName: any;
130
129
  versionCode: number;
131
- brandId: string;
132
130
  }>;
133
131
  /**
134
132
  * 获取应用信息(自动登录)
package/lib/apis/index.js CHANGED
@@ -122,14 +122,13 @@ async function uploadVersion(params) {
122
122
  */
123
123
  async function publishVersion(params) {
124
124
  try {
125
- const { brandName, brandId, appId, remoteUrl, versionName, versionCode, channel, versionDesc, platform, ...rest } = params;
125
+ const { appId, remoteUrl, versionName, versionCode, versionDesc, platform, ...rest } = params;
126
126
  const publishType = Number(rest.publishType || 3);
127
127
  const updateType = Number(rest.updateType || 2);
128
128
  const updateMode = Number(rest.updateMode || 0);
129
129
  await ensureLoggedIn();
130
130
  const pageParams = { appId, publishType, pageNo: 1, pageSize: 1 };
131
131
  if (publishType == 1) {
132
- pageParams.brandId = config_1.CONFIG_DATA.publish?.brandId;
133
132
  pageParams.platform = platform;
134
133
  }
135
134
  const { data: pageData } = await getVersionPage(pageParams);
@@ -138,21 +137,13 @@ async function publishVersion(params) {
138
137
  let latest;
139
138
  const firstPage = pageList[0];
140
139
  if (firstPage) {
141
- let historyParams;
142
- if (firstPage.publishType == 1) {
143
- historyParams = {
144
- publishType: firstPage.publishType,
145
- appName: firstPage.appName,
146
- channelType: firstPage.channelType,
147
- platformType: firstPage.platformType,
148
- };
149
- }
150
- else {
151
- historyParams = {
152
- publishType,
153
- appMofangId: firstPage.appMofangId,
154
- };
155
- }
140
+ const historyParams = {
141
+ publishType: firstPage.publishType,
142
+ appMofangId: firstPage.appMofangId,
143
+ ...(publishType == 1 && {
144
+ platformType: const_1.PLATFORM_TYPE[platform],
145
+ }),
146
+ };
156
147
  const { data: historyData } = await getVersionHistory({ ...historyParams, pageNo: 1, pageSize: 1 });
157
148
  latest = (Array.isArray(historyData) ? historyData : historyData?.list)?.[0];
158
149
  }
@@ -164,50 +155,22 @@ async function publishVersion(params) {
164
155
  versionId = existingVersion.id;
165
156
  }
166
157
  else {
167
- let createData;
168
158
  const { data: appList } = await getAppList();
169
159
  const appItem = appList?.find((item) => item.appId === appId);
170
- if (publishType == 1) {
171
- let resolvedBrandId = config_1.CONFIG_DATA.publish?.brandId || brandId;
172
- if (!resolvedBrandId && brandName) {
173
- const { data: brandList } = await getBrandList();
174
- const matched = brandList?.find(({ name, id }) => {
175
- return Number(id) > 10000 && name === brandName;
176
- });
177
- resolvedBrandId = matched?.id;
178
- }
179
- createData = {
180
- brandId: resolvedBrandId,
181
- appName: appItem?.name,
182
- channelType: const_1.CHANNEL_TYPE[channel],
160
+ const createData = {
161
+ appId,
162
+ appMofangId: appItem?.id,
163
+ appName: appItem?.name,
164
+ updateType,
165
+ updateMode,
166
+ versionName,
167
+ versionNum: versionCode,
168
+ versionDesc: versionDesc || '修复一些已知问题',
169
+ publishType,
170
+ ...(publishType == 1 && {
183
171
  platformType: const_1.PLATFORM_TYPE[platform],
184
- updateType,
185
- updateMode,
186
- versionName,
187
- versionNum: versionCode,
188
- versionDesc: versionDesc || '修复一些已知问题',
189
- fullPackageUrl: '',
190
- fullPackageFileName: '',
191
- resourcePackageUrl: '',
192
- resourcePackageFileName: '',
193
- publishType,
194
- };
195
- }
196
- else {
197
- createData = {
198
- appId,
199
- appMofangId: appItem?.id,
200
- appName: appItem?.name,
201
- updateType,
202
- updateMode,
203
- versionName,
204
- versionNum: versionCode,
205
- versionDesc: versionDesc || '修复一些已知问题',
206
- resourcePackageUrl: '',
207
- resourcePackageFileName: '',
208
- publishType,
209
- };
210
- }
172
+ }),
173
+ };
211
174
  const { data: newId } = await createVersion(createData);
212
175
  versionId = newId;
213
176
  }
@@ -243,20 +206,11 @@ async function publishVersion(params) {
243
206
  * 获取最新版本信息(自动登录)
244
207
  */
245
208
  async function fetchLatestVersion(params) {
246
- const { appId, brandId, brandName, platform } = params;
209
+ const { appId, platform } = params;
247
210
  await ensureLoggedIn();
248
- let resolvedBrandId = brandId;
249
- if (!resolvedBrandId && brandName) {
250
- const { data: brandList } = await getBrandList();
251
- const matched = brandList?.find(({ name, id }) => {
252
- return Number(id) > 10000 && name === brandName;
253
- });
254
- resolvedBrandId = matched?.id;
255
- }
256
211
  const { data: versionPage } = await getVersionPage({
257
212
  appId,
258
213
  publishType: 1,
259
- brandId: resolvedBrandId,
260
214
  platform,
261
215
  pageNo: 1,
262
216
  pageSize: 1,
@@ -266,7 +220,6 @@ async function fetchLatestVersion(params) {
266
220
  return {
267
221
  versionName: latestVersion?.versionName ?? '',
268
222
  versionCode: Number(latestVersion?.versionNum ?? 0),
269
- brandId: resolvedBrandId ?? '',
270
223
  };
271
224
  }
272
225
  /**
@@ -71,8 +71,6 @@ async function publish(options) {
71
71
  const cfg = isPublish ? config_1.CONFIG_DATA.publish : config_1.CONFIG_DATA.pub;
72
72
  if (isPublish) {
73
73
  await (0, apis_1.publishVersion)({
74
- brandName: cfg?.brandName,
75
- brandId: cfg?.brandId,
76
74
  appId: pkg['appId'],
77
75
  username,
78
76
  password,
@@ -82,7 +80,6 @@ async function publish(options) {
82
80
  remoteUrl: remoteUrls.length === 1 ? remoteUrls[0] : remoteUrls,
83
81
  versionName: versionName,
84
82
  versionCode: versionCode,
85
- channel: cfg?.channel,
86
83
  updateType: cfg?.updateType,
87
84
  updateMode: cfg?.updateMode,
88
85
  versionDesc: cfg?.versionDesc,
@@ -62,9 +62,6 @@ interface Publish {
62
62
  platform?: number;
63
63
  }
64
64
  interface PublishConfig {
65
- brandName?: string;
66
- brandId?: string;
67
- channel?: number;
68
65
  updateType?: number;
69
66
  updateMode?: number;
70
67
  versionDesc?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gmcb/cli",
3
- "version": "0.8.1",
3
+ "version": "0.8.3",
4
4
  "description": "工茂草本前端命令行工具",
5
5
  "author": "yinjiazeng@163.com",
6
6
  "license": "MIT",
@@ -58,5 +58,6 @@
58
58
  "@types/inquirer": "^9.0.7",
59
59
  "@types/rimraf": "^4.0.5",
60
60
  "@types/user-home": "^2.0.2"
61
- }
61
+ },
62
+ "gitHead": "3d53dabaaf579201fb39226ebd8aebdca8082447"
62
63
  }
package/schema.json CHANGED
@@ -80,18 +80,6 @@
80
80
  "type": "object",
81
81
  "description": "魔方发布配置",
82
82
  "properties": {
83
- "brandName": {
84
- "type": "string",
85
- "description": "品牌全称"
86
- },
87
- "brandId": {
88
- "type": ["string"],
89
- "description": "品牌ID"
90
- },
91
- "channel": {
92
- "type": "number",
93
- "description": "渠道类型"
94
- },
95
83
  "updateMode": {
96
84
  "type": "number",
97
85
  "description": "更新方式"