nx 17.2.4 → 17.2.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.
|
@@ -25,7 +25,20 @@ const defaultChangelogRenderer = async ({ projectGraph, commits, releaseVersion,
|
|
|
25
25
|
test: { title: '✅ Tests' },
|
|
26
26
|
style: { title: '🎨 Styles' },
|
|
27
27
|
ci: { title: '🤖 CI' },
|
|
28
|
+
revert: { title: '⏪ Revert' },
|
|
28
29
|
};
|
|
30
|
+
// If the current range of commits contains both a commit and its revert, we strip them both from the final list
|
|
31
|
+
for (const commit of commits) {
|
|
32
|
+
if (commit.type === 'revert') {
|
|
33
|
+
for (const revertedHash of commit.revertedHashes) {
|
|
34
|
+
const revertedCommit = commits.find((c) => revertedHash.startsWith(c.shortHash));
|
|
35
|
+
if (revertedCommit) {
|
|
36
|
+
commits.splice(commits.indexOf(revertedCommit), 1);
|
|
37
|
+
commits.splice(commits.indexOf(commit), 1);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
29
42
|
// workspace root level changelog
|
|
30
43
|
if (project === null) {
|
|
31
44
|
// No changes for the workspace
|
|
@@ -57,7 +70,10 @@ const defaultChangelogRenderer = async ({ projectGraph, commits, releaseVersion,
|
|
|
57
70
|
const line = formatCommit(commit, repoSlug);
|
|
58
71
|
markdownLines.push(line);
|
|
59
72
|
if (commit.isBreaking) {
|
|
60
|
-
|
|
73
|
+
const breakingChangeExplanation = extractBreakingChangeExplanation(commit.body);
|
|
74
|
+
breakingChanges.push(breakingChangeExplanation
|
|
75
|
+
? `- ${commit.scope ? `**${commit.scope.trim()}:** ` : ''}${breakingChangeExplanation}`
|
|
76
|
+
: line);
|
|
61
77
|
}
|
|
62
78
|
}
|
|
63
79
|
}
|
|
@@ -88,7 +104,10 @@ const defaultChangelogRenderer = async ({ projectGraph, commits, releaseVersion,
|
|
|
88
104
|
const line = formatCommit(commit, repoSlug);
|
|
89
105
|
markdownLines.push(line + '\n');
|
|
90
106
|
if (commit.isBreaking) {
|
|
91
|
-
|
|
107
|
+
const breakingChangeExplanation = extractBreakingChangeExplanation(commit.body);
|
|
108
|
+
breakingChanges.push(breakingChangeExplanation
|
|
109
|
+
? `- ${commit.scope ? `**${commit.scope.trim()}:** ` : ''}${breakingChangeExplanation}`
|
|
110
|
+
: line);
|
|
92
111
|
}
|
|
93
112
|
}
|
|
94
113
|
}
|
|
@@ -173,11 +192,32 @@ function groupBy(items, key) {
|
|
|
173
192
|
}
|
|
174
193
|
function formatCommit(commit, repoSlug) {
|
|
175
194
|
let commitLine = '- ' +
|
|
176
|
-
(commit.scope ? `**${commit.scope.trim()}:** ` : '') +
|
|
177
195
|
(commit.isBreaking ? '⚠️ ' : '') +
|
|
196
|
+
(commit.scope ? `**${commit.scope.trim()}:** ` : '') +
|
|
178
197
|
commit.description;
|
|
179
198
|
if (repoSlug) {
|
|
180
199
|
commitLine += (0, github_1.formatReferences)(commit.references, repoSlug);
|
|
181
200
|
}
|
|
182
201
|
return commitLine;
|
|
183
202
|
}
|
|
203
|
+
/**
|
|
204
|
+
* It is common to add further information about a breaking change in the commit body,
|
|
205
|
+
* and it is naturally that information that should be included in the BREAKING CHANGES
|
|
206
|
+
* section of changelog, rather than repeating the commit title/description.
|
|
207
|
+
*/
|
|
208
|
+
function extractBreakingChangeExplanation(message) {
|
|
209
|
+
const breakingChangeIdentifier = 'BREAKING CHANGE:';
|
|
210
|
+
const startIndex = message.indexOf(breakingChangeIdentifier);
|
|
211
|
+
if (startIndex === -1) {
|
|
212
|
+
// "BREAKING CHANGE:" not found in the message
|
|
213
|
+
return null;
|
|
214
|
+
}
|
|
215
|
+
const startOfBreakingChange = startIndex + breakingChangeIdentifier.length;
|
|
216
|
+
const endOfBreakingChange = message.indexOf('\n', startOfBreakingChange);
|
|
217
|
+
if (endOfBreakingChange === -1) {
|
|
218
|
+
// No newline character found, extract till the end of the message
|
|
219
|
+
return message.substring(startOfBreakingChange).trim();
|
|
220
|
+
}
|
|
221
|
+
// Extract and return the breaking change message
|
|
222
|
+
return message.substring(startOfBreakingChange, endOfBreakingChange).trim();
|
|
223
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nx",
|
|
3
|
-
"version": "17.2.
|
|
3
|
+
"version": "17.2.6",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The core Nx plugin contains the core functionality of Nx like the project graph, nx commands and task orchestration.",
|
|
6
6
|
"repository": {
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"yargs": "^17.6.2",
|
|
67
67
|
"yargs-parser": "21.1.1",
|
|
68
68
|
"node-machine-id": "1.1.12",
|
|
69
|
-
"@nrwl/tao": "17.2.
|
|
69
|
+
"@nrwl/tao": "17.2.6"
|
|
70
70
|
},
|
|
71
71
|
"peerDependencies": {
|
|
72
72
|
"@swc-node/register": "^1.6.7",
|
|
@@ -81,16 +81,16 @@
|
|
|
81
81
|
}
|
|
82
82
|
},
|
|
83
83
|
"optionalDependencies": {
|
|
84
|
-
"@nx/nx-darwin-x64": "17.2.
|
|
85
|
-
"@nx/nx-darwin-arm64": "17.2.
|
|
86
|
-
"@nx/nx-linux-x64-gnu": "17.2.
|
|
87
|
-
"@nx/nx-linux-x64-musl": "17.2.
|
|
88
|
-
"@nx/nx-win32-x64-msvc": "17.2.
|
|
89
|
-
"@nx/nx-linux-arm64-gnu": "17.2.
|
|
90
|
-
"@nx/nx-linux-arm64-musl": "17.2.
|
|
91
|
-
"@nx/nx-linux-arm-gnueabihf": "17.2.
|
|
92
|
-
"@nx/nx-win32-arm64-msvc": "17.2.
|
|
93
|
-
"@nx/nx-freebsd-x64": "17.2.
|
|
84
|
+
"@nx/nx-darwin-x64": "17.2.6",
|
|
85
|
+
"@nx/nx-darwin-arm64": "17.2.6",
|
|
86
|
+
"@nx/nx-linux-x64-gnu": "17.2.6",
|
|
87
|
+
"@nx/nx-linux-x64-musl": "17.2.6",
|
|
88
|
+
"@nx/nx-win32-x64-msvc": "17.2.6",
|
|
89
|
+
"@nx/nx-linux-arm64-gnu": "17.2.6",
|
|
90
|
+
"@nx/nx-linux-arm64-musl": "17.2.6",
|
|
91
|
+
"@nx/nx-linux-arm-gnueabihf": "17.2.6",
|
|
92
|
+
"@nx/nx-win32-arm64-msvc": "17.2.6",
|
|
93
|
+
"@nx/nx-freebsd-x64": "17.2.6"
|
|
94
94
|
},
|
|
95
95
|
"nx-migrations": {
|
|
96
96
|
"migrations": "./migrations.json",
|
|
@@ -20,6 +20,7 @@ export interface GitCommit extends RawGitCommit {
|
|
|
20
20
|
authors: GitCommitAuthor[];
|
|
21
21
|
isBreaking: boolean;
|
|
22
22
|
affectedFiles: string[];
|
|
23
|
+
revertedHashes: string[];
|
|
23
24
|
}
|
|
24
25
|
export declare function getLatestGitTagForPattern(releaseTagPattern: string, additionalInterpolationData?: {}): Promise<{
|
|
25
26
|
tag: string;
|
|
@@ -181,14 +181,14 @@ const CoAuthoredByRegex = /co-authored-by:\s*(?<name>.+)(<(?<email>.+)>)/gim;
|
|
|
181
181
|
const PullRequestRE = /\([ a-z]*(#\d+)\s*\)/gm;
|
|
182
182
|
const IssueRE = /(#\d+)/gm;
|
|
183
183
|
const ChangedFileRegex = /(A|M|D|R\d*|C\d*)\t([^\t\n]*)\t?(.*)?/gm;
|
|
184
|
+
const RevertHashRE = /This reverts commit (?<hash>[\da-f]{40})./gm;
|
|
184
185
|
function parseGitCommit(commit) {
|
|
185
186
|
const match = commit.message.match(ConventionalCommitRegex);
|
|
186
187
|
if (!match) {
|
|
187
188
|
return null;
|
|
188
189
|
}
|
|
189
|
-
const type = match.groups.type;
|
|
190
190
|
const scope = match.groups.scope || '';
|
|
191
|
-
const isBreaking = Boolean(match.groups.breaking);
|
|
191
|
+
const isBreaking = Boolean(match.groups.breaking) || commit.body.includes('BREAKING CHANGE:');
|
|
192
192
|
let description = match.groups.description;
|
|
193
193
|
// Extract references from message
|
|
194
194
|
const references = [];
|
|
@@ -203,6 +203,17 @@ function parseGitCommit(commit) {
|
|
|
203
203
|
references.push({ value: commit.shortHash, type: 'hash' });
|
|
204
204
|
// Remove references and normalize
|
|
205
205
|
description = description.replace(PullRequestRE, '').trim();
|
|
206
|
+
let type = match.groups.type;
|
|
207
|
+
// Extract any reverted hashes, if applicable
|
|
208
|
+
const revertedHashes = [];
|
|
209
|
+
const matchedHashes = commit.body.matchAll(RevertHashRE);
|
|
210
|
+
for (const matchedHash of matchedHashes) {
|
|
211
|
+
revertedHashes.push(matchedHash.groups.hash);
|
|
212
|
+
}
|
|
213
|
+
if (revertedHashes.length) {
|
|
214
|
+
type = 'revert';
|
|
215
|
+
description = commit.message;
|
|
216
|
+
}
|
|
206
217
|
// Find all authors
|
|
207
218
|
const authors = [commit.author];
|
|
208
219
|
for (const match of commit.body.matchAll(CoAuthoredByRegex)) {
|
|
@@ -223,6 +234,7 @@ function parseGitCommit(commit) {
|
|
|
223
234
|
scope,
|
|
224
235
|
references,
|
|
225
236
|
isBreaking,
|
|
237
|
+
revertedHashes,
|
|
226
238
|
affectedFiles,
|
|
227
239
|
};
|
|
228
240
|
}
|