@vc-shell/release-config 1.1.4 → 1.1.6

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
@@ -1,3 +1,11 @@
1
+ ## [1.1.6](https://github.com/VirtoCommerce/vc-shell/compare/v1.1.5...v1.1.6) (2025-05-12)
2
+
3
+
4
+
5
+ ## [1.1.5](https://github.com/VirtoCommerce/vc-shell/compare/v1.1.4...v1.1.5) (2025-05-07)
6
+
7
+
8
+
1
9
  ## [1.1.4](https://github.com/VirtoCommerce/vc-shell/compare/v1.1.3...v1.1.4) (2025-04-30)
2
10
 
3
11
 
@@ -1,62 +1,62 @@
1
- import c from "prompts";
2
- import { inc as v, valid as C, parse as S } from "semver";
3
- import { readFileSync as V, writeFileSync as I } from "node:fs";
1
+ import p from "prompts";
2
+ import { inc as y, valid as x, parse as S } from "semver";
3
+ import { readFileSync as C, writeFileSync as I } from "node:fs";
4
4
  import k from "node:path";
5
- import o from "chalk";
5
+ import s from "chalk";
6
6
  import R from "mri";
7
- import { argv as U } from "node:process";
8
- import { sync as A } from "cross-spawn";
9
- const e = R(U.slice(2)), b = !!e.dry;
10
- b && (console.log(o.inverse(o.yellow(" DRY RUN "))), console.log());
11
- function y(t) {
12
- const s = k.resolve(t), l = k.resolve(s, "package.json");
13
- return { pkg: JSON.parse(V(l, "utf-8")), pkgDir: s, pkgPath: l };
7
+ import { argv as A } from "node:process";
8
+ import { sync as D } from "cross-spawn";
9
+ const e = R(A.slice(2)), b = !!e.dry;
10
+ b && (console.log(s.inverse(s.yellow(" DRY RUN "))), console.log());
11
+ function w(t) {
12
+ const n = k.resolve(t), l = k.resolve(n, "package.json");
13
+ return { pkg: JSON.parse(C(l, "utf-8")), pkgDir: n, pkgPath: l };
14
14
  }
15
- async function D(t, s) {
15
+ async function M(t, n) {
16
16
  if (b) {
17
- console.log(o.blue(`[dryrun] Writing package.json to ${t}`));
17
+ console.log(s.blue(`[dryrun] Writing package.json to ${t}`));
18
18
  return;
19
19
  }
20
- I(t, JSON.stringify(s, null, 2) + `
20
+ I(t, JSON.stringify(n, null, 2) + `
21
21
  `, "utf-8");
22
22
  }
23
- async function N(t, s, l) {
24
- return A(t, s, { stdio: "inherit", ...l });
23
+ async function N(t, n, l) {
24
+ return D(t, n, { stdio: "inherit", ...l });
25
25
  }
26
- async function M(t, s, l) {
27
- return console.log(o.blue(`[dryrun] ${t} ${s.join(" ")}`), l || "");
26
+ async function U(t, n, l) {
27
+ return console.log(s.blue(`[dryrun] ${t} ${n.join(" ")}`), l || "");
28
28
  }
29
- const u = b ? M : N;
30
- function $(t) {
31
- return console.log(o.cyan(t));
29
+ const u = b ? U : N;
30
+ function d(t) {
31
+ return console.log(s.cyan(t));
32
32
  }
33
33
  function E(t) {
34
- function s(r, n) {
35
- if (r === "prerelease" && n === "alpha") {
34
+ function n(r, o) {
35
+ if (r === "prerelease" && o === "alpha") {
36
36
  if (t.includes("-alpha")) {
37
- const [f, m] = t.split("-alpha."), h = parseInt(m) + 1;
37
+ const [f, c] = t.split("-alpha."), h = parseInt(c) + 1;
38
38
  return `${f}-alpha.${h}`;
39
39
  }
40
- return `${v(t, "patch")}-alpha.0`;
40
+ return `${y(t, "patch")}-alpha.0`;
41
41
  }
42
- return v(t, r);
42
+ return y(t, r);
43
43
  }
44
44
  return [
45
45
  {
46
46
  title: "next",
47
- value: s("patch")
47
+ value: n("patch")
48
48
  },
49
49
  {
50
50
  title: "alpha",
51
- value: s("prerelease", "alpha")
51
+ value: n("prerelease", "alpha")
52
52
  },
53
53
  {
54
54
  title: "minor",
55
- value: s("minor")
55
+ value: n("minor")
56
56
  },
57
57
  {
58
58
  title: "major",
59
- value: s("major")
59
+ value: n("major")
60
60
  },
61
61
  {
62
62
  value: "custom",
@@ -64,35 +64,35 @@ function E(t) {
64
64
  }
65
65
  ].map((r) => (r.title = `${r.title} (${r.value})`, r));
66
66
  }
67
- const Y = async ({
67
+ const H = async ({
68
68
  packages: t,
69
- bumpVersion: s,
69
+ bumpVersion: n,
70
70
  generateChangelog: l,
71
71
  toTag: r
72
72
  }) => {
73
- let n;
73
+ let o;
74
74
  if (t.length === 0)
75
75
  throw new Error("No packages to release");
76
- const { pkg: d } = y(t[0]);
77
- if (!n) {
78
- const { release: a } = await c({
76
+ const { pkg: $ } = w(t[0]);
77
+ if (!o) {
78
+ const { release: a } = await p({
79
79
  type: "select",
80
80
  name: "release",
81
81
  message: "Select release type",
82
- choices: E(d.version)
82
+ choices: E($.version)
83
83
  });
84
- a === "custom" ? n = (await c({
84
+ a === "custom" ? o = (await p({
85
85
  type: "text",
86
86
  name: "version",
87
87
  message: "Input custom version",
88
- initial: d.version
89
- })).version : n = a;
88
+ initial: $.version
89
+ })).version : o = a;
90
90
  }
91
- if (!C(n))
92
- throw new Error(`invalid target version: ${n}`);
93
- const f = n.match(/-([a-zA-Z]+)(?:\.(\d+))?$/);
91
+ if (!x(o))
92
+ throw new Error(`invalid target version: ${o}`);
93
+ const f = o.match(/-([a-zA-Z]+)(?:\.(\d+))?$/);
94
94
  if (f && !e.tag && (e.tag = f[1]), !e.tag) {
95
- const { npmTag: a } = await c({
95
+ const { npmTag: a } = await p({
96
96
  type: "select",
97
97
  name: "npmTag",
98
98
  message: "Select npm distribution tag",
@@ -105,7 +105,7 @@ const Y = async ({
105
105
  ]
106
106
  });
107
107
  if (a === "custom") {
108
- const g = await c({
108
+ const g = await p({
109
109
  type: "text",
110
110
  name: "customTag",
111
111
  message: "Input custom npm tag",
@@ -115,56 +115,50 @@ const Y = async ({
115
115
  } else a !== "latest" && (e.tag = a);
116
116
  }
117
117
  if (e.tag && e.tag !== "latest") {
118
- const a = S(n);
119
- if (a && !n.includes(`-${e.tag}`)) {
120
- let i, p = 0;
121
- a.prerelease.length > 0 ? (a.prerelease.length > 1 && typeof a.prerelease[1] == "number" && (p = a.prerelease[1]), i = `${`${a.major}.${a.minor}.${a.patch}`}-${e.tag}`) : i = `${v(n, "minor")}-${e.tag}`;
122
- const { usePreNum: w } = await c({
118
+ const a = S(o);
119
+ if (a && !o.includes(`-${e.tag}`)) {
120
+ let i, m = 0;
121
+ a.prerelease.length > 0 ? (a.prerelease.length > 1 && typeof a.prerelease[1] == "number" && (m = a.prerelease[1]), i = `${`${a.major}.${a.minor}.${a.patch}`}-${e.tag}`) : i = `${y(o, "minor")}-${e.tag}`;
122
+ const { usePreNum: v } = await p({
123
123
  type: "confirm",
124
124
  name: "usePreNum",
125
- message: `Add prerelease number to version? (e.g. ${i}.${p})`,
125
+ message: `Add prerelease number to version? (e.g. ${i}.${m})`,
126
126
  initial: !0
127
127
  });
128
- w && (i = `${i}.${p}`);
129
- const { confirmVersionChange: j } = await c({
130
- type: "confirm",
131
- name: "confirmVersionChange",
132
- message: `Update version from ${o.yellow(n)} to ${o.green(i)} to match ${o.blue(e.tag)} tag?`
133
- });
134
- j && (n = i, console.log(`Version updated to ${o.green(n)}`));
128
+ v && (i = `${i}.${m}`);
135
129
  }
136
130
  }
137
- const m = r(n);
138
- let h = `release: ${m}`;
131
+ const c = r(o);
132
+ let h = `release: ${c}`;
139
133
  e.tag && e.tag !== "latest" && (h += ` with npm tag ${e.tag}`);
140
- const { yes: P } = await c({
134
+ const { yes: P } = await p({
141
135
  type: "confirm",
142
136
  name: "yes",
143
- message: `Releasing ${o.yellow(m)}${e.tag && e.tag !== "latest" ? ` with npm tag ${o.blue(e.tag)}` : ""} Confirm?`
137
+ message: `Releasing ${s.yellow(c)}${e.tag && e.tag !== "latest" ? ` with npm tag ${s.blue(e.tag)}` : ""} Confirm?`
144
138
  });
145
139
  if (!P) return;
146
140
  for (let a = 0; a < t.length; a++) {
147
- const g = t[a], { pkg: i } = y(g);
148
- if ($(`
149
- Updating ${o.green(i.name)} package version to ${o.green(n)}...`), await s(i.name, n), e.tag && e.tag !== "latest") {
150
- const p = y(g), w = { ...p.pkg, npmTag: e.tag };
151
- await D(p.pkgPath, w), console.log(`Added npmTag: ${o.blue(e.tag)} to ${o.green(i.name)}`);
141
+ const g = t[a], { pkg: i } = w(g);
142
+ if (d(`
143
+ Updating ${s.green(i.name)} package version to ${s.green(o)}...`), await n(i.name, o), e.tag && e.tag !== "latest") {
144
+ const m = w(g), v = { ...m.pkg, npmTag: e.tag };
145
+ await M(m.pkgPath, v), console.log(`Added npmTag: ${s.blue(e.tag)} to ${s.green(i.name)}`);
152
146
  }
153
- $(`
154
- Generating ${o.green(i.name)} changelog...`), await l(i.name, n, g);
147
+ d(`
148
+ Generating ${s.green(i.name)} changelog...`), await l(i.name, o, g);
155
149
  }
156
150
  const { stdout: T } = await N("git", ["diff"], { stdio: "pipe" });
157
151
  if (T)
158
- $(`
159
- Committing changes...`), await u("git", ["add", "-A"]), await u("git", ["commit", "-m", h, "--no-verify"]), await u("git", ["tag", m]);
152
+ d(`
153
+ Committing changes...`), await u("git", ["add", "-A"]), await u("git", ["commit", "-m", h, "--no-verify"]), await u("git", ["tag", c]);
160
154
  else {
161
155
  console.log("No changes to commit.");
162
156
  return;
163
157
  }
164
- $(`
165
- Pushing to GitHub...`), await u("git", ["push", "origin", `refs/tags/${m}`]), await u("git", ["push"]), e.tag && e.tag !== "latest" && console.log(`
166
- NOTE: This release will be published to npm with tag ${o.blue(e.tag)}`), console.log();
158
+ d(`
159
+ Pushing to GitHub...`), await u("git", ["push", "origin", `refs/tags/${c}`]), await u("git", ["push"]), e.tag && e.tag !== "latest" && console.log(`
160
+ NOTE: This release will be published to npm with tag ${s.blue(e.tag)}`), console.log();
167
161
  };
168
162
  export {
169
- Y as release
163
+ H as release
170
164
  };
@@ -1 +1 @@
1
- {"version":3,"file":"release.d.ts","sourceRoot":"","sources":["../src/release.ts"],"names":[],"mappings":"AAQA;;;;;;;;GAQG;AACH,eAAO,MAAM,OAAO,GAAU,sDAK3B;IACD,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,WAAW,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACxE,iBAAiB,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACtG,KAAK,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,MAAM,CAAC;CACpC,kBAqLA,CAAC"}
1
+ {"version":3,"file":"release.d.ts","sourceRoot":"","sources":["../src/release.ts"],"names":[],"mappings":"AAQA;;;;;;;;GAQG;AACH,eAAO,MAAM,OAAO,GAAU,sDAK3B;IACD,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,WAAW,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACxE,iBAAiB,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACtG,KAAK,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,MAAM,CAAC;CACpC,kBAyKA,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vc-shell/release-config",
3
- "version": "1.1.4",
3
+ "version": "1.1.6",
4
4
  "type": "module",
5
5
  "main": "dist/release-config.js",
6
6
  "types": "./dist/index.d.ts",
@@ -22,7 +22,7 @@
22
22
  "@types/cross-spawn": "^6.0.6",
23
23
  "@types/prompts": "^2.4.7",
24
24
  "@types/semver": "^7.5.4",
25
- "@vc-shell/ts-config": "^1.1.4",
25
+ "@vc-shell/ts-config": "^1.1.6",
26
26
  "typescript": "^5.8.3",
27
27
  "vite-plugin-dts": "^3.6.4"
28
28
  },