@done-coding/cli-publish 0.7.14-alpha.2 → 0.7.15-alpha.1

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,7 +1,8 @@
1
1
  #!/usr/bin/env node
2
- import { c as m } from "./index-65e39d54.js";
2
+ import { c as m } from "./index-5b34f98a.js";
3
3
  import "@done-coding/cli-utils";
4
4
  import "semver";
5
5
  import "node:path";
6
6
  import "node:fs";
7
+ import "node:child_process";
7
8
  m();
@@ -1,12 +1,13 @@
1
1
  #!/usr/bin/env node
2
- import { getConfigFileCommonOptions as O, initHandlerCommon as F, log as m, readConfigFile as H, getPackageJson as L, applyUseTempDir as U, getCliModuleTempDir as G, execSyncWithLogDispatch as l, getGitLastCommitInfo as W, pushGitPublishInfoToRemote as X, xPrompts as $, createSubcommand as y, getRootScriptName as V, createMainCommand as q } from "@done-coding/cli-utils";
2
+ import { getConfigFileCommonOptions as O, initHandlerCommon as F, outputConsole as m, readConfigFile as H, getPackageJson as $, applyUseTempDir as U, getCliModuleTempDir as G, getGitLastCommitInfo as W, pushGitPublishInfoToRemote as X, xPrompts as L, createSubcommand as y, getRootScriptName as V, createMainCommand as q } from "@done-coding/cli-utils";
3
3
  import { inc as N } from "semver";
4
4
  import z from "node:path";
5
5
  import S, { rmSync as K } from "node:fs";
6
+ import { execSync as l } from "node:child_process";
6
7
  var I = /* @__PURE__ */ ((e) => (e.INIT = "init", e.EXEC = "exec", e.ALIAS = "alias", e))(I || {}), r = /* @__PURE__ */ ((e) => (e.MAJOR = "major", e.MINOR = "minor", e.PATCH = "patch", e.PREMAJOR = "premajor", e.PREMINOR = "preminor", e.PREPATCH = "prepatch", e.PRERELEASE = "prerelease", e.CUSTOM_VERSION = "custom version", e))(r || {}), f = /* @__PURE__ */ ((e) => (e.LATEST = "latest", e.NEXT = "next", e.ALPHA = "alpha", e.BETA = "beta", e.RC = "rc", e))(f || {}), c = /* @__PURE__ */ ((e) => (e.NPM = "npm", e.WEB = "web", e))(c || {});
