@done-coding/cli-publish 0.6.1-alpha.0 → 0.7.0-alpha.0

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/es/cli.mjs CHANGED
@@ -1,6 +1,10 @@
1
1
  #!/usr/bin/env node
2
- import { c as m } from "./index-12bd4947.js";
2
+ import { c as m } from "./index-03fd1d3d.js";
3
3
  import "@done-coding/cli-utils";
4
4
  import "node:child_process";
5
5
  import "semver";
6
+ import "uuid";
7
+ import "node:path";
8
+ import "node:fs";
9
+ import "node:os";
6
10
  m();
@@ -0,0 +1,305 @@
1
+ #!/usr/bin/env node
2
+ import { getConfigFileCommonOptions as v, initHandlerCommon as G, log as m, readConfigFile as J, getPackageJson as C, getGitLastCommitInfo as U, pushGitPublishInfoToRemote as W, xPrompts as X, createSubcommand as b, createMainCommand as q } from "@done-coding/cli-utils";
3
+ import { execSync as d } from "node:child_process";
4
+ import { inc as g, prerelease as z } from "semver";
5
+ import { v4 as K } from "uuid";
6
+ import w from "node:path";
7
+ import T, { rmSync as Q } from "node:fs";
8
+ import { homedir as Y } from "node:os";
9
+ var R = /* @__PURE__ */ ((e) => (e.INIT = "init", e.EXEC = "exec", e.ALIAS = "alias", e))(R || {}), t = /* @__PURE__ */ ((e) => (e.MAJOR = "major", e.MINOR = "minor", e.PATCH = "patch", e.PREMAJOR = "premajor", e.PREMINOR = "preminor", e.PREPATCH = "prepatch", e.PRERELEASE = "prerelease", e))(t || {}), A = /* @__PURE__ */ ((e) => (e.LATEST = "latest", e.NEXT = "next", e.ALPHA = "alpha", e))(A || {}), c = /* @__PURE__ */ ((e) => (e.NPM = "npm", e.WEB = "web", e))(c || {});
10
+ const $ = {
11
+ name: "@done-coding/cli-publish",
12
+ version: "0.7.0-alpha.0",
13
+ description: "项目发布命令行工具",
14
+ cliConfig: {
15
+ namespaceDir: ".done-coding",
16
+ moduleName: "publish"
17
+ }
18
+ }, {
19
+ cliConfig: { namespaceDir: Z, moduleName: V }
20
+ } = $, ee = `./${Z}/${V}`, N = `${ee}.json`, te = {
21
+ [c.WEB]: {},
22
+ [c.NPM]: {
23
+ aliasInfo: [
24
+ {
25
+ packageJson: {
26
+ name: "",
27
+ bin: "",
28
+ scripts: {}
29
+ }
30
+ }
31
+ ]
32
+ }
33
+ }, ne = () => v({
34
+ configPathDefault: N
35
+ }), D = async (e) => G(te, e, {
36
+ onFileGenerated: () => {
37
+ m.info("文件生成成功");
38
+ }
39
+ }), oe = {
40
+ command: R.INIT,
41
+ describe: "初始化配置文件",
42
+ options: ne(),
43
+ handler: D
44
+ }, se = () => v({
45
+ configPathDefault: N
46
+ }), y = (e) => {
47
+ var a;
48
+ const n = ((a = e[c.NPM]) == null ? void 0 : a.aliasInfo) || [];
49
+ if (n.length)
50
+ return n;
51
+ }, O = async (e) => {
52
+ var M;
53
+ const n = await J(e, () => ({})), a = y(n);
54
+ if (!a) {
55
+ m.warn("没有配置别名发布信息");
56
+ return;
57
+ }
58
+ const { rootDir: o } = e, i = C({ rootDir: o }), { name: s, version: r } = i, l = `${Y()}/.DONE_CODING_CLI_PUBLISH_ALIAS`, u = w.resolve(l, K());
59
+ T.mkdirSync(u, { recursive: !0 }), d(`npm install ${s}@${r}`, {
60
+ stdio: "inherit",
61
+ cwd: u
62
+ });
63
+ const f = (M = d(`npm dist-tag ${s}`).toString().trim().split(`
64
+ `).map((I) => I.split(":").map((h) => h.trim())).find(
65
+ ([, I]) => I === r
66
+ )) == null ? void 0 : M[0];
67
+ if (!f)
68
+ return m.warn(`没有找到 ${s}@${r} 对应的dist-tag`);
69
+ const p = w.resolve(u, "node_modules", s), B = C({
70
+ rootDir: p
71
+ });
72
+ for (let I of a) {
73
+ const { packageJson: h } = I, F = {
74
+ ...B,
75
+ ...h
76
+ }, j = `${p}/package.json`;
77
+ T.writeFileSync(
78
+ j,
79
+ JSON.stringify(F, null, 2)
80
+ ), d(`npm publish --tag ${f}`, {
81
+ stdio: "inherit",
82
+ cwd: p
83
+ }), Q(u, { recursive: !0, force: !0 });
84
+ }
85
+ }, re = {
86
+ command: R.ALIAS,
87
+ describe: "别名发布",
88
+ options: se(),
89
+ handler: O
90
+ }, ie = () => ({
91
+ ...v({
92
+ configPathDefault: N
93
+ }),
94
+ mode: {
95
+ alias: "m",
96
+ describe: "发布模式",
97
+ choices: [c.NPM, c.WEB],
98
+ default: c.NPM
99
+ },
100
+ type: {
101
+ alias: "t",
102
+ describe: "发布类型",
103
+ choices: [
104
+ t.MAJOR,
105
+ t.MINOR,
106
+ t.PATCH,
107
+ t.PREMAJOR,
108
+ t.PREMINOR,
109
+ t.PREPATCH,
110
+ t.PRERELEASE
111
+ ]
112
+ },
113
+ push: {
114
+ alias: "p",
115
+ describe: "是否推送至远程仓库",
116
+ type: "boolean",
117
+ default: !0
118
+ }
119
+ }), H = ({
120
+ packageJson: e,
121
+ type: n
122
+ }) => {
123
+ let a = e.name, o = "", i;
124
+ const { version: s } = e;
125
+ if (!s)
126
+ throw new Error("当前版本号为空");
127
+ if ([
128
+ t.MAJOR,
129
+ t.MINOR,
130
+ t.PATCH
131
+ ].includes(n))
132
+ o = g(s, n), i = A.LATEST;
133
+ else if ([
134
+ t.PREMAJOR,
135
+ t.PREMINOR,
136
+ t.PREPATCH
137
+ ].includes(n)) {
138
+ const r = z(s);
139
+ r ? (m.warn("当前版本已经是预发布版本,将会在当前版本基础上进行发布"), r.length === 1 && typeof r[0] == "number" ? o = g(
140
+ s,
141
+ t.PRERELEASE
142
+ ) : o = s.split("-")[0] + "-0") : o = g(s, n), i = A.NEXT;
143
+ } else
144
+ i = A.ALPHA, o = g(
145
+ s,
146
+ t.PRERELEASE,
147
+ i
148
+ );
149
+ if (!o)
150
+ throw new Error("version is empty");
151
+ return {
152
+ name: a,
153
+ version: o,
154
+ tag: i
155
+ };
156
+ }, ae = async ({
157
+ type: e,
158
+ packageJson: n
159
+ }) => {
160
+ if (e)
161
+ return await H({
162
+ packageJson: n,
163
+ type: e
164
+ });
165
+ {
166
+ const o = Object.values(t).filter(
167
+ (r) => r.toUpperCase() !== r
168
+ ).reduce(
169
+ (r, l) => (r[l] = H({
170
+ packageJson: n,
171
+ type: l
172
+ }), r),
173
+ {}
174
+ ), i = [
175
+ {
176
+ title: `主版本(${o[t.MAJOR].version})`,
177
+ value: t.MAJOR
178
+ },
179
+ {
180
+ title: `次版本(${o[t.MINOR].version})`,
181
+ value: t.MINOR
182
+ },
183
+ {
184
+ title: `修订版本(${o[t.PATCH].version})`,
185
+ value: t.PATCH
186
+ },
187
+ {
188
+ title: `预发布主版本(${o[t.PREMAJOR].version})`,
189
+ value: t.PREMAJOR
190
+ },
191
+ {
192
+ title: `预发布次版本(${o[t.PREMINOR].version})`,
193
+ value: t.PREMINOR
194
+ },
195
+ {
196
+ title: `预发布修订版本(${o[t.PREPATCH].version})`,
197
+ value: t.PREPATCH
198
+ },
199
+ {
200
+ title: `alpha版本(${o[t.PRERELEASE].version})`,
201
+ value: t.PRERELEASE
202
+ }
203
+ ], { type: s } = await X({
204
+ type: "select",
205
+ name: "type",
206
+ message: `请选择发布类型,当前版本:${n.version}`,
207
+ choices: i
208
+ });
209
+ return o[s];
210
+ }
211
+ }, k = async (e) => {
212
+ const { mode: n, type: a, push: o, rootDir: i } = e, s = await J(e, () => ({})), r = s[n], l = await U(r), u = C({ rootDir: i }), E = await ae({
213
+ type: a,
214
+ packageJson: u
215
+ }), { version: P } = E;
216
+ d(`npm version ${P}`, {
217
+ cwd: i,
218
+ stdio: "inherit"
219
+ });
220
+ const { tag: L } = E;
221
+ try {
222
+ switch (n) {
223
+ case c.WEB: {
224
+ const { build: f } = r;
225
+ if (f)
226
+ d(`${f}`, {
227
+ stdio: "inherit",
228
+ cwd: i
229
+ });
230
+ else
231
+ throw new Error("未配置build命令");
232
+ break;
233
+ }
234
+ case c.NPM: {
235
+ d(`npm publish --tag ${L}`, {
236
+ cwd: i,
237
+ stdio: "inherit"
238
+ });
239
+ break;
240
+ }
241
+ default:
242
+ throw new Error(`未知发布模式:${n}`);
243
+ }
244
+ } catch (f) {
245
+ m.error(`发布失败, error: ${f.message}`);
246
+ try {
247
+ m.info(`回滚本地版本到发布前的版本:${l.lastHash}`);
248
+ const { lastHash: p } = l;
249
+ d(`git reset --hard ${p}`, {
250
+ stdio: "inherit"
251
+ }), m.info(`删除本次发布时生成的tag:v${E.version}`), d(`git tag -d v${E.version}`, {
252
+ stdio: "inherit"
253
+ });
254
+ } catch (p) {
255
+ m.error(`回滚失败, error: ${p.message}`);
256
+ }
257
+ return process.exit(1);
258
+ }
259
+ o && W({
260
+ branchName: l.branchName,
261
+ version: E.version,
262
+ remoteInfo: l.remoteInfo
263
+ }), m.success(`发布成功,版本号:${P}`), n === c.NPM && y(s) && O(e);
264
+ }, ce = {
265
+ command: "$0",
266
+ describe: "执行发布命令",
267
+ options: ie(),
268
+ handler: k
269
+ }, ge = async (e, n) => {
270
+ switch (e) {
271
+ case R.INIT:
272
+ return D(n);
273
+ case R.EXEC:
274
+ return k(n);
275
+ case R.ALIAS:
276
+ return O(n);
277
+ default:
278
+ throw new Error(`不支持的命令 ${e}`);
279
+ }
280
+ }, { version: le, description: me } = $, _ = {
281
+ describe: me,
282
+ version: le,
283
+ subcommands: [
284
+ oe,
285
+ ce,
286
+ re
287
+ ].map(b),
288
+ demandCommandCount: 1
289
+ }, {
290
+ cliConfig: { moduleName: S }
291
+ } = $, x = (e = !1) => {
292
+ const n = e ? S : void 0, a = `$0${e ? ` ${S}` : ""} [options]`;
293
+ return { command: n, usage: a };
294
+ }, Ae = async () => q({
295
+ ..._,
296
+ ...x()
297
+ }), Pe = () => b({
298
+ ..._,
299
+ ...x(!0)
300
+ });
301
+ export {
302
+ Pe as a,
303
+ Ae as c,
304
+ ge as h
305
+ };
package/es/index.mjs CHANGED
@@ -1,9 +1,13 @@
1
1
  #!/usr/bin/env node
