@done-coding/cli-publish 0.2.0 → 0.3.2

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/handler.mjs CHANGED
@@ -1,12 +1,12 @@
1
1
  #!/usr/bin/env node
2
2
  import { PublishModeEnum as h } from "./utils/types.mjs";
3
- import { inc as p, prerelease as d } from "semver";
3
+ import { inc as p, prerelease as S } from "semver";
4
4
  import { join as u } from "node:path";
5
5
  import { execSync as o } from "node:child_process";
6
6
  import f from "pinyin";
7
- import { readFileSync as y, existsSync as w } from "node:fs";
7
+ import { readFileSync as y, existsSync as d } from "node:fs";
8
8
  import c from "chalk";
9
- const S = process.cwd(), $ = "/.dc/publish.json", b = "/package.json", v = ({ gitOriginName: r = "origin" }) => {
9
+ const w = "/.dc/publish.json", $ = "/package.json", b = ({ gitOriginName: r = "origin" }) => {
10
10
  try {
11
11
  const i = o("git rev-parse HEAD").toString().trim(), s = o('git log -1 --pretty=format:"%an"').toString().trim(), a = o('git log -1 --pretty=format:"%ae"').toString().trim(), t = o('git log -1 --pretty=format:"%s"').toString().trim(), n = o("git config user.name").toString().trim(), e = o("git config user.email").toString().trim(), g = o("git rev-parse --abbrev-ref HEAD").toString().trim();
12
12
  let l = "";
@@ -36,14 +36,14 @@ const S = process.cwd(), $ = "/.dc/publish.json", b = "/package.json", v = ({ gi
36
36
  } catch (i) {
37
37
  throw console.error("Error fetching git information:", i), i;
38
38
  }
39
- }, N = async (r) => {
40
- const i = y(u(S, b), "utf-8"), s = JSON.parse(i);
39
+ }, v = async (r) => {
40
+ const i = y(u(process.cwd(), $), "utf-8"), s = JSON.parse(i);
41
41
  let a = s.name, t = "", n;
42
42
  const { version: e } = s;
43
43
  if (["major", "minor", "patch"].includes(r))
44
44
  t = p(e, r), n = "latest";
45
45
  else if (["premajor", "preminor", "prepatch"].includes(r)) {
46
- const g = d(e);
46
+ const g = S(e);
47
47
  g ? (console.log(
48
48
  c.yellow("当前版本已经是预发布版本,将会在当前版本基础上进行发布")
49
49
  ), g.length === 1 && typeof g[0] == "number" ? t = p(e, "prerelease") : t = e.split("-")[0] + "-0") : t = p(e, r), n = "next";
@@ -56,10 +56,10 @@ const S = process.cwd(), $ = "/.dc/publish.json", b = "/package.json", v = ({ gi
56
56
  version: t,
57
57
  tag: n
58
58
  };
59
- }, E = () => {
59
+ }, N = () => {
60
60
  let r;
61
- const i = u(S, $);
62
- if (w(i)) {
61
+ const i = u(process.cwd(), w);
62
+ if (d(i)) {
63
63
  const s = y(i, "utf-8");
64
64
  r = JSON.parse(s);
65
65
  } else
@@ -72,11 +72,11 @@ const S = process.cwd(), $ = "/.dc/publish.json", b = "/package.json", v = ({ gi
72
72
  gitOriginName: "origin",
73
73
  ...r || {}
74
74
  };
75
- }, H = async (r) => {
75
+ }, C = async (r) => {
76
76
  console.log(r);
77
- const { mode: i, type: s, push: a } = r, t = E(), n = v(t);
77
+ const { mode: i, type: s, push: a } = r, t = N(), n = b(t);
78
78
  console.log("type:", s), console.log("gitInfo:", n);
79
- const e = await N(s), { version: g } = e;
79
+ const e = await v(s), { version: g } = e;
80
80
  console.log("npmInfo:", e), o(`npm version ${g} 1>&2`);
81
81
  try {
82
82
  if (i === h.NPM) {
@@ -103,5 +103,5 @@ const S = process.cwd(), $ = "/.dc/publish.json", b = "/package.json", v = ({ gi
103
103
  a && (o(`git push ${t.gitOriginName} v${e.version} 1>&2`), o(`git push ${t.gitOriginName} ${n.branchName} 1>&2`)), console.log(c.green("发布成功"));
104
104
  };
105
105
  export {
106
- H as handler
106
+ C as handler
107
107
  };
package/es/index.mjs CHANGED
@@ -1,7 +1,9 @@
1
1
  #!/usr/bin/env node
2
2
  import { handler as e } from "./handler.mjs";
3
- import { command as m } from "./main.mjs";
3
+ import { command as n } from "./main.mjs";
4
+ import { PublishModeEnum as f } from "./utils/types.mjs";
4
5
  export {
5
- m as command,
6
+ f as PublishModeEnum,
7
+ n as command,
6
8
  e as handler
7
9
  };
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  const n = {
3
3
  name: "@done-coding/cli-publish",
4
- version: "0.2.0",
4
+ version: "0.3.2",
5
5
  description: "项目发布命令行工具"
6
6
  };
7
7
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@done-coding/cli-publish",
3
- "version": "0.2.0",
3
+ "version": "0.3.2",
4
4
  "description": "项目发布命令行工具",
5
5
  "private": false,
6
6
  "module": "es/index.mjs",
@@ -34,13 +34,14 @@
34
34
  "directory": "packages/publish"
35
35
  },
36
36
  "publishConfig": {
37
- "access": "public"
37
+ "access": "public",
38
+ "registry": "https://registry.npmjs.org/"
38
39
  },
39
40
  "author": "JustSoSu",
40
41
  "license": "MIT",
41
42
  "sideEffects": false,
42
43
  "devDependencies": {
43
- "@done-coding/cli-inject": "^0.1.1",
44
+ "@done-coding/cli-inject": "^0.2.2",
44
45
  "@types/node": "^20.0.0",
45
46
  "@types/pinyin": "^2.10.0",
46
47
  "@types/prompts": "^2.4.6",
@@ -61,5 +62,5 @@
61
62
  "semver": "^7.5.4",
62
63
  "yargs": "^17.7.2"
63
64
  },
64
- "gitHead": "454bb76eb20c9b732331c273435e0bf56c8c3f25"
65
+ "gitHead": "e2dc7c4b0fa74aa83dc6173416aaffe0a0a445ad"
65
66
  }
package/types/index.d.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  export { handler } from "./handler";
2
2
  export { command } from "./main";
3
+ export * from './utils/types';
@@ -1,6 +1,6 @@
1
1
  declare const _default: {
2
2
  "name": "@done-coding/cli-publish",
3
- "version": "0.2.0",
3
+ "version": "0.3.2",
4
4
  "description": "项目发布命令行工具"
5
5
  };
6
6