@williamthorsen/release-kit 6.0.0 → 7.0.0
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 +8 -0
- package/README.md +3 -3
- package/dist/esm/.cache +1 -1
- package/dist/esm/assertCleanWorkingTree.js +9 -14
- package/dist/esm/bin/release-kit.js +200 -199
- package/dist/esm/buildChangelogEntries.d.ts +2 -2
- package/dist/esm/buildChangelogEntries.js +142 -149
- package/dist/esm/buildDependencyGraph.d.ts +1 -1
- package/dist/esm/buildDependencyGraph.js +60 -59
- package/dist/esm/buildEmptyReleaseEntry.d.ts +1 -1
- package/dist/esm/buildEmptyReleaseEntry.js +12 -15
- package/dist/esm/buildReleaseSummary.d.ts +1 -1
- package/dist/esm/buildReleaseSummary.js +23 -26
- package/dist/esm/buildSyntheticChangelogEntry.d.ts +1 -1
- package/dist/esm/buildSyntheticChangelogEntry.js +9 -12
- package/dist/esm/bumpAllVersions.d.ts +1 -1
- package/dist/esm/bumpAllVersions.js +51 -52
- package/dist/esm/bumpVersion.d.ts +1 -1
- package/dist/esm/bumpVersion.js +25 -28
- package/dist/esm/changelogJsonFile.d.ts +1 -1
- package/dist/esm/changelogJsonFile.js +59 -62
- package/dist/esm/changelogJsonUtils.d.ts +1 -1
- package/dist/esm/changelogJsonUtils.js +35 -32
- package/dist/esm/changelogOverrides.d.ts +1 -1
- package/dist/esm/changelogOverrides.js +374 -377
- package/dist/esm/checkWorkTypesDrift.js +104 -102
- package/dist/esm/collectPolicyViolations.d.ts +2 -2
- package/dist/esm/collectPolicyViolations.js +11 -14
- package/dist/esm/commitCommand.js +48 -46
- package/dist/esm/compareVersions.js +20 -23
- package/dist/esm/createGithubRelease.js +56 -59
- package/dist/esm/createGithubReleaseCommand.js +21 -23
- package/dist/esm/createTags.js +57 -56
- package/dist/esm/decideRelease.d.ts +2 -2
- package/dist/esm/decideRelease.js +27 -41
- package/dist/esm/defaults.d.ts +3 -3
- package/dist/esm/defaults.js +36 -48
- package/dist/esm/deleteFileIfExists.js +10 -12
- package/dist/esm/deriveWorkspaceConfig.d.ts +1 -1
- package/dist/esm/deriveWorkspaceConfig.js +34 -36
- package/dist/esm/detectPackageManager.js +35 -37
- package/dist/esm/detectUndeclaredTagPrefixes.js +41 -40
- package/dist/esm/determineBumpFromCommits.d.ts +2 -2
- package/dist/esm/determineBumpFromCommits.js +25 -29
- package/dist/esm/determineBumpType.d.ts +1 -1
- package/dist/esm/determineBumpType.js +31 -32
- package/dist/esm/discoverWorkspaces.js +38 -40
- package/dist/esm/format.js +6 -11
- package/dist/esm/generateChangelogs.d.ts +1 -1
- package/dist/esm/generateChangelogs.js +13 -17
- package/dist/esm/getCommitsSinceTarget.d.ts +1 -1
- package/dist/esm/getCommitsSinceTarget.js +54 -55
- package/dist/esm/hasPrettierConfig.js +33 -35
- package/dist/esm/help/prepareHelp.js +4 -8
- package/dist/esm/index.d.ts +4 -4
- package/dist/esm/index.js +2 -8
- package/dist/esm/init/checks.js +28 -32
- package/dist/esm/init/detectRepoType.js +12 -15
- package/dist/esm/init/initCommand.js +60 -54
- package/dist/esm/init/parseJsonRecord.js +9 -11
- package/dist/esm/init/scaffold.d.ts +1 -1
- package/dist/esm/init/scaffold.js +32 -38
- package/dist/esm/init/templates.d.ts +1 -1
- package/dist/esm/init/templates.js +16 -22
- package/dist/esm/injectReleaseNotesIntoReadme.js +42 -49
- package/dist/esm/injectSection.js +17 -27
- package/dist/esm/loadConfig.d.ts +1 -1
- package/dist/esm/loadConfig.js +206 -225
- package/dist/esm/parseCommitMessage.d.ts +1 -1
- package/dist/esm/parseCommitMessage.js +72 -76
- package/dist/esm/parseRequestedTags.js +6 -9
- package/dist/esm/prepareCommand.d.ts +1 -1
- package/dist/esm/prepareCommand.js +225 -235
- package/dist/esm/previewTagPrefixes.d.ts +1 -1
- package/dist/esm/previewTagPrefixes.js +101 -96
- package/dist/esm/propagateBumps.d.ts +2 -2
- package/dist/esm/propagateBumps.js +48 -50
- package/dist/esm/publish.d.ts +2 -2
- package/dist/esm/publish.js +22 -28
- package/dist/esm/publishCommand.js +75 -80
- package/dist/esm/pushCommand.js +33 -34
- package/dist/esm/pushRelease.d.ts +1 -1
- package/dist/esm/pushRelease.js +21 -24
- package/dist/esm/readCurrentVersion.js +13 -17
- package/dist/esm/releasePrepare.d.ts +1 -1
- package/dist/esm/releasePrepare.js +213 -231
- package/dist/esm/releasePrepareMono.d.ts +2 -2
- package/dist/esm/releasePrepareMono.js +434 -494
- package/dist/esm/releasePrepareProject.d.ts +2 -2
- package/dist/esm/releasePrepareProject.js +143 -153
- package/dist/esm/renderChangelogMarkdown.d.ts +1 -1
- package/dist/esm/renderChangelogMarkdown.js +20 -24
- package/dist/esm/renderReleaseNotes.d.ts +1 -1
- package/dist/esm/renderReleaseNotes.js +50 -55
- package/dist/esm/reportPrepare.d.ts +1 -1
- package/dist/esm/reportPrepare.js +230 -231
- package/dist/esm/resolveCliffConfigPath.js +18 -23
- package/dist/esm/resolveCommandTags.d.ts +1 -1
- package/dist/esm/resolveCommandTags.js +47 -45
- package/dist/esm/resolveReleaseNotesConfig.d.ts +1 -1
- package/dist/esm/resolveReleaseNotesConfig.js +39 -43
- package/dist/esm/resolveReleaseTags.d.ts +1 -1
- package/dist/esm/resolveReleaseTags.js +39 -40
- package/dist/esm/runGitCliff.js +27 -30
- package/dist/esm/showTagPrefixesCommand.js +48 -70
- package/dist/esm/stripEmojiPrefix.js +2 -5
- package/dist/esm/stripScope.js +18 -21
- package/dist/esm/sync-labels/generateCommand.d.ts +1 -1
- package/dist/esm/sync-labels/generateCommand.js +51 -53
- package/dist/esm/sync-labels/initCommand.js +46 -48
- package/dist/esm/sync-labels/loadSyncLabelsConfig.d.ts +1 -1
- package/dist/esm/sync-labels/loadSyncLabelsConfig.js +46 -52
- package/dist/esm/sync-labels/presets.d.ts +1 -1
- package/dist/esm/sync-labels/presets.js +40 -43
- package/dist/esm/sync-labels/resolveLabels.d.ts +1 -1
- package/dist/esm/sync-labels/resolveLabels.js +28 -35
- package/dist/esm/sync-labels/syncCommand.js +30 -31
- package/dist/esm/sync-labels/templates.d.ts +1 -1
- package/dist/esm/sync-labels/templates.js +23 -26
- package/dist/esm/sync-labels/types.js +1 -0
- package/dist/esm/syncWorkTypes.js +83 -84
- package/dist/esm/tagCommand.js +12 -14
- package/dist/esm/typeGuards.js +4 -8
- package/dist/esm/types.js +66 -60
- package/dist/esm/validateConfig.d.ts +1 -1
- package/dist/esm/validateConfig.js +109 -115
- package/dist/esm/validateOnlyExcludesStrandedDependents.d.ts +2 -2
- package/dist/esm/validateOnlyExcludesStrandedDependents.js +97 -91
- package/dist/esm/validateOverridesCommand.d.ts +2 -2
- package/dist/esm/validateOverridesCommand.js +110 -111
- package/dist/esm/workTypesData.js +57 -60
- package/dist/esm/workTypesUtils.js +16 -21
- package/dist/esm/writeReleaseNotesPreviews.js +55 -57
- package/package.json +2 -2
|
@@ -6,174 +6,167 @@ import { runGitCliff } from "./runGitCliff.js";
|
|
|
6
6
|
import { stripEmojiPrefix } from "./stripEmojiPrefix.js";
|
|
7
7
|
import { isRecord, isUnknownArray } from "./typeGuards.js";
|
|
8
8
|
const HTML_COMMENT_PREFIX_PATTERN = /^<!--[^>]*-->/;
|
|
9
|
-
const CANONICAL_SECTION_ORDER = new Map(
|
|
10
|
-
Object.values(DEFAULT_WORK_TYPES).map((config, index) => [stripGroupDecorations(config.header), index])
|
|
11
|
-
);
|
|
9
|
+
const CANONICAL_SECTION_ORDER = new Map(Object.values(DEFAULT_WORK_TYPES).map((config, index) => [stripGroupDecorations(config.header), index]));
|
|
12
10
|
function canonicalSectionPriority(title) {
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
const index = CANONICAL_SECTION_ORDER.get(stripGroupDecorations(title));
|
|
12
|
+
return index ?? Number.POSITIVE_INFINITY;
|
|
15
13
|
}
|
|
16
|
-
function stripGroupDecorations(group) {
|
|
17
|
-
|
|
14
|
+
export function stripGroupDecorations(group) {
|
|
15
|
+
return stripEmojiPrefix(group.replace(HTML_COMMENT_PREFIX_PATTERN, ''));
|
|
18
16
|
}
|
|
19
|
-
function buildChangelogEntries(config, tag, options) {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
17
|
+
export function buildChangelogEntries(config, tag, options) {
|
|
18
|
+
const resolvedConfigPath = resolveCliffConfigPath(config.cliffConfigPath, import.meta.url);
|
|
19
|
+
const cliffArgs = ['--context', '--tag', tag];
|
|
20
|
+
if (options?.tagPattern !== undefined) {
|
|
21
|
+
cliffArgs.push('--tag-pattern', options.tagPattern);
|
|
22
|
+
}
|
|
23
|
+
for (const includePath of options?.includePaths ?? []) {
|
|
24
|
+
cliffArgs.push('--include-path', includePath);
|
|
25
|
+
}
|
|
26
|
+
try {
|
|
27
|
+
const contextJson = runGitCliff(resolvedConfigPath, cliffArgs, ['pipe', 'pipe', 'inherit']);
|
|
28
|
+
const releases = parseCliffContext(contextJson);
|
|
29
|
+
const devOnlySections = new Set(config.changelogJson.devOnlySections);
|
|
30
|
+
return transformReleases(releases, devOnlySections);
|
|
31
|
+
}
|
|
32
|
+
catch (error) {
|
|
33
|
+
throw new Error(`Failed to build changelog entries for tag ${tag}: ${error instanceof Error ? error.message : String(error)}`);
|
|
34
|
+
}
|
|
38
35
|
}
|
|
39
36
|
function parseCliffContext(json) {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
37
|
+
const parsed = JSON.parse(json);
|
|
38
|
+
if (!isUnknownArray(parsed)) {
|
|
39
|
+
throw new TypeError('Expected git-cliff --context output to be an array');
|
|
40
|
+
}
|
|
41
|
+
return parsed.map(toCliffContextRelease);
|
|
45
42
|
}
|
|
46
43
|
function toCliffContextRelease(value) {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
44
|
+
if (!isRecord(value)) {
|
|
45
|
+
return {};
|
|
46
|
+
}
|
|
47
|
+
const release = {};
|
|
48
|
+
if (typeof value.version === 'string') {
|
|
49
|
+
release.version = value.version;
|
|
50
|
+
}
|
|
51
|
+
if (typeof value.timestamp === 'number') {
|
|
52
|
+
release.timestamp = value.timestamp;
|
|
53
|
+
}
|
|
54
|
+
if (isUnknownArray(value.commits)) {
|
|
55
|
+
release.commits = value.commits.map(toCliffContextCommit);
|
|
56
|
+
}
|
|
57
|
+
return release;
|
|
61
58
|
}
|
|
62
59
|
function toCliffContextCommit(value) {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
60
|
+
if (!isRecord(value)) {
|
|
61
|
+
return { message: '' };
|
|
62
|
+
}
|
|
63
|
+
const commit = {
|
|
64
|
+
message: typeof value.message === 'string' ? value.message : '',
|
|
65
|
+
};
|
|
66
|
+
if (typeof value.group === 'string') {
|
|
67
|
+
commit.group = value.group;
|
|
68
|
+
}
|
|
69
|
+
if (typeof value.id === 'string') {
|
|
70
|
+
commit.id = value.id;
|
|
71
|
+
}
|
|
72
|
+
return commit;
|
|
76
73
|
}
|
|
77
74
|
function transformReleases(releases, devOnlySections) {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
75
|
+
const entries = [];
|
|
76
|
+
const devOnlyNormalised = new Set([...devOnlySections].map(stripGroupDecorations));
|
|
77
|
+
for (const release of releases) {
|
|
78
|
+
if (release.version === undefined) {
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
const version = extractVersion(release.version);
|
|
82
|
+
const date = release.timestamp !== undefined ? new Date(release.timestamp * 1000).toISOString().slice(0, 10) : 'unreleased';
|
|
83
|
+
const sectionMap = new Map();
|
|
84
|
+
for (const commit of release.commits ?? []) {
|
|
85
|
+
const group = stripCommentPrefix(commit.group ?? 'Other');
|
|
86
|
+
const description = extractDescription(commit.message);
|
|
87
|
+
const body = extractBody(commit.message);
|
|
88
|
+
const breaking = subjectHasBreakingMarker(commit.message);
|
|
89
|
+
let items = sectionMap.get(group);
|
|
90
|
+
if (items === undefined) {
|
|
91
|
+
items = [];
|
|
92
|
+
sectionMap.set(group, items);
|
|
93
|
+
}
|
|
94
|
+
const item = { description };
|
|
95
|
+
if (body !== undefined) {
|
|
96
|
+
item.body = body;
|
|
97
|
+
}
|
|
98
|
+
if (breaking) {
|
|
99
|
+
item.breaking = true;
|
|
100
|
+
}
|
|
101
|
+
if (commit.id !== undefined && commit.id !== '') {
|
|
102
|
+
item.hash = commit.id;
|
|
103
|
+
}
|
|
104
|
+
items.push(item);
|
|
105
|
+
}
|
|
106
|
+
const sections = [];
|
|
107
|
+
for (const [title, items] of sectionMap) {
|
|
108
|
+
if (items.length === 0) {
|
|
109
|
+
continue;
|
|
110
|
+
}
|
|
111
|
+
sections.push({
|
|
112
|
+
title,
|
|
113
|
+
audience: devOnlyNormalised.has(stripGroupDecorations(title)) ? 'dev' : 'all',
|
|
114
|
+
items,
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
sections.sort((a, b) => canonicalSectionPriority(a.title) - canonicalSectionPriority(b.title));
|
|
118
|
+
if (sections.length > 0) {
|
|
119
|
+
entries.push({ version, date, sections });
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return entries;
|
|
126
123
|
}
|
|
127
124
|
function stripCommentPrefix(group) {
|
|
128
|
-
|
|
125
|
+
return group.replace(HTML_COMMENT_PREFIX_PATTERN, '');
|
|
129
126
|
}
|
|
130
127
|
function subjectHasBreakingMarker(message) {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
128
|
+
let subject = message.split('\n', 1)[0] ?? '';
|
|
129
|
+
for (const pattern of COMMIT_PREPROCESSOR_PATTERNS) {
|
|
130
|
+
subject = subject.replace(pattern, '');
|
|
131
|
+
}
|
|
132
|
+
return /^(?:[^|]+\|)?\w+(?:\([^)]+\))?!:/.test(subject);
|
|
136
133
|
}
|
|
137
134
|
function extractDescription(message) {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
135
|
+
const firstLine = message.split('\n')[0] ?? message;
|
|
136
|
+
const afterColon = firstLine.split(': ').slice(1).join(': ');
|
|
137
|
+
if (afterColon.length > 0) {
|
|
138
|
+
return afterColon.charAt(0).toUpperCase() + afterColon.slice(1);
|
|
139
|
+
}
|
|
140
|
+
return firstLine;
|
|
144
141
|
}
|
|
145
142
|
const TRAILER_PATTERNS = [
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
143
|
+
/^Signed-off-by:/i,
|
|
144
|
+
/^Co-authored-by:/i,
|
|
145
|
+
/^(Closes|Fixes|Resolves)\s+#\d+\s*$/i,
|
|
146
|
+
/^https?:\/\/\S+\/pull\/\d+\/?\s*$/,
|
|
150
147
|
];
|
|
151
148
|
function extractBody(message) {
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
149
|
+
const lines = message.split('\n').slice(1);
|
|
150
|
+
let start = 0;
|
|
151
|
+
while (start < lines.length && (lines[start] ?? '').trim() === '') {
|
|
152
|
+
start += 1;
|
|
153
|
+
}
|
|
154
|
+
let end = lines.length;
|
|
155
|
+
while (end > start) {
|
|
156
|
+
const line = lines[end - 1] ?? '';
|
|
157
|
+
const trimmed = line.trim();
|
|
158
|
+
if (trimmed === '') {
|
|
159
|
+
end -= 1;
|
|
160
|
+
continue;
|
|
161
|
+
}
|
|
162
|
+
if (TRAILER_PATTERNS.some((pattern) => pattern.test(trimmed))) {
|
|
163
|
+
end -= 1;
|
|
164
|
+
continue;
|
|
165
|
+
}
|
|
166
|
+
break;
|
|
167
|
+
}
|
|
168
|
+
if (end <= start) {
|
|
169
|
+
return undefined;
|
|
170
|
+
}
|
|
171
|
+
return lines.slice(start, end).join('\n').trim();
|
|
175
172
|
}
|
|
176
|
-
export {
|
|
177
|
-
buildChangelogEntries,
|
|
178
|
-
stripGroupDecorations
|
|
179
|
-
};
|
|
@@ -1,66 +1,67 @@
|
|
|
1
|
-
import { readFileSync } from
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
2
|
function isPackageJsonSubset(value) {
|
|
3
|
-
|
|
3
|
+
return typeof value === 'object' && value !== null;
|
|
4
4
|
}
|
|
5
|
-
function buildDependencyGraph(workspaces) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
5
|
+
export function buildDependencyGraph(workspaces) {
|
|
6
|
+
const packageNameToDir = new Map();
|
|
7
|
+
const dirToPackageName = new Map();
|
|
8
|
+
const dependentsOf = new Map();
|
|
9
|
+
const dependenciesOf = new Map();
|
|
10
|
+
const workspacePackages = new Map();
|
|
11
|
+
for (const workspace of workspaces) {
|
|
12
|
+
const primaryPackageFile = workspace.packageFiles[0];
|
|
13
|
+
if (primaryPackageFile === undefined) {
|
|
14
|
+
continue;
|
|
15
|
+
}
|
|
16
|
+
const pkg = readPackageJsonSubset(primaryPackageFile);
|
|
17
|
+
workspacePackages.set(workspace, pkg);
|
|
18
|
+
if (pkg.name === undefined) {
|
|
19
|
+
continue;
|
|
20
|
+
}
|
|
21
|
+
packageNameToDir.set(pkg.name, workspace.dir);
|
|
22
|
+
dirToPackageName.set(workspace.dir, pkg.name);
|
|
15
23
|
}
|
|
16
|
-
const pkg
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
24
|
+
for (const [workspace, pkg] of workspacePackages) {
|
|
25
|
+
const allDeps = { ...pkg.dependencies, ...pkg.peerDependencies };
|
|
26
|
+
for (const [depName, depVersion] of Object.entries(allDeps)) {
|
|
27
|
+
if (typeof depVersion !== 'string' || !depVersion.startsWith('workspace:')) {
|
|
28
|
+
continue;
|
|
29
|
+
}
|
|
30
|
+
const existing = dependentsOf.get(depName);
|
|
31
|
+
if (existing === undefined) {
|
|
32
|
+
dependentsOf.set(depName, [workspace]);
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
existing.push(workspace);
|
|
36
|
+
}
|
|
37
|
+
const forward = dependenciesOf.get(workspace.dir);
|
|
38
|
+
if (forward === undefined) {
|
|
39
|
+
dependenciesOf.set(workspace.dir, new Set([depName]));
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
forward.add(depName);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
20
45
|
}
|
|
21
|
-
packageNameToDir
|
|
22
|
-
dirToPackageName.set(workspace.dir, pkg.name);
|
|
23
|
-
}
|
|
24
|
-
for (const [workspace, pkg] of workspacePackages) {
|
|
25
|
-
const allDeps = { ...pkg.dependencies, ...pkg.peerDependencies };
|
|
26
|
-
for (const [depName, depVersion] of Object.entries(allDeps)) {
|
|
27
|
-
if (typeof depVersion !== "string" || !depVersion.startsWith("workspace:")) {
|
|
28
|
-
continue;
|
|
29
|
-
}
|
|
30
|
-
const existing = dependentsOf.get(depName);
|
|
31
|
-
if (existing === void 0) {
|
|
32
|
-
dependentsOf.set(depName, [workspace]);
|
|
33
|
-
} else {
|
|
34
|
-
existing.push(workspace);
|
|
35
|
-
}
|
|
36
|
-
const forward = dependenciesOf.get(workspace.dir);
|
|
37
|
-
if (forward === void 0) {
|
|
38
|
-
dependenciesOf.set(workspace.dir, /* @__PURE__ */ new Set([depName]));
|
|
39
|
-
} else {
|
|
40
|
-
forward.add(depName);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
return { packageNameToDir, dirToPackageName, dependentsOf, dependenciesOf };
|
|
46
|
+
return { packageNameToDir, dirToPackageName, dependentsOf, dependenciesOf };
|
|
45
47
|
}
|
|
46
48
|
function readPackageJsonSubset(filePath) {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
49
|
+
let content;
|
|
50
|
+
try {
|
|
51
|
+
content = readFileSync(filePath, 'utf8');
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
throw new Error(`Failed to read ${filePath}: ${error instanceof Error ? error.message : String(error)}`);
|
|
55
|
+
}
|
|
56
|
+
let parsed;
|
|
57
|
+
try {
|
|
58
|
+
parsed = JSON.parse(content);
|
|
59
|
+
}
|
|
60
|
+
catch (error) {
|
|
61
|
+
throw new Error(`Failed to parse JSON in ${filePath}: ${error instanceof Error ? error.message : String(error)}`);
|
|
62
|
+
}
|
|
63
|
+
if (!isPackageJsonSubset(parsed)) {
|
|
64
|
+
throw new Error(`Invalid package.json at ${filePath}`);
|
|
65
|
+
}
|
|
66
|
+
return parsed;
|
|
63
67
|
}
|
|
64
|
-
export {
|
|
65
|
-
buildDependencyGraph
|
|
66
|
-
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { ChangelogEntry } from './types.
|
|
1
|
+
import type { ChangelogEntry } from './types.js';
|
|
2
2
|
export declare function buildEmptyReleaseEntry(version: string, date: string): ChangelogEntry;
|
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
function buildEmptyReleaseEntry(version, date) {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
export function buildEmptyReleaseEntry(version, date) {
|
|
2
|
+
return {
|
|
3
|
+
version,
|
|
4
|
+
date,
|
|
5
|
+
sections: [
|
|
6
|
+
{
|
|
7
|
+
title: 'Notes',
|
|
8
|
+
audience: 'dev',
|
|
9
|
+
items: [{ description: 'Forced version bump.' }],
|
|
10
|
+
},
|
|
11
|
+
],
|
|
12
|
+
};
|
|
13
13
|
}
|
|
14
|
-
export {
|
|
15
|
-
buildEmptyReleaseEntry
|
|
16
|
-
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { PrepareResult } from './types.
|
|
1
|
+
import type { PrepareResult } from './types.js';
|
|
2
2
|
export declare function buildReleaseSummary(result: PrepareResult): string;
|
|
@@ -1,30 +1,27 @@
|
|
|
1
1
|
import { stripScope } from "./stripScope.js";
|
|
2
|
-
function buildReleaseSummary(result) {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
export function buildReleaseSummary(result) {
|
|
3
|
+
const sections = [];
|
|
4
|
+
for (const workspace of result.workspaces) {
|
|
5
|
+
if (workspace.status !== 'released') {
|
|
6
|
+
continue;
|
|
7
|
+
}
|
|
8
|
+
const commits = workspace.commits;
|
|
9
|
+
if (commits === undefined || commits.length === 0) {
|
|
10
|
+
continue;
|
|
11
|
+
}
|
|
12
|
+
const lines = [workspace.tag];
|
|
13
|
+
for (const commit of commits) {
|
|
14
|
+
lines.push(`- ${stripScope(commit.message)}`);
|
|
15
|
+
}
|
|
16
|
+
sections.push(lines.join('\n'));
|
|
7
17
|
}
|
|
8
|
-
const
|
|
9
|
-
if (
|
|
10
|
-
|
|
18
|
+
const project = result.project;
|
|
19
|
+
if (project !== undefined && project.status === 'released' && project.commits.length > 0) {
|
|
20
|
+
const lines = [project.tag];
|
|
21
|
+
for (const commit of project.commits) {
|
|
22
|
+
lines.push(`- ${stripScope(commit.message)}`);
|
|
23
|
+
}
|
|
24
|
+
sections.push(lines.join('\n'));
|
|
11
25
|
}
|
|
12
|
-
|
|
13
|
-
for (const commit of commits) {
|
|
14
|
-
lines.push(`- ${stripScope(commit.message)}`);
|
|
15
|
-
}
|
|
16
|
-
sections.push(lines.join("\n"));
|
|
17
|
-
}
|
|
18
|
-
const project = result.project;
|
|
19
|
-
if (project !== void 0 && project.status === "released" && project.commits.length > 0) {
|
|
20
|
-
const lines = [project.tag];
|
|
21
|
-
for (const commit of project.commits) {
|
|
22
|
-
lines.push(`- ${stripScope(commit.message)}`);
|
|
23
|
-
}
|
|
24
|
-
sections.push(lines.join("\n"));
|
|
25
|
-
}
|
|
26
|
-
return sections.join("\n\n");
|
|
26
|
+
return sections.join('\n\n');
|
|
27
27
|
}
|
|
28
|
-
export {
|
|
29
|
-
buildReleaseSummary
|
|
30
|
-
};
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
function buildSyntheticChangelogEntry(propagatedFrom, version, date) {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
export function buildSyntheticChangelogEntry(propagatedFrom, version, date) {
|
|
2
|
+
const items = propagatedFrom.map((dep) => ({
|
|
3
|
+
description: `Bumped \`${dep.packageName}\` to ${dep.newVersion}`,
|
|
4
|
+
}));
|
|
5
|
+
return {
|
|
6
|
+
version,
|
|
7
|
+
date,
|
|
8
|
+
sections: [{ title: 'Dependency updates', audience: 'dev', items }],
|
|
9
|
+
};
|
|
10
10
|
}
|
|
11
|
-
export {
|
|
12
|
-
buildSyntheticChangelogEntry
|
|
13
|
-
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { BumpResult, ReleaseType } from './types.
|
|
1
|
+
import type { BumpResult, ReleaseType } from './types.js';
|
|
2
2
|
export declare function bumpAllVersions(packageFiles: readonly string[], releaseType: ReleaseType, dryRun: boolean): BumpResult;
|
|
3
3
|
export declare function setAllVersions(packageFiles: readonly string[], newVersion: string, dryRun: boolean): BumpResult;
|