2
- import { a as n, h as t } from "./index-12bd4947.js";
2
+ import { a as s, h as d } from "./index-03fd1d3d.js";
3
3
  import "@done-coding/cli-utils";
4
4
  import "node:child_process";
5
5
  import "semver";
6
+ import "uuid";
7
+ import "node:path";
8
+ import "node:fs";
9
+ import "node:os";
6
10
  export {
7
- n as crateAsSubcommand,
8
- t as handler
11
+ s as crateAsSubcommand,
12
+ d as handler
9
13
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@done-coding/cli-publish",
3
- "version": "0.6.1-alpha.0",
3
+ "version": "0.7.0-alpha.0",
4
4
  "description": "项目发布命令行工具",
5
5
  "private": false,
6
6
  "module": "es/index.mjs",
@@ -40,9 +40,10 @@
40
40
  "license": "MIT",
41
41
  "sideEffects": false,
42
42
  "devDependencies": {
43
- "@done-coding/cli-inject": "^0.5.7-alpha.0",
43
+ "@done-coding/cli-inject": "^0.5.8-alpha.0",
44
44
  "@types/node": "^18.0.0",
45
45
  "@types/semver": "^7.5.3",
46
+ "@types/uuid": "^10.0.0",
46
47
  "@types/yargs": "^17.0.28",
47
48
  "rimraf": "^6.0.1",
48
49
  "typescript": "^5.2.2",
@@ -53,8 +54,9 @@
53
54
  "node": ">=18.0.0"
54
55
  },
55
56
  "dependencies": {
56
- "@done-coding/cli-utils": "^0.5.0-alpha.0",
57
- "semver": "^7.5.4"
57
+ "@done-coding/cli-utils": "^0.6.0-alpha.0",
58
+ "semver": "^7.5.4",
59
+ "uuid": "^11.1.0"
58
60
  },
59
- "gitHead": "86cdd3eaf8cc8be3e48a812b93fd7c2110fcc879"
61
+ "gitHead": "5879161383e32e7bed351d71d3ef607d81dc021a"
60
62
  }
