@vc-shell/release-config 1.2.4-beta.4 → 1.2.4-beta.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/dist/cli-generate-changelogs.js +1 -1
- package/dist/generate-changelogs-ujWf_gXz.js +352 -0
- package/dist/release-config.js +182 -269
- package/dist/src/changelog.d.ts +40 -0
- package/dist/src/changelog.d.ts.map +1 -0
- package/dist/src/generate-changelogs.d.ts +7 -23
- package/dist/src/generate-changelogs.d.ts.map +1 -1
- package/dist/src/git.d.ts +54 -0
- package/dist/src/git.d.ts.map +1 -0
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/lerna.d.ts +30 -0
- package/dist/src/lerna.d.ts.map +1 -0
- package/dist/src/prompts.d.ts +29 -0
- package/dist/src/prompts.d.ts.map +1 -0
- package/dist/src/release.d.ts +5 -25
- package/dist/src/release.d.ts.map +1 -1
- package/dist/src/types.d.ts +33 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/utils.d.ts +0 -12
- package/dist/src/utils.d.ts.map +1 -1
- package/package.json +4 -4
- package/dist/generate-changelogs-_wYT4v6U.js +0 -139
package/dist/release-config.js
CHANGED
|
@@ -1,40 +1,21 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
import { g as
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
import { parse as b, valid as N } from "semver";
|
|
2
|
+
import { readFileSync as V, writeFileSync as x } from "node:fs";
|
|
3
|
+
import R from "node:path";
|
|
4
|
+
import $ from "mri";
|
|
5
|
+
import { argv as D } from "node:process";
|
|
6
|
+
import n from "chalk";
|
|
7
|
+
import { sync as f } from "cross-spawn";
|
|
8
|
+
import d from "prompts";
|
|
9
|
+
import { f as T, e as I, b as E, d as L, g as S, a as j, s as U, r as J, p as O } from "./generate-changelogs-ujWf_gXz.js";
|
|
10
|
+
import { c as le } from "./generate-changelogs-ujWf_gXz.js";
|
|
11
|
+
const l = $(D.slice(2));
|
|
12
|
+
l.dry;
|
|
13
|
+
function v(t) {
|
|
14
|
+
const o = R.resolve(t), e = R.resolve(o, "package.json");
|
|
15
|
+
return { pkg: JSON.parse(V(e, "utf-8")), pkgDir: o, pkgPath: e };
|
|
15
16
|
}
|
|
16
|
-
|
|
17
|
-
|
|
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: t } = await d({
|
|
38
19
|
type: "select",
|
|
39
20
|
name: "releaseType",
|
|
40
21
|
message: "Select release type",
|
|
@@ -45,260 +26,192 @@ const X = async ({
|
|
|
45
26
|
{ title: "Custom version", value: "custom" }
|
|
46
27
|
]
|
|
47
28
|
});
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
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 t;
|
|
30
|
+
}
|
|
31
|
+
async function G(t) {
|
|
32
|
+
const o = b(t), e = o && o.prerelease.length > 0, s = e ? o.prerelease[0] : null, { preid: i } = await d({
|
|
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 (i)
|
|
52
|
+
return e && s === i ? { preid: i, lernaVersionArg: "prerelease", lernaPreidArgs: [] } : { preid: i, lernaVersionArg: "prerelease", lernaPreidArgs: ["--preid", i] };
|
|
53
|
+
}
|
|
54
|
+
async function H(t) {
|
|
55
|
+
const { customVersion: o } = await d({
|
|
56
|
+
type: "text",
|
|
57
|
+
name: "customVersion",
|
|
58
|
+
message: "Enter custom version",
|
|
59
|
+
initial: t,
|
|
60
|
+
validate: (e) => N(e) ? !0 : "Invalid semver version"
|
|
61
|
+
});
|
|
62
|
+
return o;
|
|
63
|
+
}
|
|
64
|
+
async function B() {
|
|
65
|
+
const { yes: t } = await d({
|
|
105
66
|
type: "confirm",
|
|
106
67
|
name: "yes",
|
|
107
68
|
message: "Ready to release. Continue?"
|
|
108
69
|
});
|
|
109
|
-
|
|
110
|
-
|
|
70
|
+
return !!t;
|
|
71
|
+
}
|
|
72
|
+
function u() {
|
|
73
|
+
console.log(n.yellow(`
|
|
111
74
|
Release cancelled
|
|
112
75
|
`));
|
|
113
|
-
|
|
76
|
+
}
|
|
77
|
+
function M(t, o) {
|
|
78
|
+
const e = ["lerna", "version", ...t];
|
|
79
|
+
return e.push("--conventional-commits"), e.push("--tag-version-prefix", o.tagVersionPrefix), e.push("--no-push"), o.isDryRun && e.push("--no-git-tag-version"), o.forcePublish && (e.push("--force-publish"), console.log(n.yellow(`
|
|
80
|
+
Force publish mode - all packages will be versioned
|
|
81
|
+
`))), e;
|
|
82
|
+
}
|
|
83
|
+
function Y(t) {
|
|
84
|
+
console.log(n.cyan(`
|
|
85
|
+
Running: npx ${t.join(" ")}
|
|
86
|
+
`));
|
|
87
|
+
const o = f("npx", t, { stdio: "inherit" });
|
|
88
|
+
o.status !== 0 && (console.error(n.red(`
|
|
89
|
+
Release process failed
|
|
90
|
+
`)), process.exit(o.status || 1));
|
|
91
|
+
}
|
|
92
|
+
function q(t) {
|
|
93
|
+
const o = {};
|
|
94
|
+
for (const e of t) {
|
|
95
|
+
const { pkg: s } = v(e.path);
|
|
96
|
+
o[e.path] = s.version;
|
|
114
97
|
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
const
|
|
119
|
-
|
|
120
|
-
if (
|
|
121
|
-
|
|
122
|
-
i[l] = c.version;
|
|
98
|
+
return o;
|
|
99
|
+
}
|
|
100
|
+
function z(t, o) {
|
|
101
|
+
for (const e of t) {
|
|
102
|
+
const { pkg: s } = v(e.path);
|
|
103
|
+
if (s.version !== o[e.path])
|
|
104
|
+
return s.version;
|
|
123
105
|
}
|
|
124
|
-
|
|
125
|
-
|
|
106
|
+
return null;
|
|
107
|
+
}
|
|
108
|
+
function K(t, o, e) {
|
|
109
|
+
if (console.log(n.gray(`
|
|
110
|
+
--- Release diagnostics ---`)), console.log(n.gray(` tagVersionPrefix: "${t}"`)), console.log(n.gray(` looking for tags: ${t}${o}.*`)), e) {
|
|
111
|
+
const s = f("git", ["rev-list", "--count", `${e}..HEAD`], {
|
|
112
|
+
stdio: "pipe",
|
|
113
|
+
encoding: "utf-8"
|
|
114
|
+
}), i = s.status === 0 ? s.stdout.trim() : "?", a = f(
|
|
115
|
+
"git",
|
|
116
|
+
["log", `${e}..HEAD`, "--oneline", "--grep", "^feat\\|^fix\\|^perf\\|^revert"],
|
|
117
|
+
{ stdio: "pipe", encoding: "utf-8" }
|
|
118
|
+
), g = a.status === 0 ? a.stdout.trim().split(`
|
|
119
|
+
`).filter(Boolean).length : 0;
|
|
120
|
+
console.log(n.gray(` last matching tag: ${e}`)), console.log(n.gray(` commits since tag: ${i}`)), console.log(n.gray(` conventional commits: ${g}`)), g === 0 && parseInt(i) > 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(`---------------------------
|
|
128
|
+
`));
|
|
129
|
+
}
|
|
130
|
+
async function re(t) {
|
|
131
|
+
const {
|
|
132
|
+
packages: o,
|
|
133
|
+
tagVersionPrefix: e = "v",
|
|
134
|
+
customHooks: s,
|
|
135
|
+
updateRootVersion: i = !0
|
|
136
|
+
} = t;
|
|
137
|
+
if (o.length === 0)
|
|
138
|
+
throw new Error("No packages to release");
|
|
139
|
+
const a = !!l.dry;
|
|
140
|
+
a && console.log(n.yellow(`
|
|
141
|
+
DRY RUN MODE - No git operations will be performed
|
|
126
142
|
`));
|
|
127
|
-
const
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
if (
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
143
|
+
const { pkg: g } = v(o[0].path), m = g.version, k = m.split(".").slice(0, 2).join("."), P = T(k, e);
|
|
144
|
+
K(e, k, P);
|
|
145
|
+
const c = await F();
|
|
146
|
+
if (!c) return u();
|
|
147
|
+
const p = [];
|
|
148
|
+
if (c !== "auto") {
|
|
149
|
+
if (c === "prerelease") {
|
|
150
|
+
const r = await G(m);
|
|
151
|
+
if (!r) return u();
|
|
152
|
+
p.push(r.lernaVersionArg, ...r.lernaPreidArgs), l.tag || (l.tag = r.preid);
|
|
153
|
+
} else if (c === "graduate")
|
|
154
|
+
p.push("--conventional-graduate");
|
|
155
|
+
else if (c === "custom") {
|
|
156
|
+
const r = await H(m);
|
|
157
|
+
if (!r) return u();
|
|
158
|
+
p.push(r);
|
|
159
|
+
const h = b(r);
|
|
160
|
+
if (h && h.prerelease.length > 0 && !l.tag) {
|
|
161
|
+
const w = h.prerelease[0];
|
|
162
|
+
typeof w == "string" && (l.tag = w);
|
|
163
|
+
}
|
|
138
164
|
}
|
|
139
165
|
}
|
|
140
|
-
if (!
|
|
141
|
-
|
|
142
|
-
|
|
166
|
+
if (!await B()) return u();
|
|
167
|
+
const A = M(p, {
|
|
168
|
+
tagVersionPrefix: e,
|
|
169
|
+
isDryRun: a,
|
|
170
|
+
forcePublish: !!l.force
|
|
171
|
+
}), C = q(o);
|
|
172
|
+
Y(A);
|
|
173
|
+
const y = z(o, C);
|
|
174
|
+
if (!y) {
|
|
175
|
+
console.log(n.yellow(`
|
|
176
|
+
No packages were versioned. Nothing to release.
|
|
143
177
|
`));
|
|
144
178
|
return;
|
|
145
179
|
}
|
|
146
|
-
if (
|
|
147
|
-
console.log(e.cyan(`
|
|
180
|
+
if (i && Q(y, a), s && (console.log(n.cyan(`
|
|
148
181
|
Running post-version hooks...
|
|
149
|
-
`))
|
|
150
|
-
|
|
151
|
-
await v(l.version);
|
|
152
|
-
}
|
|
153
|
-
console.log(e.cyan(`
|
|
182
|
+
`)), await s(y)), !a) {
|
|
183
|
+
console.log(n.cyan(`
|
|
154
184
|
Updating yarn.lock with new package versions...
|
|
155
185
|
`));
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
`)), process.exit(
|
|
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
|
|
163
|
-
`)), 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
|
|
179
|
-
`));
|
|
186
|
+
const r = f("yarn", ["install"], { stdio: "inherit" });
|
|
187
|
+
r.status !== 0 && (console.error(n.red(`
|
|
188
|
+
Failed to update yarn.lock
|
|
189
|
+
`)), process.exit(r.status || 1));
|
|
180
190
|
}
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
`)), console.log(
|
|
185
|
-
`)), console.log(
|
|
186
|
-
`))
|
|
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...
|
|
191
|
+
if (I(o, a), E(o, e, a), L(o, a), S({ packages: o }, a), a)
|
|
192
|
+
console.log(n.yellow(`
|
|
193
|
+
Dry run completed successfully!
|
|
194
|
+
`)), console.log(n.cyan("Changes made:")), console.log(n.cyan(" - Updated package versions")), console.log(n.cyan(` - Generated/updated CHANGELOG.md files
|
|
195
|
+
`)), console.log(n.yellow("No git operations performed. Review changes with:")), console.log(n.cyan(` git diff
|
|
196
|
+
`)), console.log(n.yellow("To revert all changes:")), console.log(n.cyan(` git checkout -- .
|
|
195
197
|
`));
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
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
|
-
}
|
|
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...
|
|
198
|
+
else {
|
|
199
|
+
const r = j();
|
|
200
|
+
r || (console.error(n.red(`
|
|
201
|
+
Could not determine the git tag created by Lerna
|
|
202
|
+
`)), process.exit(1)), U(), J(r), O(r), console.log(n.green(`
|
|
203
|
+
Release completed successfully!
|
|
204
|
+
`)), console.log(n.cyan(`npmTag will be automatically determined from git tag in CI
|
|
229
205
|
`));
|
|
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
206
|
}
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
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"));
|
|
207
|
+
}
|
|
208
|
+
function Q(t, o) {
|
|
209
|
+
const e = "package.json", s = JSON.parse(V(e, "utf-8"));
|
|
210
|
+
s.version !== t && (s.version = t, o || x(e, JSON.stringify(s, null, 2) + `
|
|
211
|
+
`, "utf-8"), console.log(n.gray(` Updated root package.json version: ${t}`)));
|
|
299
212
|
}
|
|
300
213
|
export {
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
214
|
+
le as generateInitialChangelogs,
|
|
215
|
+
S as generateRootChangelog,
|
|
216
|
+
re as release
|
|
304
217
|
};
|
|
@@ -0,0 +1,40 @@
|
|
|
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
|
+
/**
|
|
26
|
+
* Scans package changelogs for "Version bump only" entries and fills them
|
|
27
|
+
* with actual conventional commit content from git history.
|
|
28
|
+
*
|
|
29
|
+
* Handles non-ancestor tags (after rebase/force-push) by resolving via merge-base.
|
|
30
|
+
* Deduplicates against commits already present in the changelog.
|
|
31
|
+
*/
|
|
32
|
+
export declare function backfillEmptyVersions(packages: PackageConfig[], tagPrefix: string, dryRun?: boolean): void;
|
|
33
|
+
/**
|
|
34
|
+
* Removes duplicate commit entries across changelog versions.
|
|
35
|
+
* Each commit should only appear in the oldest version that contains it.
|
|
36
|
+
* This handles cases where Lerna attributes commits to a new version
|
|
37
|
+
* that were already recorded in backfilled older versions.
|
|
38
|
+
*/
|
|
39
|
+
export declare function deduplicateChangelog(packages: PackageConfig[], dryRun?: boolean): void;
|
|
40
|
+
//# 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;AAYjF;;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;AA2DD;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,aAAa,EAAE,EACzB,SAAS,EAAE,MAAM,EACjB,MAAM,UAAQ,GACb,IAAI,CAkEN;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,aAAa,EAAE,EAAE,MAAM,UAAQ,GAAG,IAAI,CA6EpF"}
|
|
@@ -1,27 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
|
-
*
|
|
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
|
-
|
|
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":"
|
|
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,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Finds the last git tag matching `<prefix><majorMinor>.*`.
|
|
3
|
+
* Returns the tag string or null if none found.
|
|
4
|
+
*/
|
|
5
|
+
export declare function findLastMatchingTag(majorMinor: string, tagPrefix: string): string | null;
|
|
6
|
+
/**
|
|
7
|
+
* Gets the repo URL for changelog commit links.
|
|
8
|
+
*/
|
|
9
|
+
export declare function getRepoUrl(): string | null;
|
|
10
|
+
/**
|
|
11
|
+
* Checks if a git tag exists.
|
|
12
|
+
*/
|
|
13
|
+
export declare function tagExists(tag: string): boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Checks if a ref (tag/commit) is an ancestor of HEAD.
|
|
16
|
+
*/
|
|
17
|
+
export declare function isAncestorOfHead(ref: string): boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Gets the merge base between two refs.
|
|
20
|
+
*/
|
|
21
|
+
export declare function getMergeBase(ref1: string, ref2: string): string | null;
|
|
22
|
+
export interface ConventionalCommit {
|
|
23
|
+
hash: string;
|
|
24
|
+
shortHash: string;
|
|
25
|
+
type: string;
|
|
26
|
+
scope: string | null;
|
|
27
|
+
subject: string;
|
|
28
|
+
breaking: boolean;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Gets conventional commits in a range, optionally filtered by path.
|
|
32
|
+
*/
|
|
33
|
+
export declare function getConventionalCommitsInRange(from: string, to: string, commitPath?: string): ConventionalCommit[];
|
|
34
|
+
/**
|
|
35
|
+
* Gets the latest tag on current HEAD (created by Lerna).
|
|
36
|
+
*/
|
|
37
|
+
export declare function getLatestTag(): string | null;
|
|
38
|
+
/**
|
|
39
|
+
* Stages all modified tracked files and amends the last commit (created by Lerna).
|
|
40
|
+
* Uses `git add -u` to capture all release changes including custom hook modifications
|
|
41
|
+
* (e.g. boilerplate template versions, app dependency updates).
|
|
42
|
+
* Exits on failure.
|
|
43
|
+
*/
|
|
44
|
+
export declare function stageAndAmendCommit(): void;
|
|
45
|
+
/**
|
|
46
|
+
* Deletes and recreates the tag as an annotated tag on the amended commit.
|
|
47
|
+
*/
|
|
48
|
+
export declare function recreateAnnotatedTag(tag: string): void;
|
|
49
|
+
/**
|
|
50
|
+
* Pushes the amended commit and tag to origin.
|
|
51
|
+
* Uses --force-with-lease for the commit (safe force) and --force for the tag.
|
|
52
|
+
*/
|
|
53
|
+
export declare function pushToRemote(tag: string): void;
|
|
54
|
+
//# sourceMappingURL=git.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git.d.ts","sourceRoot":"","sources":["../../src/git.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAUxF;AAED;;GAEG;AACH,wBAAgB,UAAU,IAAI,MAAM,GAAG,IAAI,CAa1C;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAK9C;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAKrD;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAStE;AAED,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED;;GAEG;AACH,wBAAgB,6BAA6B,CAC3C,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,EACV,UAAU,CAAC,EAAE,MAAM,GAClB,kBAAkB,EAAE,CAsCtB;AAED;;GAEG;AACH,wBAAgB,YAAY,IAAI,MAAM,GAAG,IAAI,CAU5C;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,IAAI,IAAI,CAY1C;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAMtD;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAc9C"}
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { release } from './release';
|
|
2
2
|
export { generateInitialChangelogs, generateRootChangelog } from './generate-changelogs';
|
|
3
|
-
export type { PackageConfig, ChangelogGeneratorOptions } from './
|
|
3
|
+
export type { PackageConfig, ReleaseConfig, ChangelogGeneratorOptions } from './types';
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/src/index.d.ts.map
CHANGED
|
@@ -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,
|
|
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"}
|