@done-coding/cli-publish 0.7.0 → 0.7.2-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 +1 -1
- package/es/{index-1f21f649.js → index-960a1b56.js} +46 -42
- package/es/index.mjs +7 -3
- package/package.json +4 -4
- package/types/cli.d.ts +1 -2
- package/types/index.d.ts +148 -2
- package/types/config/index.d.ts +0 -3
- package/types/handlers/alias.d.ts +0 -10
- package/types/handlers/exec.d.ts +0 -5
- package/types/handlers/index.d.ts +0 -8
- package/types/handlers/init.d.ts +0 -8
- package/types/injectInfo.json.d.ts +0 -11
- package/types/main.d.ts +0 -9
- package/types/types/index.d.ts +0 -124
- package/types/utils/index.d.ts +0 -1
- package/types/utils/path.d.ts +0 -6
package/es/cli.mjs
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { getConfigFileCommonOptions as v, initHandlerCommon as U, log as
|
|
2
|
+
import { getConfigFileCommonOptions as v, initHandlerCommon as U, log as d, readConfigFile as J, getPackageJson as C, getGitLastCommitInfo as j, pushGitPublishInfoToRemote as G, xPrompts as W, createSubcommand as b, createMainCommand as X } from "@done-coding/cli-utils";
|
|
3
3
|
import { tmpdir as q } from "node:os";
|
|
4
4
|
import { execSync as f } from "node:child_process";
|
|
5
5
|
import { inc as A, prerelease as z } from "semver";
|
|
6
6
|
import { v4 as K } from "uuid";
|
|
7
7
|
import w from "node:path";
|
|
8
8
|
import T, { rmSync as Q } from "node:fs";
|
|
9
|
-
var E = /* @__PURE__ */ ((e) => (e.INIT = "init", e.EXEC = "exec", e.ALIAS = "alias", e))(E || {}), 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 || {}),
|
|
9
|
+
var E = /* @__PURE__ */ ((e) => (e.INIT = "init", e.EXEC = "exec", e.ALIAS = "alias", e))(E || {}), 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 || {}), l = /* @__PURE__ */ ((e) => (e.NPM = "npm", e.WEB = "web", e))(l || {});
|
|
10
10
|
const $ = {
|
|
11
11
|
name: "@done-coding/cli-publish",
|
|
12
|
-
version: "0.7.0",
|
|
12
|
+
version: "0.7.2-alpha.0",
|
|
13
13
|
description: "项目发布命令行工具",
|
|
14
14
|
cliConfig: {
|
|
15
15
|
namespaceDir: ".done-coding",
|
|
@@ -32,27 +32,27 @@ const $ = {
|
|
|
32
32
|
}
|
|
33
33
|
}, ne = () => v({
|
|
34
34
|
configPathDefault: N
|
|
35
|
-
}),
|
|
35
|
+
}), D = async (e) => U(te, e, {
|
|
36
36
|
onFileGenerated: () => {
|
|
37
|
-
|
|
37
|
+
d.info("文件生成成功");
|
|
38
38
|
}
|
|
39
39
|
}), oe = {
|
|
40
40
|
command: E.INIT,
|
|
41
41
|
describe: "初始化配置文件",
|
|
42
42
|
options: ne(),
|
|
43
|
-
handler:
|
|
43
|
+
handler: D
|
|
44
44
|
}, se = () => v({
|
|
45
45
|
configPathDefault: N
|
|
46
|
-
}),
|
|
46
|
+
}), _ = (e) => {
|
|
47
47
|
var a;
|
|
48
48
|
const n = ((a = e[l.NPM]) == null ? void 0 : a.aliasInfo) || [];
|
|
49
49
|
if (n.length)
|
|
50
50
|
return n;
|
|
51
51
|
}, L = async (e) => {
|
|
52
52
|
var O;
|
|
53
|
-
const n = await J(e, () => ({})), a =
|
|
53
|
+
const n = await J(e, () => ({})), a = _(n);
|
|
54
54
|
if (!a) {
|
|
55
|
-
|
|
55
|
+
d.warn("没有配置别名发布信息");
|
|
56
56
|
return;
|
|
57
57
|
}
|
|
58
58
|
const { rootDir: o } = e, i = C({ rootDir: o }), { name: s, version: r } = i, c = w.resolve(Y, K());
|
|
@@ -65,21 +65,21 @@ const $ = {
|
|
|
65
65
|
([, I]) => I === r
|
|
66
66
|
)) == null ? void 0 : O[0];
|
|
67
67
|
if (!R)
|
|
68
|
-
return
|
|
69
|
-
const
|
|
70
|
-
rootDir:
|
|
68
|
+
return d.warn(`没有找到 ${s}@${r} 对应的dist-tag`);
|
|
69
|
+
const m = w.resolve(c, "node_modules", s), u = C({
|
|
70
|
+
rootDir: m
|
|
71
71
|
});
|
|
72
72
|
for (let I of a) {
|
|
73
73
|
const { packageJson: h } = I, B = {
|
|
74
74
|
...u,
|
|
75
75
|
...h
|
|
76
|
-
}, F = `${
|
|
76
|
+
}, F = `${m}/package.json`;
|
|
77
77
|
T.writeFileSync(
|
|
78
78
|
F,
|
|
79
79
|
JSON.stringify(B, null, 2)
|
|
80
80
|
), f(`pnpm publish --tag ${R}`, {
|
|
81
81
|
stdio: "inherit",
|
|
82
|
-
cwd:
|
|
82
|
+
cwd: m
|
|
83
83
|
});
|
|
84
84
|
}
|
|
85
85
|
Q(c, { recursive: !0, force: !0 });
|
|
@@ -117,7 +117,7 @@ const $ = {
|
|
|
117
117
|
type: "boolean",
|
|
118
118
|
default: !0
|
|
119
119
|
}
|
|
120
|
-
}),
|
|
120
|
+
}), S = ({
|
|
121
121
|
packageJson: e,
|
|
122
122
|
type: n
|
|
123
123
|
}) => {
|
|
@@ -130,19 +130,19 @@ const $ = {
|
|
|
130
130
|
t.MINOR,
|
|
131
131
|
t.PATCH
|
|
132
132
|
].includes(n))
|
|
133
|
-
o = A(s, n), i =
|
|
133
|
+
o = A(s, n), i = P.LATEST;
|
|
134
134
|
else if ([
|
|
135
135
|
t.PREMAJOR,
|
|
136
136
|
t.PREMINOR,
|
|
137
137
|
t.PREPATCH
|
|
138
138
|
].includes(n)) {
|
|
139
139
|
const r = z(s);
|
|
140
|
-
r ? (
|
|
140
|
+
r ? (d.warn("当前版本已经是预发布版本,将会在当前版本基础上进行发布"), r.length === 1 && typeof r[0] == "number" ? o = A(
|
|
141
141
|
s,
|
|
142
142
|
t.PRERELEASE
|
|
143
|
-
) : o = s.split("-")[0] + "-0") : o = A(s, n), i =
|
|
143
|
+
) : o = s.split("-")[0] + "-0") : o = A(s, n), i = P.NEXT;
|
|
144
144
|
} else
|
|
145
|
-
i =
|
|
145
|
+
i = P.ALPHA, o = A(
|
|
146
146
|
s,
|
|
147
147
|
t.PRERELEASE,
|
|
148
148
|
i
|
|
@@ -159,7 +159,7 @@ const $ = {
|
|
|
159
159
|
packageJson: n
|
|
160
160
|
}) => {
|
|
161
161
|
if (e)
|
|
162
|
-
return await
|
|
162
|
+
return await S({
|
|
163
163
|
packageJson: n,
|
|
164
164
|
type: e
|
|
165
165
|
});
|
|
@@ -167,7 +167,7 @@ const $ = {
|
|
|
167
167
|
const o = Object.values(t).filter(
|
|
168
168
|
(r) => r.toUpperCase() !== r
|
|
169
169
|
).reduce(
|
|
170
|
-
(r, c) => (r[c] =
|
|
170
|
+
(r, c) => (r[c] = S({
|
|
171
171
|
packageJson: n,
|
|
172
172
|
type: c
|
|
173
173
|
}), r),
|
|
@@ -213,8 +213,8 @@ const $ = {
|
|
|
213
213
|
const { mode: n, type: a, push: o, rootDir: i } = e, s = await J(e, () => ({})), r = s[n], c = await j(r), M = C({ rootDir: i }), p = await ae({
|
|
214
214
|
type: a,
|
|
215
215
|
packageJson: M
|
|
216
|
-
}), { version:
|
|
217
|
-
f(`npm version ${
|
|
216
|
+
}), { version: g } = p;
|
|
217
|
+
f(`npm version ${g}`, {
|
|
218
218
|
cwd: i,
|
|
219
219
|
stdio: "inherit"
|
|
220
220
|
});
|
|
@@ -222,9 +222,9 @@ const $ = {
|
|
|
222
222
|
try {
|
|
223
223
|
switch (n) {
|
|
224
224
|
case l.WEB: {
|
|
225
|
-
const { build:
|
|
226
|
-
if (
|
|
227
|
-
f(`${
|
|
225
|
+
const { build: m } = r;
|
|
226
|
+
if (m)
|
|
227
|
+
f(`${m}`, {
|
|
228
228
|
stdio: "inherit",
|
|
229
229
|
cwd: i
|
|
230
230
|
});
|
|
@@ -242,18 +242,18 @@ const $ = {
|
|
|
242
242
|
default:
|
|
243
243
|
throw new Error(`未知发布模式:${n}`);
|
|
244
244
|
}
|
|
245
|
-
} catch (
|
|
246
|
-
|
|
245
|
+
} catch (m) {
|
|
246
|
+
d.error(`发布失败, error: ${m.message}`);
|
|
247
247
|
try {
|
|
248
|
-
|
|
248
|
+
d.info(`回滚本地版本到发布前的版本:${c.lastHash}`);
|
|
249
249
|
const { lastHash: u } = c;
|
|
250
250
|
f(`git reset --hard ${u}`, {
|
|
251
251
|
stdio: "inherit"
|
|
252
|
-
}),
|
|
252
|
+
}), d.info(`删除本次发布时生成的tag:v${p.version}`), f(`git tag -d v${p.version}`, {
|
|
253
253
|
stdio: "inherit"
|
|
254
254
|
});
|
|
255
255
|
} catch (u) {
|
|
256
|
-
|
|
256
|
+
d.error(`回滚失败, error: ${u.message}`);
|
|
257
257
|
}
|
|
258
258
|
return process.exit(1);
|
|
259
259
|
}
|
|
@@ -261,7 +261,7 @@ const $ = {
|
|
|
261
261
|
branchName: c.branchName,
|
|
262
262
|
version: p.version,
|
|
263
263
|
remoteInfo: c.remoteInfo
|
|
264
|
-
}),
|
|
264
|
+
}), d.success(`发布成功,版本号:${g}`), n === l.NPM && _(s) && L(e);
|
|
265
265
|
}, ce = {
|
|
266
266
|
command: "$0",
|
|
267
267
|
describe: "执行发布命令",
|
|
@@ -270,7 +270,7 @@ const $ = {
|
|
|
270
270
|
}, Ae = async (e, n) => {
|
|
271
271
|
switch (e) {
|
|
272
272
|
case E.INIT:
|
|
273
|
-
return
|
|
273
|
+
return D(n);
|
|
274
274
|
case E.EXEC:
|
|
275
275
|
return y(n);
|
|
276
276
|
case E.ALIAS:
|
|
@@ -278,29 +278,33 @@ const $ = {
|
|
|
278
278
|
default:
|
|
279
279
|
throw new Error(`不支持的命令 ${e}`);
|
|
280
280
|
}
|
|
281
|
-
}, { version: le, description:
|
|
282
|
-
describe:
|
|
281
|
+
}, { version: le, description: de } = $, k = {
|
|
282
|
+
describe: de,
|
|
283
283
|
version: le,
|
|
284
284
|
subcommands: [
|
|
285
285
|
oe,
|
|
286
286
|
ce,
|
|
287
287
|
re
|
|
288
|
-
].map(
|
|
288
|
+
].map(b),
|
|
289
289
|
demandCommandCount: 1
|
|
290
290
|
}, {
|
|
291
|
-
cliConfig: { moduleName:
|
|
291
|
+
cliConfig: { moduleName: H }
|
|
292
292
|
} = $, x = (e = !1) => {
|
|
293
|
-
const n = e ?
|
|
293
|
+
const n = e ? H : void 0, a = `$0${e ? ` ${H}` : ""} [options]`;
|
|
294
294
|
return { command: n, usage: a };
|
|
295
|
-
},
|
|
295
|
+
}, Pe = async () => X({
|
|
296
296
|
...k,
|
|
297
297
|
...x()
|
|
298
|
-
}),
|
|
298
|
+
}), ge = () => b({
|
|
299
299
|
...k,
|
|
300
300
|
...x(!0)
|
|
301
301
|
});
|
|
302
302
|
export {
|
|
303
|
-
|
|
304
|
-
|
|
303
|
+
t as P,
|
|
304
|
+
E as S,
|
|
305
|
+
ge as a,
|
|
306
|
+
P as b,
|
|
307
|
+
Pe as c,
|
|
308
|
+
l as d,
|
|
305
309
|
Ae as h
|
|
306
310
|
};
|
package/es/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { a as
|
|
2
|
+
import { d as t, b as e, P as b, S as d, a as h, h as l } from "./index-960a1b56.js";
|
|
3
3
|
import "@done-coding/cli-utils";
|
|
4
4
|
import "node:os";
|
|
5
5
|
import "node:child_process";
|
|
@@ -8,6 +8,10 @@ import "uuid";
|
|
|
8
8
|
import "node:path";
|
|
9
9
|
import "node:fs";
|
|
10
10
|
export {
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
t as PublishModeEnum,
|
|
12
|
+
e as PublishTagEnum,
|
|
13
|
+
b as PublishVersionTypeEnum,
|
|
14
|
+
d as SubcommandEnum,
|
|
15
|
+
h as crateAsSubcommand,
|
|
16
|
+
l as handler
|
|
13
17
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@done-coding/cli-publish",
|
|
3
|
-
"version": "0.7.0",
|
|
3
|
+
"version": "0.7.2-alpha.0",
|
|
4
4
|
"description": "项目发布命令行工具",
|
|
5
5
|
"private": false,
|
|
6
6
|
"module": "es/index.mjs",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"license": "MIT",
|
|
41
41
|
"sideEffects": false,
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@done-coding/cli-inject": "^0.5.
|
|
43
|
+
"@done-coding/cli-inject": "^0.5.10-alpha.0",
|
|
44
44
|
"@types/node": "^18.0.0",
|
|
45
45
|
"@types/semver": "^7.5.3",
|
|
46
46
|
"@types/uuid": "^10.0.0",
|
|
@@ -54,9 +54,9 @@
|
|
|
54
54
|
"node": ">=18.0.0"
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@done-coding/cli-utils": "^0.7.0",
|
|
57
|
+
"@done-coding/cli-utils": "^0.7.1-alpha.0",
|
|
58
58
|
"semver": "^7.5.4",
|
|
59
59
|
"uuid": "^11.1.0"
|
|
60
60
|
},
|
|
61
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "3376f5fbbf8b87c791316e76df06028afd650e08"
|
|
62
62
|
}
|
package/types/cli.d.ts
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export {};
|
|
1
|
+
export { }
|
package/types/index.d.ts
CHANGED
|
@@ -1,2 +1,148 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { CliHandlerArgv } from '@done-coding/cli-utils';
|
|
2
|
+
import { CommandModule } from 'yargs';
|
|
3
|
+
import type { GetGitLastCommitParams } from '@done-coding/cli-utils';
|
|
4
|
+
import type { InitConfigFileOptions } from '@done-coding/cli-utils';
|
|
5
|
+
import type { PackageJson } from '@done-coding/cli-utils';
|
|
6
|
+
import type { ReadConfigFileOptions } from '@done-coding/cli-utils';
|
|
7
|
+
|
|
8
|
+
export declare interface AliasOptions extends ReadConfigFileOptions {
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* 配置信息
|
|
13
|
+
*/
|
|
14
|
+
export declare interface ConfigInfo {
|
|
15
|
+
/** web发布配置 */
|
|
16
|
+
[PublishModeEnum.WEB]?: ConfigInfoWeb;
|
|
17
|
+
/** NPM发布配置 */
|
|
18
|
+
[PublishModeEnum.NPM]?: ConfigInfoNpm;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** 发布配置- npm模式 */
|
|
22
|
+
export declare interface ConfigInfoNpm extends GetGitLastCommitParams {
|
|
23
|
+
/** 别名信息 */
|
|
24
|
+
aliasInfo?: ConfigInfoNpmAliasInfo[];
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** 发布配置- npm模式-别名信息 */
|
|
28
|
+
export declare interface ConfigInfoNpmAliasInfo {
|
|
29
|
+
packageJson: Partial<Omit<PackageJson, "name">> & {
|
|
30
|
+
name: string;
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** 发布配置- web模式 */
|
|
35
|
+
export declare interface ConfigInfoWeb extends GetGitLastCommitParams {
|
|
36
|
+
/**
|
|
37
|
+
* web构建命令
|
|
38
|
+
*/
|
|
39
|
+
build?: string;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** 作为子命令创建 */
|
|
43
|
+
export declare const crateAsSubcommand: () => CommandModule<{}, {}>;
|
|
44
|
+
|
|
45
|
+
export declare interface ExecOptions extends ReadConfigFileOptions {
|
|
46
|
+
/** 发布模式 */
|
|
47
|
+
mode: PublishModeEnum;
|
|
48
|
+
/**
|
|
49
|
+
* 发布类型
|
|
50
|
+
*/
|
|
51
|
+
type?: PublishVersionTypeEnum;
|
|
52
|
+
/** (发布成功后)是否推送至远程仓库 */
|
|
53
|
+
push: boolean;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export declare const handler: (command: SubcommandEnum, argv: CliHandlerArgv<any>) => Promise<void>;
|
|
57
|
+
|
|
58
|
+
export declare type InitOptions = InitConfigFileOptions;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* npm信息
|
|
62
|
+
*/
|
|
63
|
+
export declare interface NpmInfo {
|
|
64
|
+
/**
|
|
65
|
+
* 正式包名
|
|
66
|
+
*/
|
|
67
|
+
name: string;
|
|
68
|
+
/**
|
|
69
|
+
* 当前版本号
|
|
70
|
+
*/
|
|
71
|
+
version: string;
|
|
72
|
+
/**
|
|
73
|
+
* 标签
|
|
74
|
+
*/
|
|
75
|
+
tag: PublishTagEnum;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/** 发布模式 */
|
|
79
|
+
export declare enum PublishModeEnum {
|
|
80
|
+
/** npm发布模式 */
|
|
81
|
+
NPM = "npm",
|
|
82
|
+
/** web发布模式 */
|
|
83
|
+
WEB = "web"
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* 发布标签类型
|
|
88
|
+
*/
|
|
89
|
+
export declare enum PublishTagEnum {
|
|
90
|
+
/**
|
|
91
|
+
* 最新版本
|
|
92
|
+
*/
|
|
93
|
+
LATEST = "latest",
|
|
94
|
+
/**
|
|
95
|
+
* next版本
|
|
96
|
+
*/
|
|
97
|
+
NEXT = "next",
|
|
98
|
+
/**
|
|
99
|
+
* alpha版本
|
|
100
|
+
*/
|
|
101
|
+
ALPHA = "alpha"
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* 发布版本类型
|
|
106
|
+
*/
|
|
107
|
+
export declare enum PublishVersionTypeEnum {
|
|
108
|
+
/**
|
|
109
|
+
* 主版本号
|
|
110
|
+
*/
|
|
111
|
+
MAJOR = "major",
|
|
112
|
+
/**
|
|
113
|
+
* 次版本号
|
|
114
|
+
*/
|
|
115
|
+
MINOR = "minor",
|
|
116
|
+
/**
|
|
117
|
+
* 修订版本号
|
|
118
|
+
*/
|
|
119
|
+
PATCH = "patch",
|
|
120
|
+
/**
|
|
121
|
+
* 预发布版本号
|
|
122
|
+
*/
|
|
123
|
+
PREMAJOR = "premajor",
|
|
124
|
+
/**
|
|
125
|
+
* 预发布次版本号
|
|
126
|
+
*/
|
|
127
|
+
PREMINOR = "preminor",
|
|
128
|
+
/**
|
|
129
|
+
* 预发布修订版本号
|
|
130
|
+
*/
|
|
131
|
+
PREPATCH = "prepatch",
|
|
132
|
+
/**
|
|
133
|
+
* 预发布版本号
|
|
134
|
+
*/
|
|
135
|
+
PRERELEASE = "prerelease"
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/** 子命令枚举 */
|
|
139
|
+
export declare enum SubcommandEnum {
|
|
140
|
+
/** 初始化发布配置文件 */
|
|
141
|
+
INIT = "init",
|
|
142
|
+
/** 发布执行 */
|
|
143
|
+
EXEC = "exec",
|
|
144
|
+
/** 发布别名 */
|
|
145
|
+
ALIAS = "alias"
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
export { }
|
package/types/config/index.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
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;
|
package/types/handlers/exec.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { ExecOptions } from '../types';
|
|
2
|
-
import type { CliHandlerArgv, CliInfo, SubCliInfo } from "@done-coding/cli-utils";
|
|
3
|
-
export declare const getExecOptions: () => CliInfo["options"];
|
|
4
|
-
export declare const execHandler: (argv: CliHandlerArgv<ExecOptions>) => Promise<undefined>;
|
|
5
|
-
export declare const execCommandCliInfo: SubCliInfo;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { initHandler, initCommandCliInfo } from "./init";
|
|
2
|
-
import { execHandler, execCommandCliInfo } from "./exec";
|
|
3
|
-
import { aliasHandler, aliasCommandCliInfo } from "./alias";
|
|
4
|
-
import { SubcommandEnum } from '../types';
|
|
5
|
-
import { type CliHandlerArgv, type CliInfo } from "@done-coding/cli-utils";
|
|
6
|
-
export { initHandler, initCommandCliInfo, execHandler, execCommandCliInfo, aliasHandler, aliasCommandCliInfo, };
|
|
7
|
-
export declare const handler: (command: SubcommandEnum, argv: CliHandlerArgv<any>) => Promise<void>;
|
|
8
|
-
export declare const commandCliInfo: Omit<CliInfo, "usage">;
|
package/types/handlers/init.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/// <reference types="yargs" />
|
|
2
|
-
import type { CliHandlerArgv, SubCliInfo } from "@done-coding/cli-utils";
|
|
3
|
-
import { type InitOptions } from '../types';
|
|
4
|
-
/** 获取初始化选项 */
|
|
5
|
-
export declare const getInitOptions: () => Record<keyof import("@done-coding/cli-utils").ConfigFileCommonOptions, import("yargs").Options>;
|
|
6
|
-
/** 初始化命令处理器 */
|
|
7
|
-
export declare const initHandler: (argv: CliHandlerArgv<InitOptions>) => Promise<void>;
|
|
8
|
-
export declare const initCommandCliInfo: SubCliInfo;
|
package/types/main.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/// <reference types="yargs" />
|
|
2
|
-
/** 作为主命令创建 */
|
|
3
|
-
export declare const createCommand: () => Promise<void | {
|
|
4
|
-
[x: string]: unknown;
|
|
5
|
-
_: (string | number)[];
|
|
6
|
-
$0: string;
|
|
7
|
-
}>;
|
|
8
|
-
/** 作为子命令创建 */
|
|
9
|
-
export declare const crateAsSubcommand: () => import("yargs").CommandModule<{}, {}>;
|
package/types/types/index.d.ts
DELETED
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
import type { GetGitLastCommitParams, InitConfigFileOptions, PackageJson, ReadConfigFileOptions } from "@done-coding/cli-utils";
|
|
2
|
-
/** 子命令枚举 */
|
|
3
|
-
export declare enum SubcommandEnum {
|
|
4
|
-
/** 初始化发布配置文件 */
|
|
5
|
-
INIT = "init",
|
|
6
|
-
/** 发布执行 */
|
|
7
|
-
EXEC = "exec",
|
|
8
|
-
/** 发布别名 */
|
|
9
|
-
ALIAS = "alias"
|
|
10
|
-
}
|
|
11
|
-
export type InitOptions = InitConfigFileOptions;
|
|
12
|
-
/**
|
|
13
|
-
* 发布版本类型
|
|
14
|
-
*/
|
|
15
|
-
export declare enum PublishVersionTypeEnum {
|
|
16
|
-
/**
|
|
17
|
-
* 主版本号
|
|
18
|
-
*/
|
|
19
|
-
MAJOR = "major",
|
|
20
|
-
/**
|
|
21
|
-
* 次版本号
|
|
22
|
-
*/
|
|
23
|
-
MINOR = "minor",
|
|
24
|
-
/**
|
|
25
|
-
* 修订版本号
|
|
26
|
-
*/
|
|
27
|
-
PATCH = "patch",
|
|
28
|
-
/**
|
|
29
|
-
* 预发布版本号
|
|
30
|
-
*/
|
|
31
|
-
PREMAJOR = "premajor",
|
|
32
|
-
/**
|
|
33
|
-
* 预发布次版本号
|
|
34
|
-
*/
|
|
35
|
-
PREMINOR = "preminor",
|
|
36
|
-
/**
|
|
37
|
-
* 预发布修订版本号
|
|
38
|
-
*/
|
|
39
|
-
PREPATCH = "prepatch",
|
|
40
|
-
/**
|
|
41
|
-
* 预发布版本号
|
|
42
|
-
*/
|
|
43
|
-
PRERELEASE = "prerelease"
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* 发布标签类型
|
|
47
|
-
*/
|
|
48
|
-
export declare enum PublishTagEnum {
|
|
49
|
-
/**
|
|
50
|
-
* 最新版本
|
|
51
|
-
*/
|
|
52
|
-
LATEST = "latest",
|
|
53
|
-
/**
|
|
54
|
-
* next版本
|
|
55
|
-
*/
|
|
56
|
-
NEXT = "next",
|
|
57
|
-
/**
|
|
58
|
-
* alpha版本
|
|
59
|
-
*/
|
|
60
|
-
ALPHA = "alpha"
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* npm信息
|
|
64
|
-
*/
|
|
65
|
-
export interface NpmInfo {
|
|
66
|
-
/**
|
|
67
|
-
* 正式包名
|
|
68
|
-
*/
|
|
69
|
-
name: string;
|
|
70
|
-
/**
|
|
71
|
-
* 当前版本号
|
|
72
|
-
*/
|
|
73
|
-
version: string;
|
|
74
|
-
/**
|
|
75
|
-
* 标签
|
|
76
|
-
*/
|
|
77
|
-
tag: PublishTagEnum;
|
|
78
|
-
}
|
|
79
|
-
/** 发布模式 */
|
|
80
|
-
export declare enum PublishModeEnum {
|
|
81
|
-
/** npm发布模式 */
|
|
82
|
-
NPM = "npm",
|
|
83
|
-
/** web发布模式 */
|
|
84
|
-
WEB = "web"
|
|
85
|
-
}
|
|
86
|
-
/** 发布配置- web模式 */
|
|
87
|
-
export interface ConfigInfoWeb extends GetGitLastCommitParams {
|
|
88
|
-
/**
|
|
89
|
-
* web构建命令
|
|
90
|
-
*/
|
|
91
|
-
build?: string;
|
|
92
|
-
}
|
|
93
|
-
/** 发布配置- npm模式-别名信息 */
|
|
94
|
-
export interface ConfigInfoNpmAliasInfo {
|
|
95
|
-
packageJson: Partial<Omit<PackageJson, "name">> & {
|
|
96
|
-
name: string;
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
/** 发布配置- npm模式 */
|
|
100
|
-
export interface ConfigInfoNpm extends GetGitLastCommitParams {
|
|
101
|
-
/** 别名信息 */
|
|
102
|
-
aliasInfo?: ConfigInfoNpmAliasInfo[];
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* 配置信息
|
|
106
|
-
*/
|
|
107
|
-
export interface ConfigInfo {
|
|
108
|
-
/** web发布配置 */
|
|
109
|
-
[PublishModeEnum.WEB]?: ConfigInfoWeb;
|
|
110
|
-
/** NPM发布配置 */
|
|
111
|
-
[PublishModeEnum.NPM]?: ConfigInfoNpm;
|
|
112
|
-
}
|
|
113
|
-
export interface ExecOptions extends ReadConfigFileOptions {
|
|
114
|
-
/** 发布模式 */
|
|
115
|
-
mode: PublishModeEnum;
|
|
116
|
-
/**
|
|
117
|
-
* 发布类型
|
|
118
|
-
*/
|
|
119
|
-
type?: PublishVersionTypeEnum;
|
|
120
|
-
/** (发布成功后)是否推送至远程仓库 */
|
|
121
|
-
push: boolean;
|
|
122
|
-
}
|
|
123
|
-
export interface AliasOptions extends ReadConfigFileOptions {
|
|
124
|
-
}
|
package/types/utils/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./path";
|
package/types/utils/path.d.ts
DELETED