@@ -0,0 +1,10 @@
1
+ /// <reference types="yargs" />
2
+ import type { CliHandlerArgv, SubCliInfo } from "@done-coding/cli-utils";
3
+ import type { AliasOptions, ConfigInfo } from '../types';
4
+ /** 获取别名发布选项 */
5
+ export declare const getAliasOptions: () => Record<keyof import("@done-coding/cli-utils").ConfigFileCommonOptions, import("yargs").Options>;
6
+ /** 获取别名发布信息列表 */
7
+ export declare const getAliasInfoList: (configInfo: ConfigInfo) => import('../types').ConfigInfoNpmAliasInfo[] | undefined;
8
+ /** 别名发布命令处理器 */
9
+ export declare const aliasHandler: (argv: CliHandlerArgv<AliasOptions>) => Promise<void>;
10
+ export declare const aliasCommandCliInfo: SubCliInfo;
@@ -1,7 +1,8 @@
1
1
  import { initHandler, initCommandCliInfo } from "./init";
2
2
  import { execHandler, execCommandCliInfo } from "./exec";
3
+ import { aliasHandler, aliasCommandCliInfo } from "./alias";
3
4
  import { SubcommandEnum } from '../types';
4
5
  import { type CliHandlerArgv, type CliInfo } from "@done-coding/cli-utils";