7
8
  const R = {
8
9
  name: "@done-coding/cli-publish",
9
- version: "0.7.14-alpha.2",
10
+ version: "0.7.15-alpha.1",
10
11
  description: "项目发布命令行工具",
11
12
  bin: {
12
13
  "dc-publish": "es/cli.mjs"
@@ -54,7 +55,7 @@ const R = {
54
55
  m.warn("没有配置别名发布信息");
55
56
  return;
56
57
  }
57
- const { rootDir: d } = e, s = L({ rootDir: d }), { name: i, version: a } = s;
58
+ const { rootDir: d } = e, s = $({ rootDir: d }), { name: i, version: a } = s;
58
59
  return U({
59
60
  dir: G(R.cliConfig.moduleName),
60
61
  fn: async (n) => {
@@ -63,13 +64,13 @@ const R = {
63
64
  stdio: "inherit",
64
65
  cwd: n
65
66
  });
66
- const A = (g = l(`npm dist-tag ${i}`).toString().trim().split(`
67
+ const h = (g = l(`npm dist-tag ${i}`).toString().trim().split(`
67
68
  `).map((E) => E.split(":").map((w) => w.trim())).find(
68
69
  ([, E]) => E === a
69
70
  )) == null ? void 0 : g[0];
70
- if (!A)
71
+ if (!h)
71
72
  return m.warn(`没有找到 ${i}@${a} 对应的dist-tag`);
72
- const C = z.resolve(n, "node_modules", i), u = L({
73
+ const C = z.resolve(n, "node_modules", i), u = $({
73
74
  rootDir: C
74
75
  });
75
76
  for (let E of o) {
@@ -80,7 +81,7 @@ const R = {
80
81
  S.writeFileSync(
81
82
  B,
82
83
  JSON.stringify(j, null, 2)
83
- ), l(`pnpm publish --tag ${A}`, {
84
+ ), l(`pnpm publish --tag ${h}`, {
84
85
  stdio: "inherit",
85
86
  cwd: C
86
87
  });
@@ -142,7 +143,7 @@ const R = {
142
143
  break;
143
144
  }
144
145
  case r.PRERELEASE: {
145
- const n = (await $({
146
+ const n = (await L({
146
147
  type: "text",
147
148
  name: "identifier",
148
149
  message: "请输入修饰符",
@@ -152,7 +153,7 @@ const R = {
152
153
  break;
153
154
  }
154
155
  default:
155
- s = (await $({
156
+ s = (await L({
156
157
  type: "text",
157
158
  name: "customVersion",
158
159
  message: "请输入自定义版本号"
@@ -203,7 +204,7 @@ const R = {
203
204
  title: n,
204
205
  value: n
205
206
  }))
206
- ], a = (await $({
207
+ ], a = (await L({
207
208
  type: "select",
208
209
  name: "selectType",
209
210
  message: `请选择发布类型,当前版本:${t.version}`,
@@ -216,12 +217,12 @@ const R = {
216
217
  });
217
218
  }
218
219
  }, x = async (e) => {
219
- const { mode: t, type: o, push: d, rootDir: s, distTag: i } = e, a = await H(e, () => ({})), n = a[t], h = await W(n), T = L({ rootDir: s }), p = await ae({
220
+ const { mode: t, type: o, push: d, rootDir: s, distTag: i } = e, a = await H(e, () => ({})), n = a[t], A = await W(n), T = $({ rootDir: s }), p = await ae({
220
221
  type: o,
221
222
  packageJson: T,
222
223
  distTag: i
223
- }), { version: A } = p;
224
- l(`npm version ${A}`, {
224
+ }), { version: h } = p;
225
+ l(`npm version ${h}`, {
225
226
  cwd: s,
226
227
  stdio: "inherit"
227
228
  });
@@ -252,8 +253,10 @@ const R = {
252
253
  } catch (u) {
253
254
  m.error(`发布失败, error: ${u.message}`);
254
255
  try {
255
- m.info(`回滚本地版本到发布前的版本:${h.lastHash}`);
256
- const { lastHash: g } = h;
256
+ m.info(
257
+ `回滚本地版本到发布前的版本:${A.lastHash}`
258
+ );
259
+ const { lastHash: g } = A;
257
260
  l(`git reset --hard ${g}`, {
258
261
  stdio: "inherit"
259
262
  }), m.info(`删除本次发布时生成的tag:v${p.version}`), l(`git tag -d v${p.version}`, {
@@ -265,16 +268,16 @@ const R = {
265
268
  return process.exit(1);
266
269
  }
267
270
  d && X({
268
- branchName: h.branchName,
271
+ branchName: A.branchName,
269
272
  version: p.version,
270
- remoteInfo: h.remoteInfo
271
- }), m.success(`发布成功,版本号:${A}`), t === c.NPM && J(a) && M(e);
273
+ remoteInfo: A.remoteInfo
274
+ }), m.success(`发布成功,版本号:${h}`), t === c.NPM && J(a) && M(e);
272
275
  }, ie = {
273
276
  command: "$0",
274
277
  describe: "执行发布命令",
275
278
  options: re(),
276
279
  handler: x
277
- }, ue = async (e, t) => {
280
+ }, ge = async (e, t) => {
278
281
  switch (e) {
279
282
  case I.INIT:
280
283
  return k(t);
@@ -300,19 +303,19 @@ const R = {
300
303
  } = R, _ = (e = !1) => {
301
304
  const t = e ? b : void 0, o = `$0${e ? ` ${b}` : ""} [options]`;
302
305
  return { command: t, usage: o };
303
- }, ge = async () => q({
306
+ }, Ie = async () => q({
304
307
  ...D,
305
308
  ..._()
306
- }), Ie = () => y({
309
+ }), Ae = () => y({
307
310
  ...D,
308
311
  ..._(!0)
309
312
  });
310
313
  export {
311
314
  r as P,
312
315
  I as S,
313
- Ie as a,
316
+ Ae as a,
314
317
  f as b,
315
- ge as c,
318
+ Ie as c,
316
319
  c as d,
317
- ue as h
320
+ ge as h
318
321
  };
package/es/index.mjs CHANGED
@@ -1,14 +1,15 @@
1
1
  #!/usr/bin/env node
2
- import { d as u, b as i, P as e, S as b, a as d, h as p } from "./index-65e39d54.js";
2
+ import { d as u, b as e, P as b, S as p, a as t, h as d } from "./index-5b34f98a.js";
3
3
  import "@done-coding/cli-utils";
4
4
  import "semver";
5
5
  import "node:path";
6
6
  import "node:fs";
7
+ import "node:child_process";
7
8
  export {
8
9
  u as PublishModeEnum,
9
- i as PublishTagEnum,
10
- e as PublishVersionTypeEnum,
11
- b as SubcommandEnum,
12
- d as crateAsSubcommand,
13
- p as handler
10
+ e as PublishTagEnum,
11
+ b as PublishVersionTypeEnum,
12
+ p as SubcommandEnum,
13
+ t as crateAsSubcommand,
14
+ d as handler
14
15
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@done-coding/cli-publish",
3
- "version": "0.7.14-alpha.2",
3
+ "version": "0.7.15-alpha.1",
4
4
  "description": "项目发布命令行工具",
5
5
  "private": false,
6
6
  "module": "es/index.mjs",
@@ -21,10 +21,7 @@
21
21
  "types"
22
22
  ],
23
23
  "scripts": {
24
- "clean": "rimraf es lib types",
25
- "predev": "pnpm run clean",
26
- "dev": "vite build --watch",
27
- "prebuild": "pnpm run clean",
24
+ "dev": "vite build -w -m hotBuild",
28
25
  "build": "vite build",
29
26
  "prepack": "pnpm build"
30
27
  },
@@ -41,21 +38,20 @@
41
38
  "license": "MIT",
42
39
  "sideEffects": false,
43
40
  "devDependencies": {
44
- "@done-coding/cli-inject": "0.5.21-alpha.2",
41
+ "@done-coding/cli-inject": "0.5.22-alpha.1",
45
42
  "@types/node": "^18.0.0",
46
43
  "@types/semver": "^7.5.3",
47
44
  "@types/yargs": "^17.0.28",
48
- "rimraf": "^6.0.1",
49
45
  "typescript": "^5.8.3",
50
46
  "vite": "^4.4.11",
51
47
  "vite-plugin-dts": "^3.6.0"
52
48
  },
53
- "engines": {
54
- "node": ">=18.0.0"
55
- },
56
49
  "dependencies": {
57
- "@done-coding/cli-utils": "0.8.2-alpha.2",
50
+ "@done-coding/cli-utils": "0.8.3-alpha.1",
58
51
  "semver": "^7.5.4"
59
52
  },
60
- "gitHead": "7683cce31678dfecc6b35014f9658ad8b59f0c97"
53
+ "engines": {
54
+ "node": ">=18.0.0"
55
+ },
56
+ "gitHead": "c316dae3339308b554618b88b3e826502c5fc9f1"
61
57
  }