@vc-shell/release-config 1.2.4-beta.3 → 1.2.4-beta.5

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.
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { g as i } from "./generate-changelogs-_wYT4v6U.js";
2
+ import { a as i } from "./generate-changelogs-uhMg9Loz.js";
3
3
  import { resolve as s } from "node:path";
4
4
  import e from "chalk";
5
5
  async function l() {
@@ -0,0 +1,148 @@
1
+ import { sync as A } from "cross-spawn";
2
+ import { existsSync as G, readFileSync as y, writeFileSync as N } from "node:fs";
3
+ import d from "node:path";
4
+ import i from "chalk";
5
+ import { valid as v, rcompare as O } from "semver";
6
+ function H(a) {
7
+ let e = a;
8
+ return e = e.replace(/^# CHANGELOG\s*\n/gm, ""), e = e.replace(/^# Change Log\s*\n/gm, ""), e = e.replace(
9
+ /^All notable changes to this (project|package) will be documented in this file\.\s*\n/gm,
10
+ ""
11
+ ), e = e.replace(
12
+ /^See \[Conventional Commits\]\(https:\/\/conventionalcommits\.org\) for commit guidelines\.\s*\n/gm,
13
+ ""
14
+ ), e = e.replace(/\n{3,}/g, `
15
+
16
+ `), e;
17
+ }
18
+ function w(a) {
19
+ return a.replace(
20
+ /^(##\s+\[[^\]]+\][^\n]*\n)\n(##\s+\[|$)/gm,
21
+ `$1
22
+ **Note:** Version bump only for package
23
+
24
+ $2`
25
+ );
26
+ }
27
+ function W(a, e = !1) {
28
+ console.log(i.cyan(`
29
+ Enhancing changelogs...
30
+ `));
31
+ for (const s of a) {
32
+ const c = d.join(s.path, "CHANGELOG.md");
33
+ if (!G(c)) continue;
34
+ let t = y(c, "utf-8");
35
+ t = H(t), t = w(t), t = t.trim() + `
36
+ `, e || N(c, t, "utf-8");
37
+ }
38
+ }
39
+ function b(a) {
40
+ const e = {}, s = {}, c = a.split(`
41
+ `);
42
+ let t = null, r = [];
43
+ for (const n of c) {
44
+ const f = n.match(/^##\s+(?:\[)?([\d.a-z-]+)(?:\])?(?:\s+\([^)]+\))?/i);
45
+ f ? (t && r.length > 0 && (e[t] = r.join(`
46
+ `).trim()), t = f[1], r = [], s[t] || (s[t] = n.replace(/^##\s+/, ""))) : t && n.trim() !== "" && !n.startsWith("# CHANGELOG") && !n.startsWith("# Change Log") && !n.startsWith("All notable changes") && !n.startsWith("See [Conventional Commits]") && r.push(n);
47
+ }
48
+ return t && r.length > 0 && (e[t] = r.join(`
49
+ `).trim()), { versionContent: e, versionHeaders: s };
50
+ }
51
+ function L(a) {
52
+ return [...a].sort((e, s) => v(e) && v(s) ? O(e, s) : s.localeCompare(e));
53
+ }
54
+ function E(a, e = !1) {
55
+ const { packages: s, rootDir: c = process.cwd(), includeRootHeader: t = !1 } = a;
56
+ console.log(i.cyan(`
57
+ Generating root CHANGELOG with package grouping...
58
+ `));
59
+ const r = d.join(c, "CHANGELOG.md"), n = {}, f = {};
60
+ for (const m of s) {
61
+ const p = d.join(c, m.path, "CHANGELOG.md");
62
+ if (!G(p)) continue;
63
+ const k = y(p, "utf-8"), u = b(k);
64
+ for (const [l, g] of Object.entries(u.versionContent))
65
+ n[l] || (n[l] = {}), n[l][m.displayName] = g, !f[l] && u.versionHeaders[l] && (f[l] = u.versionHeaders[l]);
66
+ }
67
+ let o = "";
68
+ t && (o = `# CHANGELOG
69
+
70
+ All notable changes to this monorepo will be documented in this file.
71
+
72
+ `);
73
+ const C = L(Object.keys(n));
74
+ for (const m of C) {
75
+ const p = n[m], k = Object.values(p).some((g) => !g || !g.trim() ? !1 : g.replace(/\*\*Note:\*\*\s+Version bump only[^\n]*/gi, "").trim().length > 0), u = f[m] || m;
76
+ if (o += `## ${u}
77
+
78
+ `, !k) {
79
+ o += `**Note:** Version bump only for package
80
+
81
+ `;
82
+ continue;
83
+ }
84
+ let l = !1;
85
+ for (const g of s) {
86
+ const h = p[g.displayName];
87
+ h && h.trim() && h.replace(/\*\*Note:\*\*\s+Version bump only[^\n]*/gi, "").trim().length > 0 && (l = !0, o += `### ${g.displayName}
88
+
89
+ `, o += `${h}
90
+
91
+ `);
92
+ }
93
+ l || (o += `**Note:** Version bump only for package
94
+
95
+ `);
96
+ }
97
+ o = o.replace(/\n{3,}/g, `
98
+
99
+ `), o = o.trim() + `
100
+ `, e ? console.log(i.yellow(` [dry-run] Would write root CHANGELOG.md (${C.length} versions)`)) : (N(r, o, "utf-8"), console.log(i.green(" Generated root CHANGELOG.md with package grouping")));
101
+ }
102
+ async function x(a) {
103
+ const { packages: e, rootDir: s = process.cwd(), generateRoot: c = !0, includeRootHeader: t = !0 } = a;
104
+ console.log(i.cyan(`
105
+ Generating initial CHANGELOG.md files...
106
+ `));
107
+ for (const r of e) {
108
+ const n = d.join(s, r.path, "CHANGELOG.md");
109
+ if (G(n)) {
110
+ const o = `${n}.backup`, C = y(n, "utf-8");
111
+ N(o, C, "utf-8"), console.log(i.gray(` Backed up ${n} to ${o}`));
112
+ }
113
+ if (console.log(i.blue(`
114
+ Generating changelog for ${r.name}...`)), A(
115
+ "npx",
116
+ [
117
+ "conventional-changelog",
118
+ "-p",
119
+ "conventionalcommits",
120
+ "-i",
121
+ n,
122
+ "-s",
123
+ "-r",
124
+ "0",
125
+ "--commit-path",
126
+ d.join(s, r.path)
127
+ ],
128
+ { stdio: "inherit", cwd: s }
129
+ ).status === 0) {
130
+ if (G(n)) {
131
+ let o = y(n, "utf-8");
132
+ o = H(o), o = w(o), o = o.trim() + `
133
+ `, N(n, o, "utf-8");
134
+ }
135
+ console.log(i.green(` Generated ${n}`));
136
+ } else
137
+ console.log(i.red(` Failed to generate ${n}`));
138
+ }
139
+ c && await E({ packages: e, rootDir: s, includeRootHeader: t }), console.log(i.green(`
140
+ Initial changelogs generated successfully!`)), console.log(i.cyan(`
141
+ Next steps:`)), console.log(i.cyan(" 1. Review the generated CHANGELOG.md files")), console.log(i.cyan(" 2. Make any manual adjustments if needed")), console.log(i.cyan(` 3. Commit the changes
142
+ `));
143
+ }
144
+ export {
145
+ x as a,
146
+ W as e,
147
+ E as g
148
+ };
@@ -1,40 +1,21 @@
1
- import P from "prompts";
2
- import { parse as O, valid as x } from "semver";
3
- import { readFileSync as V, writeFileSync as A, existsSync as E } from "node:fs";
4
- import S from "node:path";
5
- import e from "chalk";
6
- import H from "mri";
7
- import { argv as I } from "node:process";
8
- import { sync as y } from "cross-spawn";
9
- import { g as ee, a as te } from "./generate-changelogs-_wYT4v6U.js";
10
- const k = H(I.slice(2)), L = !!k.dry;
11
- L && (console.log(e.inverse(e.yellow(" DRY RUN "))), console.log());
12
- function C(s) {
13
- const u = S.resolve(s), p = S.resolve(u, "package.json");
14
- return { pkg: JSON.parse(V(p, "utf-8")), pkgDir: u, pkgPath: p };
1
+ import { parse as b, valid as V } from "semver";
2
+ import { readFileSync as A, existsSync as N, writeFileSync as $ } from "node:fs";
3
+ import R from "node:path";
4
+ import S from "mri";
5
+ import { argv as T } from "node:process";
6
+ import n from "chalk";
7
+ import { sync as i } from "cross-spawn";
8
+ import m from "prompts";
9
+ import { e as D, g as E } from "./generate-changelogs-uhMg9Loz.js";
10
+ import { a as le } from "./generate-changelogs-uhMg9Loz.js";
11
+ const c = S(T.slice(2));
12
+ c.dry;
13
+ function v(o) {
14
+ const t = R.resolve(o), e = R.resolve(t, "package.json");
15
+ return { pkg: JSON.parse(A(e, "utf-8")), pkgDir: t, pkgPath: e };
15
16
  }
16
- const X = async ({
17
- packages: s,
18
- bumpVersion: u,
19
- generateChangelog: p,
20
- toTag: o,
21
- customHooks: v
22
- }) => {
23
- if (s.length === 0)
24
- throw new Error("No packages to release");
25
- const r = !!k.dry;
26
- r && console.log(e.yellow(`
27
- ⚠️ DRY RUN MODE - No git operations will be performed
28
- `));
29
- const { pkg: N } = C(s.find((l) => l !== ".") || s[0]), m = N.version.split(".").slice(0, 2).join("."), h = y("git", ["describe", "--tags", "--abbrev=0", "--match", `v${m}.*`], {
30
- stdio: "pipe",
31
- encoding: "utf-8"
32
- });
33
- let w = null;
34
- h.status === 0 && h.stdout ? (w = h.stdout.toString().trim(), console.log(e.gray(`ℹ️ Using ${w} as reference point for changes
35
- `))) : console.log(e.yellow(`⚠️ No matching tag found for v${m}.*, Lerna will use default behavior
36
- `));
37
- const { releaseType: n } = await P({
17
+ async function F() {
18
+ const { releaseType: o } = await m({
38
19
  type: "select",
39
20
  name: "releaseType",
40
21
  message: "Select release type",
@@ -45,260 +26,235 @@ const X = async ({
45
26
  { title: "Custom version", value: "custom" }
46
27
  ]
47
28
  });
48
- if (!n) {
49
- console.log(e.yellow(`
50
- Release cancelled
51
- `));
52
- return;
53
- }
54
- const t = ["lerna", "version"];
55
- if (n === "auto")
56
- t.push("--conventional-commits");
57
- else if (n === "prerelease") {
58
- const { pkg: l } = C(s[0]), c = O(l.version), g = c && c.prerelease.length > 0, d = g ? c.prerelease[0] : null, { preid: R } = await P({
59
- type: "select",
60
- name: "preid",
61
- message: "Select prerelease identifier",
62
- choices: [
63
- {
64
- title: g && d === "alpha" ? "alpha (continue)" : "alpha",
65
- value: "alpha"
66
- },
67
- {
68
- title: g && d === "beta" ? "beta (continue)" : "beta",
69
- value: "beta"
70
- },
71
- { title: g && d === "rc" ? "rc (continue)" : "rc", value: "rc" }
72
- ]
73
- });
74
- if (!R) {
75
- console.log(e.yellow(`
76
- Release cancelled
77
- `));
78
- return;
79
- }
80
- g && d === R ? t.push("prerelease") : t.push("prerelease", "--preid", R), k.tag || (k.tag = R);
81
- } else if (n === "graduate")
82
- t.push("--conventional-graduate");
83
- else if (n === "custom") {
84
- const { pkg: l } = C(s[0]), { customVersion: c } = await P({
85
- type: "text",
86
- name: "customVersion",
87
- message: "Enter custom version",
88
- initial: l.version,
89
- validate: (d) => x(d) ? !0 : "Invalid semver version"
90
- });
91
- if (!c) {
92
- console.log(e.yellow(`
93
- Release cancelled
94
- `));
95
- return;
96
- }
97
- t.push(c);
98
- const g = O(c);
99
- if (g && g.prerelease.length > 0 && !k.tag) {
100
- const d = g.prerelease[0];
101
- typeof d == "string" && (k.tag = d);
102
- }
103
- }
104
- const { yes: a } = await P({
29
+ return o;
30
+ }
31
+ async function L(o) {
32
+ const t = b(o), e = t && t.prerelease.length > 0, s = e ? t.prerelease[0] : null, { preid: a } = await m({
33
+ type: "select",
34
+ name: "preid",
35
+ message: "Select prerelease identifier",
36
+ choices: [
37
+ {
38
+ title: e && s === "alpha" ? "alpha (continue)" : "alpha",
39
+ value: "alpha"
40
+ },
41
+ {
42
+ title: e && s === "beta" ? "beta (continue)" : "beta",
43
+ value: "beta"
44
+ },
45
+ {
46
+ title: e && s === "rc" ? "rc (continue)" : "rc",
47
+ value: "rc"
48
+ }
49
+ ]
50
+ });
51
+ if (a)
52
+ return e && s === a ? { preid: a, lernaVersionArg: "prerelease", lernaPreidArgs: [] } : { preid: a, lernaVersionArg: "prerelease", lernaPreidArgs: ["--preid", a] };
53
+ }
54
+ async function j(o) {
55
+ const { customVersion: t } = await m({
56
+ type: "text",
57
+ name: "customVersion",
58
+ message: "Enter custom version",
59
+ initial: o,
60
+ validate: (e) => V(e) ? !0 : "Invalid semver version"
61
+ });
62
+ return t;
63
+ }
64
+ async function G() {
65
+ const { yes: o } = await m({
105
66
  type: "confirm",
106
67
  name: "yes",
107
68
  message: "Ready to release. Continue?"
108
69
  });
109
- if (!a) {
110
- console.log(e.yellow(`
70
+ return !!o;
71
+ }
72
+ function d() {
73
+ console.log(n.yellow(`
111
74
  Release cancelled
112
75
  `));
113
- return;
76
+ }
77
+ function I(o, t) {
78
+ const e = ["lerna", "version", ...o];
79
+ return e.push("--tag-version-prefix", t.tagVersionPrefix), e.push("--no-push"), t.isDryRun && e.push("--no-git-tag-version"), t.forcePublish && (e.push("--force-publish"), console.log(n.yellow(`
80
+ Force publish mode - all packages will be versioned
81
+ `))), e;
82
+ }
83
+ function H(o) {
84
+ console.log(n.cyan(`
85
+ Running: npx ${o.join(" ")}
86
+ `));
87
+ const t = i("npx", o, { stdio: "inherit" });
88
+ t.status !== 0 && (console.error(n.red(`
89
+ Release process failed
90
+ `)), process.exit(t.status || 1));
91
+ }
92
+ function O(o) {
93
+ const t = {};
94
+ for (const e of o) {
95
+ const { pkg: s } = v(e.path);
96
+ t[e.path] = s.version;
114
97
  }
115
- r ? t.push("--no-git-tag-version", "--no-push") : t.push("--no-push"), k.force && (t.push("--force-publish"), console.log(e.yellow(`
116
- ⚠️ Force publish mode - all packages will be versioned
117
- `)));
118
- const i = {};
119
- for (const l of s) {
120
- if (l === ".") continue;
121
- const { pkg: c } = C(l);
122
- i[l] = c.version;
98
+ return t;
99
+ }
100
+ function U(o, t) {
101
+ for (const e of o) {
102
+ const { pkg: s } = v(e.path);
103
+ if (s.version !== t[e.path])
104
+ return s.version;
123
105
  }
124
- console.log(e.cyan(`
125
- Running: npx ${t.join(" ")}
106
+ return null;
107
+ }
108
+ function J(o, t, e) {
109
+ if (console.log(n.gray(`
110
+ --- Release diagnostics ---`)), console.log(n.gray(` tagVersionPrefix: "${o}"`)), console.log(n.gray(` looking for tags: ${o}${t}.*`)), e) {
111
+ const s = i("git", ["rev-list", "--count", `${e}..HEAD`], {
112
+ stdio: "pipe",
113
+ encoding: "utf-8"
114
+ }), a = s.status === 0 ? s.stdout.trim() : "?", l = i(
115
+ "git",
116
+ ["log", `${e}..HEAD`, "--oneline", "--grep", "^feat\\|^fix\\|^perf\\|^revert"],
117
+ { stdio: "pipe", encoding: "utf-8" }
118
+ ), f = l.status === 0 ? l.stdout.trim().split(`
119
+ `).filter(Boolean).length : 0;
120
+ console.log(n.gray(` last matching tag: ${e}`)), console.log(n.gray(` commits since tag: ${a}`)), console.log(n.gray(` conventional commits: ${f}`)), f === 0 && parseInt(a) > 0 && console.log(
121
+ n.yellow(
122
+ " No conventional commits found. Use --force to publish anyway."
123
+ )
124
+ );
125
+ } else
126
+ console.log(n.yellow(" No matching tag found — Lerna will use default behavior"));
127
+ console.log(n.gray(`---------------------------
126
128
  `));
127
- const b = y("npx", t, { stdio: "inherit" });
128
- b.status !== 0 && (console.error(e.red(`
129
- Release process failed
130
- `)), process.exit(b.status || 1));
131
- let G = !1;
132
- for (const l of s) {
133
- if (l === ".") continue;
134
- const { pkg: c } = C(l);
135
- if (c.version !== i[l]) {
136
- G = !0;
137
- break;
129
+ }
130
+ function B(o, t) {
131
+ const e = i("git", ["describe", "--tags", "--abbrev=0", "--match", `${t}${o}.*`], {
132
+ stdio: "pipe",
133
+ encoding: "utf-8"
134
+ });
135
+ return e.status === 0 && e.stdout ? e.stdout.toString().trim() : null;
136
+ }
137
+ function M() {
138
+ const o = i("git", ["describe", "--tags", "--abbrev=0"], {
139
+ stdio: "pipe",
140
+ encoding: "utf-8"
141
+ });
142
+ return o.status === 0 && o.stdout ? o.stdout.toString().trim() : null;
143
+ }
144
+ function Y(o) {
145
+ const t = ["package.json", "yarn.lock", "CHANGELOG.md"];
146
+ for (const e of o)
147
+ t.push(`${e.path}/package.json`), t.push(`${e.path}/CHANGELOG.md`);
148
+ return t.filter((e) => N(e));
149
+ }
150
+ function q(o) {
151
+ i("git", ["add", ...o], { stdio: "inherit" }).status !== 0 && (console.error(n.red(`
152
+ Failed to stage changes
153
+ `)), process.exit(1)), i("git", ["commit", "--amend", "--no-edit"], { stdio: "inherit" }).status !== 0 && (console.error(n.red(`
154
+ Failed to amend commit
155
+ `)), process.exit(1));
156
+ }
157
+ function z(o) {
158
+ i("git", ["tag", "-f", "-a", o, "-m", o], { stdio: "inherit" }).status !== 0 && (console.error(n.red(`
159
+ Failed to recreate tag
160
+ `)), process.exit(1));
161
+ }
162
+ function K(o) {
163
+ console.log(n.cyan(`
164
+ Pushing changes to remote...
165
+ `)), i("git", ["push", "origin", "HEAD", "--force-with-lease"], { stdio: "inherit" }).status !== 0 && (console.error(n.red(`
166
+ Failed to push commit
167
+ `)), process.exit(1)), i("git", ["push", "origin", o, "--force"], { stdio: "inherit" }).status !== 0 && (console.error(n.red(`
168
+ Failed to push tag
169
+ `)), process.exit(1));
170
+ }
171
+ async function re(o) {
172
+ const {
173
+ packages: t,
174
+ tagVersionPrefix: e = "v",
175
+ customHooks: s,
176
+ updateRootVersion: a = !0
177
+ } = o;
178
+ if (t.length === 0)
179
+ throw new Error("No packages to release");
180
+ const l = !!c.dry;
181
+ l && console.log(n.yellow(`
182
+ DRY RUN MODE - No git operations will be performed
183
+ `));
184
+ const { pkg: f } = v(t[0].path), h = f.version, k = h.split(".").slice(0, 2).join("."), P = B(k, e);
185
+ J(e, k, P);
186
+ const u = await F();
187
+ if (!u) return d();
188
+ const g = [];
189
+ if (u === "auto")
190
+ g.push("--conventional-commits");
191
+ else if (u === "prerelease") {
192
+ const r = await L(h);
193
+ if (!r) return d();
194
+ g.push(r.lernaVersionArg, ...r.lernaPreidArgs), c.tag || (c.tag = r.preid);
195
+ } else if (u === "graduate")
196
+ g.push("--conventional-graduate");
197
+ else if (u === "custom") {
198
+ const r = await j(h);
199
+ if (!r) return d();
200
+ g.push(r);
201
+ const p = b(r);
202
+ if (p && p.prerelease.length > 0 && !c.tag) {
203
+ const w = p.prerelease[0];
204
+ typeof w == "string" && (c.tag = w);
138
205
  }
139
206
  }
140
- if (!G) {
141
- console.log(e.yellow(`
142
- ⚠️ No packages were versioned. Nothing to release.
207
+ if (!await G()) return d();
208
+ const x = I(g, {
209
+ tagVersionPrefix: e,
210
+ isDryRun: l,
211
+ forcePublish: !!c.force
212
+ }), C = O(t);
213
+ H(x);
214
+ const y = U(t, C);
215
+ if (!y) {
216
+ console.log(n.yellow(`
217
+ No packages were versioned. Nothing to release.
143
218
  `));
144
219
  return;
145
220
  }
146
- if (await $(s), v) {
147
- console.log(e.cyan(`
221
+ if (a && Q(y, l), s && (console.log(n.cyan(`
148
222
  Running post-version hooks...
223
+ `)), await s(y)), !l) {
224
+ console.log(n.cyan(`
225
+ Updating yarn.lock with new package versions...
149
226
  `));
150
- const { pkg: l } = C(s[0] === "." ? s[1] : s[0]);
151
- await v(l.version);
227
+ const r = i("yarn", ["install"], { stdio: "inherit" });
228
+ r.status !== 0 && (console.error(n.red(`
229
+ Failed to update yarn.lock
230
+ `)), process.exit(r.status || 1));
152
231
  }
153
- console.log(e.cyan(`
154
- Updating yarn.lock with new package versions...
232
+ if (D(t, l), E({ packages: t }, l), l)
233
+ console.log(n.yellow(`
234
+ Dry run completed successfully!
235
+ `)), console.log(n.cyan("Changes made:")), console.log(n.cyan(" - Updated package versions")), console.log(n.cyan(` - Generated/updated CHANGELOG.md files
236
+ `)), console.log(n.yellow("No git operations performed. Review changes with:")), console.log(n.cyan(` git diff
237
+ `)), console.log(n.yellow("To revert all changes:")), console.log(n.cyan(` git checkout -- .
155
238
  `));
156
- const j = y("yarn", ["install"], { stdio: "inherit" });
157
- if (j.status !== 0 && (console.error(e.red(`
158
- Failed to update yarn.lock
159
- `)), process.exit(j.status || 1)), await T(s), await F(s), !r && y("git", ["status", "--porcelain"], { stdio: "pipe" }).stdout?.toString().trim()) {
160
- const c = y("git", ["describe", "--tags", "--abbrev=0"], { stdio: "pipe" });
161
- (c.status !== 0 || !c.stdout?.toString().trim()) && (console.error(e.red(`
162
- ❌ Could not determine the git tag created by lerna
239
+ else {
240
+ const r = M();
241
+ r || (console.error(n.red(`
242
+ Could not determine the git tag created by Lerna
163
243
  `)), process.exit(1));
164
- const g = c.stdout.toString().trim();
165
- y("git", ["add", "-A"], { stdio: "inherit" }).status !== 0 && (console.error(e.red(`
166
- Failed to stage changes
167
- `)), process.exit(1)), y("git", ["commit", "--amend", "--no-edit", "--no-verify"], { stdio: "inherit" }).status !== 0 && (console.error(e.red(`
168
- ❌ Failed to amend commit
169
- `)), process.exit(1)), y("git", ["tag", "-f", "-a", g, "-m", g], { stdio: "inherit" }).status !== 0 && (console.error(e.red(`
170
- ❌ Failed to recreate tag
171
- `)), process.exit(1)), console.log(e.cyan(`
172
- Pushing changes to remote...
173
- `)), y("git", ["push", "origin", "HEAD", "--force-with-lease"], { stdio: "inherit" }).status !== 0 && (console.error(e.red(`
174
- ❌ Failed to push commit
175
- `)), process.exit(1)), y("git", ["push", "origin", g, "--force"], { stdio: "inherit" }).status !== 0 && (console.error(e.red(`
176
- ❌ Failed to push tag
177
- `)), process.exit(1)), console.log(e.green(`
178
- ✅ Updated changelogs, package.json, and pushed to remote
244
+ const p = Y(t);
245
+ q(p), z(r), K(r), console.log(n.green(`
246
+ Release completed successfully!
247
+ `)), console.log(n.cyan(`npmTag will be automatically determined from git tag in CI
179
248
  `));
180
249
  }
181
- r ? (console.log(e.yellow(`
182
- ✅ Dry run completed successfully!
183
- `)), console.log(e.cyan("Changes made:")), console.log(e.cyan(" - Updated package versions")), console.log(e.cyan(" - Generated/updated CHANGELOG.md files")), console.log(e.cyan(" - npmTag will be determined from git tag in CI")), console.log(e.cyan(` - Updated yarn.lock with new package versions
184
- `)), console.log(e.yellow("No git operations performed. Review changes with:")), console.log(e.cyan(` git diff
185
- `)), console.log(e.yellow("To revert all changes:")), console.log(e.cyan(` git checkout -- .
186
- `))) : (console.log(e.green(`
187
- ✅ Release completed successfully!
188
- `)), console.log(e.cyan(`
189
- ℹ️ npmTag will be automatically determined from git tag in CI`)), console.log(e.cyan(` GitHub Actions will publish with the correct tag based on the git tag
190
- `)));
191
- };
192
- async function T(s) {
193
- console.log(e.cyan(`
194
- Enhancing changelogs...
195
- `));
196
- for (const u of s) {
197
- if (u === ".") continue;
198
- const p = S.join(u, "CHANGELOG.md");
199
- if (!E(p)) continue;
200
- let o = V(p, "utf-8");
201
- o = o.replace(/^# CHANGELOG\s*\n/gm, ""), o = o.replace(/^# Change Log\s*\n/gm, ""), o = o.replace(
202
- /^All notable changes to this (project|package) will be documented in this file\.\s*\n/gm,
203
- ""
204
- ), o = o.replace(
205
- /^See \[Conventional Commits\]\(https:\/\/conventionalcommits\.org\) for commit guidelines\.\s*\n/gm,
206
- ""
207
- ), o = o.replace(/\n{3,}/g, `
208
-
209
- `), o = o.replace(
210
- /^(##\s+\[[^\]]+\][^\n]*\n)\n(##\s+\[|$)/gm,
211
- `$1
212
- **Note:** Version bump only for package
213
-
214
- $2`
215
- ), o = o.trim() + `
216
- `, A(p, o, "utf-8");
217
- }
218
250
  }
219
- async function $(s) {
220
- const u = s.find((N) => N !== ".");
221
- if (!u) return;
222
- const { pkg: p } = C(u), o = p.version, v = "package.json", r = JSON.parse(V(v, "utf-8"));
223
- r.version !== o && (r.version = o, A(v, JSON.stringify(r, null, 2) + `
224
- `, "utf-8"), console.log(e.gray(` Updated root package.json version: ${o}`)));
225
- }
226
- async function F(s) {
227
- console.log(e.cyan(`
228
- Generating root CHANGELOG with package grouping...
229
- `));
230
- const u = "CHANGELOG.md", p = {
231
- framework: "VC-Shell Framework (@vc-shell/framework)",
232
- "cli/api-client": "API Client Generator (@vc-shell/api-client-generator)",
233
- "cli/create-vc-app": "Create VC App (@vc-shell/create-vc-app)",
234
- "configs/release-config": "Release Config (@vc-shell/release-config)",
235
- "configs/vite-config": "Vite Config (@vc-shell/config-generator)",
236
- "configs/ts-config": "TypeScript Config (@vc-shell/ts-config)"
237
- }, o = {}, v = {};
238
- for (const f of s) {
239
- if (f === ".") continue;
240
- const m = S.join(f, "CHANGELOG.md"), h = p[f] || f;
241
- if (!E(m)) continue;
242
- const n = V(m, "utf-8").split(`
243
- `);
244
- let t = null, a = [];
245
- for (const i of n) {
246
- const b = i.match(/^##\s+(?:\[)?([\d.a-z-]+)(?:\])?(?:\s+\([^)]+\))?/i);
247
- if (b) {
248
- if (t && a.length > 0) {
249
- const G = a.join(`
250
- `).trim();
251
- o[t] || (o[t] = {}), o[t][h] = G;
252
- }
253
- t = b[1], a = [], v[t] || (v[t] = i.replace(/^##\s+/, ""));
254
- } else t && i.trim() !== "" && !i.startsWith("# CHANGELOG") && !i.startsWith("# Change Log") && !i.startsWith("All notable changes") && !i.startsWith("See [Conventional Commits]") && a.push(i);
255
- }
256
- if (t && a.length > 0) {
257
- const i = a.join(`
258
- `).trim();
259
- o[t] || (o[t] = {}), o[t][h] = i;
260
- }
261
- }
262
- let r = "";
263
- const N = Object.keys(o).sort((f, m) => {
264
- const h = f.split(/[.-]/).map((n) => isNaN(parseInt(n)) ? n : parseInt(n)), w = m.split(/[.-]/).map((n) => isNaN(parseInt(n)) ? n : parseInt(n));
265
- for (let n = 0; n < Math.max(h.length, w.length); n++) {
266
- const t = h[n] ?? 0, a = w[n] ?? 0;
267
- if (t !== a)
268
- return typeof t == "number" && typeof a == "number" ? a - t : String(a).localeCompare(String(t));
269
- }
270
- return 0;
271
- });
272
- for (const f of N) {
273
- const m = o[f], h = Object.values(m).some((t) => !t || !t.trim() ? !1 : t.replace(/\*\*Note:\*\*\s+Version bump only[^\n]*/gi, "").trim().length > 0), w = v[f] || f;
274
- if (r += `## ${w}
275
-
276
- `, !h) {
277
- r += `**Note:** Version bump only for package
278
-
279
- `;
280
- continue;
281
- }
282
- let n = !1;
283
- for (const t of s) {
284
- if (t === ".") continue;
285
- const a = p[t] || t, i = m[a];
286
- i && i.trim() && i.replace(/\*\*Note:\*\*\s+Version bump only[^\n]*/gi, "").trim().length > 0 && (n = !0, r += `### ${a}
287
-
288
- `, r += `${i}
289
-
290
- `);
291
- }
292
- n || (r += `**Note:** Version bump only for package
293
-
294
- `);
295
- }
296
- r = r.replace(/\n{3,}/g, `
297
-
298
- `), A(u, r, "utf-8"), console.log(e.green(" ✓ Generated root CHANGELOG.md with package grouping"));
251
+ function Q(o, t) {
252
+ const e = "package.json", s = JSON.parse(A(e, "utf-8"));
253
+ s.version !== o && (s.version = o, t || $(e, JSON.stringify(s, null, 2) + `
254
+ `, "utf-8"), console.log(n.gray(` Updated root package.json version: ${o}`)));
299
255
  }
300
256
  export {
301
- ee as generateInitialChangelogs,
302
- te as generateRootChangelog,
303
- X as release
257
+ le as generateInitialChangelogs,
258
+ E as generateRootChangelog,
259
+ re as release
304
260
  };
@@ -0,0 +1,25 @@
1
+ import { PackageConfig, RootChangelogOptions } from './types';
2
+
3
+ /**
4
+ * Removes Lerna auto-generated headers and boilerplate from changelog content.
5
+ */
6
+ export declare function cleanChangelogContent(content: string): string;
7
+ /**
8
+ * Adds "Version bump only" notes for version headers with no content beneath them.
9
+ */
10
+ export declare function addVersionBumpNotes(content: string): string;
11
+ /**
12
+ * Cleans up and enhances changelogs for all packages after Lerna version bump.
13
+ */
14
+ export declare function enhancePackageChangelogs(packages: PackageConfig[], dryRun?: boolean): void;
15
+ /**
16
+ * Sorts version strings in descending order using semver.rcompare.
17
+ * Falls back to string comparison for non-semver strings.
18
+ */
19
+ export declare function sortVersionsDescending(versions: string[]): string[];
20
+ /**
21
+ * Generates a consolidated root CHANGELOG.md from package changelogs,
22
+ * grouped by version with sub-headings per package.
23
+ */
24
+ export declare function generateRootChangelog(options: RootChangelogOptions, dryRun?: boolean): void;
25
+ //# sourceMappingURL=changelog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"changelog.d.ts","sourceRoot":"","sources":["../../src/changelog.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAIjF;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAc7D;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAK3D;AAID;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,aAAa,EAAE,EAAE,MAAM,UAAQ,GAAG,IAAI,CAgBxF;AA6DD;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAOnE;AAID;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAQ,GAAG,IAAI,CAqFzF"}
@@ -1,27 +1,11 @@
1
- export interface PackageConfig {
2
- name: string;
3
- path: string;
4
- displayName: string;
5
- }
6
- export interface ChangelogGeneratorOptions {
7
- packages: PackageConfig[];
8
- rootDir?: string;
9
- generateRoot?: boolean;
10
- includeRootHeader?: boolean;
11
- }
1
+ import { generateRootChangelog } from './changelog';
2
+ import { PackageConfig, ChangelogGeneratorOptions } from './types';
3
+
4
+ export type { PackageConfig, ChangelogGeneratorOptions };
12
5
  /**
13
- * Generates CHANGELOG.md files from all commits for specified packages
14
- * @param options - Configuration options for changelog generation
6
+ * Generates CHANGELOG.md files from all commits for specified packages.
7
+ * Used for initial one-time changelog bootstrapping via the CLI tool.
15
8
  */
16
9
  export declare function generateInitialChangelogs(options: ChangelogGeneratorOptions): Promise<void>;
17
- interface RootChangelogOptions {
18
- packages: PackageConfig[];
19
- rootDir?: string;
20
- includeRootHeader?: boolean;
21
- }
22
- /**
23
- * Generates consolidated root CHANGELOG.md from package changelogs
24
- */
25
- export declare function generateRootChangelog(options: RootChangelogOptions): Promise<void>;
26
- export {};
10
+ export { generateRootChangelog };
27
11
  //# sourceMappingURL=generate-changelogs.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"generate-changelogs.d.ts","sourceRoot":"","sources":["../../src/generate-changelogs.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,yBAAyB;IACxC,QAAQ,EAAE,aAAa,EAAE,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED;;;GAGG;AACH,wBAAsB,yBAAyB,CAAC,OAAO,EAAE,yBAAyB,GAAG,OAAO,CAAC,IAAI,CAAC,CAgFjG;AAED,UAAU,oBAAoB;IAC5B,QAAQ,EAAE,aAAa,EAAE,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED;;GAEG;AACH,wBAAsB,qBAAqB,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC,CA0JxF"}
1
+ {"version":3,"file":"generate-changelogs.d.ts","sourceRoot":"","sources":["../../src/generate-changelogs.ts"],"names":[],"mappings":"AAIA,OAAO,EAGL,qBAAqB,EACtB,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,aAAa,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAGtF,YAAY,EAAE,aAAa,EAAE,yBAAyB,EAAE,CAAC;AAEzD;;;GAGG;AACH,wBAAsB,yBAAyB,CAAC,OAAO,EAAE,yBAAyB,GAAG,OAAO,CAAC,IAAI,CAAC,CA0DjG;AAGD,OAAO,EAAE,qBAAqB,EAAE,CAAC"}
@@ -0,0 +1,31 @@
1
+ import { PackageConfig } from './types';
2
+
3
+ /**
4
+ * Finds the last git tag matching `<prefix><majorMinor>.*`.
5
+ * Returns the tag string or null if none found.
6
+ */
7
+ export declare function findLastMatchingTag(majorMinor: string, tagPrefix: string): string | null;
8
+ /**
9
+ * Gets the latest tag on current HEAD (created by Lerna).
10
+ */
11
+ export declare function getLatestTag(): string | null;
12
+ /**
13
+ * Returns paths that should be staged after post-lerna modifications.
14
+ * Replaces the unsafe `git add -A` with targeted file staging.
15
+ */
16
+ export declare function getReleaseStagePaths(packages: PackageConfig[]): string[];
17
+ /**
18
+ * Stages specified paths and amends the last commit (created by Lerna).
19
+ * Exits on failure.
20
+ */
21
+ export declare function stageAndAmendCommit(paths: string[]): void;
22
+ /**
23
+ * Deletes and recreates the tag as an annotated tag on the amended commit.
24
+ */
25
+ export declare function recreateAnnotatedTag(tag: string): void;
26
+ /**
27
+ * Pushes the amended commit and tag to origin.
28
+ * Uses --force-with-lease for the commit (safe force) and --force for the tag.
29
+ */
30
+ export declare function pushToRemote(tag: string): void;
31
+ //# sourceMappingURL=git.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"git.d.ts","sourceRoot":"","sources":["../../src/git.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAE3D;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAUxF;AAED;;GAEG;AACH,wBAAgB,YAAY,IAAI,MAAM,GAAG,IAAI,CAU5C;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,aAAa,EAAE,GAAG,MAAM,EAAE,CAOxE;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,CAYzD;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAMtD;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAc9C"}
@@ -1,4 +1,4 @@
1
1
  export { release } from './release';
2
2
  export { generateInitialChangelogs, generateRootChangelog } from './generate-changelogs';
3
- export type { PackageConfig, ChangelogGeneratorOptions } from './generate-changelogs';
3
+ export type { PackageConfig, ReleaseConfig, ChangelogGeneratorOptions } from './types';
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAE,yBAAyB,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AACvG,YAAY,EAAE,aAAa,EAAE,yBAAyB,EAAE,MAAM,qCAAqC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAE,yBAAyB,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AACvG,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC"}
@@ -0,0 +1,30 @@
1
+ import { PackageConfig } from './types';
2
+
3
+ export interface LernaVersionOptions {
4
+ tagVersionPrefix: string;
5
+ isDryRun: boolean;
6
+ forcePublish: boolean;
7
+ }
8
+ /**
9
+ * Builds lerna version CLI arguments from the release type and options.
10
+ */
11
+ export declare function buildLernaVersionArgs(releaseTypeArgs: string[], options: LernaVersionOptions): string[];
12
+ /**
13
+ * Runs `npx lerna version` with the given arguments.
14
+ * Exits the process on failure.
15
+ */
16
+ export declare function runLernaVersion(args: string[]): void;
17
+ /**
18
+ * Captures current versions of all packages before lerna runs.
19
+ */
20
+ export declare function captureVersionsBefore(packages: PackageConfig[]): Record<string, string>;
21
+ /**
22
+ * Checks whether any package version changed compared to the snapshot.
23
+ * Returns the new version string if changed, or null if nothing changed.
24
+ */
25
+ export declare function getNewVersionIfChanged(packages: PackageConfig[], versionsBefore: Record<string, string>): string | null;
26
+ /**
27
+ * Logs diagnostic information to help debug version-skip issues.
28
+ */
29
+ export declare function logDiagnostics(tagPrefix: string, majorMinor: string, lastTag: string | null): void;
30
+ //# sourceMappingURL=lerna.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lerna.d.ts","sourceRoot":"","sources":["../../src/lerna.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAE3D,MAAM,WAAW,mBAAmB;IAClC,gBAAgB,EAAE,MAAM,CAAC;IACzB,QAAQ,EAAE,OAAO,CAAC;IAClB,YAAY,EAAE,OAAO,CAAC;CACvB;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CACnC,eAAe,EAAE,MAAM,EAAE,EACzB,OAAO,EAAE,mBAAmB,GAC3B,MAAM,EAAE,CAmBV;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,CAQpD;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,aAAa,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAOvF;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,aAAa,EAAE,EACzB,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GACrC,MAAM,GAAG,IAAI,CAQf;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAqClG"}
@@ -0,0 +1,29 @@
1
+ export interface ReleaseTypeResult {
2
+ releaseType: "auto" | "prerelease" | "graduate" | "custom" | undefined;
3
+ }
4
+ export interface PrereleaseResult {
5
+ preid: string | undefined;
6
+ lernaVersionArg: string;
7
+ lernaPreidArgs: string[];
8
+ }
9
+ /**
10
+ * Prompts user to select the type of release to perform.
11
+ */
12
+ export declare function promptReleaseType(): Promise<string | undefined>;
13
+ /**
14
+ * Prompts user to select prerelease identifier and returns lerna args.
15
+ */
16
+ export declare function promptPrereleaseId(currentVersion: string): Promise<PrereleaseResult | undefined>;
17
+ /**
18
+ * Prompts user to enter a custom semver version.
19
+ */
20
+ export declare function promptCustomVersion(currentVersion: string): Promise<string | undefined>;
21
+ /**
22
+ * Prompts user for final release confirmation.
23
+ */
24
+ export declare function confirmRelease(): Promise<boolean>;
25
+ /**
26
+ * Prints cancellation message.
27
+ */
28
+ export declare function cancelled(): void;
29
+ //# sourceMappingURL=prompts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../src/prompts.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,iBAAiB;IAChC,WAAW,EAAE,MAAM,GAAG,YAAY,GAAG,UAAU,GAAG,QAAQ,GAAG,SAAS,CAAC;CACxE;AAED,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,MAAM,EAAE,CAAC;CAC1B;AAED;;GAEG;AACH,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAcrE;AAED;;GAEG;AACH,wBAAsB,kBAAkB,CACtC,cAAc,EAAE,MAAM,GACrB,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC,CAgCvC;AAED;;GAEG;AACH,wBAAsB,mBAAmB,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAU7F;AAED;;GAEG;AACH,wBAAsB,cAAc,IAAI,OAAO,CAAC,OAAO,CAAC,CAQvD;AAED;;GAEG;AACH,wBAAgB,SAAS,IAAI,IAAI,CAEhC"}
@@ -1,28 +1,8 @@
1
+ import { ReleaseConfig } from './types';
2
+
1
3
  /**
2
- * Release function that uses Lerna for versioning and changelog generation
3
- * @param packages - An array of package names to release.
4
- * @param bumpVersion - A function that takes a package name and version (deprecated, Lerna handles this).
5
- * @param generateChangelog - A function that generates a changelog for a package with a given version.
6
- * @param toTag - A function that takes a version and returns a tag name.
7
- * @param customHooks - A function that takes a package name, version, and workspace name and returns a void or Promise<void>.
8
- * @returns void
9
- * @throws Error if there are no packages to release or if the target version is invalid.
4
+ * Interactive release flow: prompts for release type, runs Lerna version,
5
+ * enhances changelogs, and pushes to remote.
10
6
  */
11
- export declare const release: ({ packages, bumpVersion, generateChangelog, toTag, customHooks, }: {
12
- packages: string[];
13
- /**
14
- *
15
- * @param pkgName
16
- * @param version
17
- * @param workspaceName
18
- * @returns
19
- */
20
- customHooks?: (version: string) => void | Promise<void>;
21
- /** @deprecated Lerna handles version bumping automatically */
22
- bumpVersion?: (pkgName: string, version: string) => void | Promise<void>;
23
- /** @deprecated Lerna generates changelogs automatically */
24
- generateChangelog?: (pkgName: string, version: string, workspaceName?: string) => void | Promise<void>;
25
- /** @deprecated Lerna handles version bumping automatically */
26
- toTag?: (version: string) => string;
27
- }) => Promise<void>;
7
+ export declare function release(config: ReleaseConfig): Promise<void>;
28
8
  //# sourceMappingURL=release.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"release.d.ts","sourceRoot":"","sources":["../../src/release.ts"],"names":[],"mappings":"AASA;;;;;;;;;GASG;AACH,eAAO,MAAM,OAAO,GAAU,mEAM3B;IACD,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACxD,8DAA8D;IAC9D,WAAW,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACzE,2DAA2D;IAC3D,iBAAiB,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACvG,8DAA8D;IAC9D,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,MAAM,CAAC;CACrC,kBAwRA,CAAC"}
1
+ {"version":3,"file":"release.d.ts","sourceRoot":"","sources":["../../src/release.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAyB3D;;;GAGG;AACH,wBAAsB,OAAO,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAsIlE"}
@@ -0,0 +1,33 @@
1
+ export interface PackageConfig {
2
+ /** Short identifier, e.g. "framework" */
3
+ name: string;
4
+ /** Relative path from repo root, e.g. "framework" */
5
+ path: string;
6
+ /** Human-readable label for changelogs, e.g. "VC-Shell Framework (@vc-shell/framework)" */
7
+ displayName: string;
8
+ }
9
+ export interface ReleaseConfig {
10
+ packages: PackageConfig[];
11
+ /**
12
+ * Git tag prefix passed to `lerna version --tag-version-prefix`.
13
+ * Use `"v"` (default) for framework, `"vendor-portal-v"` for vendor-portal
14
+ * to avoid tag collisions in multi-repo setups.
15
+ */
16
+ tagVersionPrefix?: string;
17
+ /** Hook executed after version bump (e.g. update boilerplate deps). */
18
+ customHooks?: (version: string) => void | Promise<void>;
19
+ /** Whether to sync root package.json version with packages (default true). */
20
+ updateRootVersion?: boolean;
21
+ }
22
+ export interface ChangelogGeneratorOptions {
23
+ packages: PackageConfig[];
24
+ rootDir?: string;
25
+ generateRoot?: boolean;
26
+ includeRootHeader?: boolean;
27
+ }
28
+ export interface RootChangelogOptions {
29
+ packages: PackageConfig[];
30
+ rootDir?: string;
31
+ includeRootHeader?: boolean;
32
+ }
33
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAC5B,yCAAyC;IACzC,IAAI,EAAE,MAAM,CAAC;IACb,qDAAqD;IACrD,IAAI,EAAE,MAAM,CAAC;IACb,2FAA2F;IAC3F,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,aAAa,EAAE,CAAC;IAC1B;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,uEAAuE;IACvE,WAAW,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACxD,8EAA8E;IAC9E,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED,MAAM,WAAW,yBAAyB;IACxC,QAAQ,EAAE,aAAa,EAAE,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,aAAa,EAAE,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B"}
@@ -1,4 +1,3 @@
1
- import { SpawnSyncOptionsWithStringEncoding } from 'node:child_process';
2
1
  import { default as mri } from 'mri';
3
2
 
4
3
  export declare const args: mri.Argv<{
@@ -14,15 +13,4 @@ export declare function getPackageInfo(pkgName: string): {
14
13
  pkgDir: string;
15
14
  pkgPath: string;
16
15
  };
17
- export declare function writePackageJson(pkgPath: string, pkg: any): Promise<void>;
18
- export declare function run(bin: string, args: string[], opts?: Partial<SpawnSyncOptionsWithStringEncoding>): Promise<import('child_process').SpawnSyncReturns<string | NonSharedBuffer>>;
19
- export declare function dryRun(bin: string, args: string[], opts?: Partial<SpawnSyncOptionsWithStringEncoding>): Promise<void>;
20
- export declare const runIfNotDry: typeof dryRun | typeof run;
21
- export declare function step(msg: string): void;
22
- interface VersionChoice {
23
- title: string;
24
- value: string | null;
25
- }
26
- export declare function getVersionChoices(currentVersion: string): VersionChoice[];
27
- export {};
28
16
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kCAAkC,EAAE,MAAM,oBAAoB,CAAC;AAGxE,OAAO,GAAG,MAAM,KAAK,CAAC;AAItB,eAAO,MAAM,IAAI;;EAAqB,CAAC;AAEvC,eAAO,MAAM,QAAQ,SAAa,CAAC;AAOnC,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM;;cAIpC,MAAM;iBACH,MAAM;wBACC,MAAM;;;;EAIzB;AAED,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,CAM/E;AAED,wBAAsB,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,IAAI,CAAC,EAAE,OAAO,CAAC,kCAAkC,CAAC,+EAExG;AAED,wBAAsB,MAAM,CAC1B,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,EAAE,EACd,IAAI,CAAC,EAAE,OAAO,CAAC,kCAAkC,CAAC,GACjD,OAAO,CAAC,IAAI,CAAC,CAEf;AAED,eAAO,MAAM,WAAW,4BAA0B,CAAC;AAEnD,wBAAgB,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAEtC;AAED,UAAU,aAAa;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB;AAED,wBAAgB,iBAAiB,CAAC,cAAc,EAAE,MAAM,GAAG,aAAa,EAAE,CAyCzE"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAEA,OAAO,GAAG,MAAM,KAAK,CAAC;AAGtB,eAAO,MAAM,IAAI;;EAAqB,CAAC;AAEvC,eAAO,MAAM,QAAQ,SAAa,CAAC;AAEnC,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM;;cAIpC,MAAM;iBACH,MAAM;wBACC,MAAM;;;;EAIzB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vc-shell/release-config",
3
- "version": "1.2.4-beta.3",
3
+ "version": "1.2.4-beta.5",
4
4
  "type": "module",
5
5
  "main": "dist/release-config.js",
6
6
  "types": "./dist/src/index.d.ts",
@@ -20,19 +20,19 @@
20
20
  "lerna": "^9.0.0",
21
21
  "mri": "^1.2.0",
22
22
  "prompts": "^2.4.2",
23
- "semver": "^7.5.4",
24
- "vite": "^6.3.3"
23
+ "semver": "^7.5.4"
25
24
  },
26
25
  "devDependencies": {
27
26
  "@types/cross-spawn": "^6.0.6",
28
27
  "@types/prompts": "^2.4.7",
29
28
  "@types/semver": "^7.5.4",
30
29
  "typescript": "^5.8.3",
30
+ "vite": "^6.3.3",
31
31
  "vite-plugin-dts": "^3.6.4"
32
32
  },
33
33
  "publishConfig": {
34
34
  "access": "public",
35
35
  "registry": "https://registry.npmjs.org/"
36
36
  },
37
- "gitHead": "d42e7a822a2b2c7a5f89bf83d97babc2e4b3fa07"
37
+ "gitHead": "4cc2527f06178114fd3db9f781b1d6fd868a7a61"
38
38
  }
@@ -1,139 +0,0 @@
1
- import { sync as $ } from "cross-spawn";
2
- import { existsSync as u, readFileSync as d, writeFileSync as y } from "node:fs";
3
- import C from "node:path";
4
- import i from "chalk";
5
- async function L(N) {
6
- const { packages: f, rootDir: m = process.cwd(), generateRoot: b = !0, includeRootHeader: g = !0 } = N;
7
- console.log(i.cyan(`
8
- 🚀 Generating initial CHANGELOG.md files...
9
- `));
10
- for (const l of f) {
11
- const a = C.join(m, l.path, "CHANGELOG.md");
12
- if (u(a)) {
13
- const t = `${a}.backup`, s = d(a, "utf-8");
14
- y(t, s, "utf-8"), console.log(i.gray(` 📦 Backed up ${a} to ${t}`));
15
- }
16
- if (console.log(i.blue(`
17
- 📝 Generating changelog for ${l.name}...`)), $(
18
- "npx",
19
- [
20
- "conventional-changelog",
21
- "-p",
22
- "conventionalcommits",
23
- "-i",
24
- a,
25
- "-s",
26
- "-r",
27
- "0",
28
- // 0 = all commits
29
- "--commit-path",
30
- C.join(m, l.path)
31
- ],
32
- { stdio: "inherit", cwd: m }
33
- ).status === 0) {
34
- if (u(a)) {
35
- let t = d(a, "utf-8");
36
- t = t.replace(/^# CHANGELOG\s*\n/gm, ""), t = t.replace(/^# Change Log\s*\n/gm, ""), t = t.replace(/^All notable changes to this (project|package) will be documented in this file\.\s*\n/gm, ""), t = t.replace(
37
- /^See \[Conventional Commits\]\(https:\/\/conventionalcommits\.org\) for commit guidelines\.\s*\n/gm,
38
- ""
39
- ), t = t.replace(/\n{3,}/g, `
40
-
41
- `), t = t.replace(
42
- /^(##\s+\[[^\]]+\][^\n]*\n)\n(##\s+\[|$)/gm,
43
- `$1
44
- **Note:** Version bump only
45
-
46
- $2`
47
- ), t = t.trim() + `
48
- `, y(a, t, "utf-8");
49
- }
50
- console.log(i.green(` ✓ Generated ${a}`));
51
- } else
52
- console.log(i.red(` ✗ Failed to generate ${a}`));
53
- }
54
- b && await w({ packages: f, rootDir: m, includeRootHeader: g }), console.log(i.green(`
55
- ✅ Initial changelogs generated successfully!`)), console.log(i.cyan(`
56
- 📋 Next steps:`)), console.log(i.cyan(" 1. Review the generated CHANGELOG.md files")), console.log(i.cyan(" 2. Make any manual adjustments if needed")), console.log(i.cyan(` 3. Commit the changes
57
- `));
58
- }
59
- async function w(N) {
60
- const { packages: f, rootDir: m = process.cwd(), includeRootHeader: b = !0 } = N;
61
- console.log(i.blue(`
62
- 📝 Generating consolidated root changelog...`));
63
- const g = C.join(m, "CHANGELOG.md");
64
- if (u(g)) {
65
- const s = `${g}.backup`, r = d(g, "utf-8");
66
- y(s, r, "utf-8"), console.log(i.gray(` 📦 Backed up ${g} to ${s}`));
67
- }
68
- const l = {}, a = {};
69
- for (const s of f) {
70
- const r = C.join(m, s.path, "CHANGELOG.md");
71
- if (console.log(i.gray(` 📖 Collecting changes from ${s.name}...`)), u(r)) {
72
- const p = d(r, "utf-8").split(`
73
- `);
74
- let e = null, o = [];
75
- for (const n of p) {
76
- const G = n.match(/^##\s+(?:\[)?([\d.a-z-]+)(?:\])?(?:\s+\([^)]+\))?/i);
77
- if (G) {
78
- if (e && o.length > 0) {
79
- const k = o.join(`
80
- `).trim();
81
- l[e] || (l[e] = {}), l[e][s.displayName] = k;
82
- }
83
- e = G[1], o = [], a[e] || (a[e] = n.replace(/^##\s+/, ""));
84
- } else e && n.trim() !== "" && !n.startsWith("# CHANGELOG") && !n.startsWith("# Change Log") && !n.startsWith("All notable changes") && !n.startsWith("See [Conventional Commits]") && o.push(n);
85
- }
86
- if (e && o.length > 0) {
87
- const n = o.join(`
88
- `).trim();
89
- l[e] || (l[e] = {}), l[e][s.displayName] = n;
90
- }
91
- }
92
- }
93
- let c = "";
94
- b && (c = `# CHANGELOG
95
-
96
- All notable changes to this monorepo will be documented in this file.
97
-
98
- `);
99
- const t = Object.keys(l).sort((s, r) => {
100
- const h = s.split(/[.-]/).map((e) => isNaN(parseInt(e)) ? e : parseInt(e)), p = r.split(/[.-]/).map((e) => isNaN(parseInt(e)) ? e : parseInt(e));
101
- for (let e = 0; e < Math.max(h.length, p.length); e++) {
102
- const o = h[e] ?? 0, n = p[e] ?? 0;
103
- if (o !== n)
104
- return typeof o == "number" && typeof n == "number" ? n - o : String(n).localeCompare(String(o));
105
- }
106
- return 0;
107
- });
108
- for (const s of t) {
109
- const r = l[s], h = Object.values(r).some((o) => !o || !o.trim() ? !1 : o.replace(/\*\*Note:\*\*\s+Version bump only[^\n]*/gi, "").trim().length > 0), p = a[s] || s;
110
- if (c += `## ${p}
111
-
112
- `, !h) {
113
- c += `**Note:** Version bump only
114
-
115
- `;
116
- continue;
117
- }
118
- let e = !1;
119
- for (const o of f) {
120
- const n = r[o.displayName];
121
- n && n.trim() && n.replace(/\*\*Note:\*\*\s+Version bump only[^\n]*/gi, "").trim().length > 0 && (e = !0, c += `### ${o.displayName}
122
-
123
- `, c += `${n}
124
-
125
- `);
126
- }
127
- e || (c += `**Note:** Version bump only
128
-
129
- `);
130
- }
131
- c = c.replace(/\n{3,}/g, `
132
-
133
- `), c = c.trim() + `
134
- `, y(g, c, "utf-8"), console.log(i.green(` ✓ Generated ${g} with package grouping`));
135
- }
136
- export {
137
- w as a,
138
- L as g
139
- };