5
- export { initHandler, initCommandCliInfo, execHandler, execCommandCliInfo };
6
+ export { initHandler, initCommandCliInfo, execHandler, execCommandCliInfo, aliasHandler, aliasCommandCliInfo, };
6
7
  export declare const handler: (command: SubcommandEnum, argv: CliHandlerArgv<any>) => Promise<void>;
7
8
  export declare const commandCliInfo: Omit<CliInfo, "usage">;
@@ -1,6 +1,6 @@
1
1
  declare const _default: {
2
2
  "name": "@done-coding/cli-publish",
3
- "version": "0.6.1-alpha.0",
3
+ "version": "0.7.0-alpha.0",
4
4
  "description": "项目发布命令行工具",
5
5
  "cliConfig": {
6
6
  "namespaceDir": ".done-coding",
@@ -1,10 +1,12 @@
1
- import type { GetGitLastCommitParams, InitConfigFileOptions, ReadConfigFileOptions } from "@done-coding/cli-utils";
1
+ import type { GetGitLastCommitParams, InitConfigFileOptions, PackageJson, ReadConfigFileOptions } from "@done-coding/cli-utils";
2
2
  /** 子命令枚举 */
3
3
  export declare enum SubcommandEnum {
4
4
  /** 初始化发布配置文件 */
5
5
  INIT = "init",
6
6
  /** 发布执行 */
7
- EXEC = "exec"
7
+ EXEC = "exec",
8
+ /** 发布别名 */
9
+ ALIAS = "alias"
8
10
  }
9
11
  export type InitOptions = InitConfigFileOptions;
10
12
  /**
@@ -88,8 +90,16 @@ export interface ConfigInfoWeb extends GetGitLastCommitParams {
88
90
  */
89
91
  build?: string;
90
92
  }
93
+ /** 发布配置- npm模式-别名信息 */
94
+ export interface ConfigInfoNpmAliasInfo {
95
+ packageJson: Partial<Omit<PackageJson, "name">> & {
96
+ name: string;
97
+ };
98
+ }
91
99
  /** 发布配置- npm模式 */
92
100
  export interface ConfigInfoNpm extends GetGitLastCommitParams {
101
+ /** 别名信息 */
102
+ aliasInfo?: ConfigInfoNpmAliasInfo[];
93
103
  }
94
104
  /**
95
105
  * 配置信息
@@ -110,3 +120,5 @@ export interface ExecOptions extends ReadConfigFileOptions {
110
120
  /** (发布成功后)是否推送至远程仓库 */
111
121
  push: boolean;
112
122
  }
123
+ export interface AliasOptions extends ReadConfigFileOptions {
124
+ }
@@ -1,239 +0,0 @@
1
- #!/usr/bin/env node
2
- import { getConfigFileCommonOptions as v, initHandlerCommon as L, log as l, readConfigFile as b, getGitLastCommitInfo as x, getPackageJson as y, pushGitPublishInfoToRemote as J, xPrompts as S, createSubcommand as N, createMainCommand as D } from "@done-coding/cli-utils";
3
- import { execSync as E } from "node:child_process";
4
- import { inc as f, prerelease as _ } from "semver";
5
- var A = /* @__PURE__ */ ((e) => (e.INIT = "init", e.EXEC = "exec", e))(A || {}), t = /* @__PURE__ */ ((e) => (e.MAJOR = "major", e.MINOR = "minor", e.PATCH = "patch", e.PREMAJOR = "premajor", e.PREMINOR = "preminor", e.PREPATCH = "prepatch", e.PRERELEASE = "prerelease", e))(t || {}), p = /* @__PURE__ */ ((e) => (e.LATEST = "latest", e.NEXT = "next", e.ALPHA = "alpha", e))(p || {}), a = /* @__PURE__ */ ((e) => (e.NPM = "npm", e.WEB = "web", e))(a || {});
6
- const I = {
7
- name: "@done-coding/cli-publish",
8
- version: "0.6.1-alpha.0",
9
- description: "项目发布命令行工具",
10
- cliConfig: {
11
- namespaceDir: ".done-coding",
12
- moduleName: "publish"
13
- }
14
- }, {
15
- cliConfig: { namespaceDir: F, moduleName: j }
16
- } = I, G = `./${F}/${j}`, g = `${G}.json`, U = {
17
- [a.WEB]: {},
18
- [a.NPM]: {}
19
- }, B = () => v({
20
- configPathDefault: g
21
- }), M = async (e) => L(U, e, {
22
- onFileGenerated: () => {
23
- l.info("文件生成成功");
24
- }
25
- }), W = {
26
- command: A.INIT,
27
- describe: "初始化配置文件",
28
- options: B(),
29
- handler: M
30
- }, X = () => ({
31
- ...v({
32
- configPathDefault: g
33
- }),
34
- mode: {
35
- alias: "m",
36
- describe: "发布模式",
37
- choices: [a.NPM, a.WEB],
38
- default: a.NPM
39
- },
40
- type: {
41
- alias: "t",
42
- describe: "发布类型",
43
- choices: [
44
- t.MAJOR,
45
- t.MINOR,
46
- t.PATCH,
47
- t.PREMAJOR,
48
- t.PREMINOR,
49
- t.PREPATCH,
50
- t.PRERELEASE
51
- ]
52
- },
53
- push: {
54
- alias: "p",
55
- describe: "是否推送至远程仓库",
56
- type: "boolean",
57
- default: !0
58
- }
59
- }), C = ({
60
- packageJson: e,
61
- type: o
62
- }) => {
63
- let m = e.name, n = "", r;
64
- const { version: i } = e;
65
- if (!i)
66
- throw new Error("当前版本号为空");
67
- if ([
68
- t.MAJOR,
69
- t.MINOR,
70
- t.PATCH
71
- ].includes(o))
72
- n = f(i, o), r = p.LATEST;
73
- else if ([
74
- t.PREMAJOR,
75
- t.PREMINOR,
76
- t.PREPATCH
77
- ].includes(o)) {
78
- const s = _(i);
79
- s ? (l.warn("当前版本已经是预发布版本,将会在当前版本基础上进行发布"), s.length === 1 && typeof s[0] == "number" ? n = f(
80
- i,
81
- t.PRERELEASE
82
- ) : n = i.split("-")[0] + "-0") : n = f(i, o), r = p.NEXT;
83
- } else
84
- r = p.ALPHA, n = f(
85
- i,
86
- t.PRERELEASE,
87
- r
88
- );
89
- if (!n)
90
- throw new Error("version is empty");
91
- return {
92
- name: m,
93
- version: n,
94
- tag: r
95
- };
96
- }, k = async ({
97
- type: e,
98
- packageJson: o
99
- }) => {
100
- if (e)
101
- return await C({
102
- packageJson: o,
103
- type: e
104
- });
105
- {
106
- const n = Object.values(t).filter(
107
- (s) => s.toUpperCase() !== s
108
- ).reduce(
109
- (s, c) => (s[c] = C({
110
- packageJson: o,
111
- type: c
112
- }), s),
113
- {}
114
- ), r = [
115
- {
116
- title: `主版本(${n[t.MAJOR].version})`,
117
- value: t.MAJOR
118
- },
119
- {
120
- title: `次版本(${n[t.MINOR].version})`,
121
- value: t.MINOR
122
- },
123
- {
124
- title: `修订版本(${n[t.PATCH].version})`,
125
- value: t.PATCH
126
- },
127
- {
128
- title: `预发布主版本(${n[t.PREMAJOR].version})`,
129
- value: t.PREMAJOR
130
- },
131
- {
132
- title: `预发布次版本(${n[t.PREMINOR].version})`,
133
- value: t.PREMINOR
134
- },
135
- {
136
- title: `预发布修订版本(${n[t.PREPATCH].version})`,
137
- value: t.PREPATCH
138
- },
139
- {
140
- title: `alpha版本(${n[t.PRERELEASE].version})`,
141
- value: t.PRERELEASE
142
- }
143
- ], { type: i } = await S({
144
- type: "select",
145
- name: "type",
146
- message: `请选择发布类型,当前版本:${o.version}`,
147
- choices: r
148
- });
149
- return n[i];
150
- }
151
- }, O = async (e) => {
152
- const { mode: o, type: m, push: n, rootDir: r } = e, s = (await b(e, () => ({})))[o], c = await x(s), H = y({ rootDir: r }), d = await k({
153
- type: m,
154
- packageJson: H
155
- }), { version: P } = d;
156
- E(`npm version ${P}`, {
157
- cwd: r,
158
- stdio: "inherit"
159
- });
160
- const { tag: T } = d;
161
- try {
162
- switch (o) {
163
- case a.WEB: {
164
- const { build: R } = s;
165
- if (R)
166
- E(`${R}`, {
167
- stdio: "inherit",
168
- cwd: r
169
- });
170
- else
171
- throw new Error("未配置build命令");
172
- break;
173
- }
174
- case a.NPM: {
175
- E(`npm publish --tag ${T}`, {
176
- cwd: r,
177
- stdio: "inherit"
178
- });
179
- break;
180
- }
181
- default:
182
- throw new Error(`未知发布模式:${o}`);
183
- }
184
- } catch (R) {
185
- l.error(`发布失败, error: ${R.message}`);
186
- try {
187
- l.info(`回滚本地版本到发布前的版本:${c.lastHash}`);
188
- const { lastHash: u } = c;
189
- E(`git reset --hard ${u}`, {
190
- stdio: "inherit"
191
- }), l.info(`删除本次发布时生成的tag:v${d.version}`), E(`git tag -d v${d.version}`, {
192
- stdio: "inherit"
193
- });
194
- } catch (u) {
195
- l.error(`回滚失败, error: ${u.message}`);
196
- }
197
- return process.exit(1);
198
- }
199
- n && J({
200
- branchName: c.branchName,
201
- version: d.version,
202
- remoteInfo: c.remoteInfo
203
- }), l.success(`发布成功,版本号:${P}`);
204
- }, q = {
205
- command: "$0",
206
- describe: "执行发布命令",
207
- options: X(),
208
- handler: O
209
- }, V = async (e, o) => {
210
- switch (e) {
211
- case A.INIT:
212
- return M(o);
213
- case A.EXEC:
214
- return O(o);
215
- default:
216
- throw new Error(`不支持的命令 ${e}`);
217
- }
218
- }, { version: z, description: K } = I, $ = {
219
- describe: K,
220
- version: z,
221
- subcommands: [W, q].map(N),
222
- demandCommandCount: 1
223
- }, {
224
- cliConfig: { moduleName: h }
225
- } = I, w = (e = !1) => {
226
- const o = e ? h : void 0, m = `$0${e ? ` ${h}` : ""} [options]`;
227
- return { command: o, usage: m };
228
- }, ee = async () => D({
229
- ...$,
230
- ...w()
231
- }), te = () => N({
232
- ...$,
233
- ...w(!0)
234
- });
235
- export {
236
- te as a,
237
- ee as c,
238
- V as h
239
- };
File without changes
File without changes