Skip to content

Commit 45a4300

Browse files
devversionjelbourn
authored andcommitted
build: changelog should not show changes to google-maps (#17313)
We don't release the google-maps package and disabled the package group in the changelog. Apparently there is a bug where we do not detect commits as google-maps changes if the commit format does not specify an explicit package, but rather just a scope. We usually determine the package based on the scope by looking for matching packages. This did not work for `google-maps` changes such as 30de283
1 parent 473d4c6 commit 45a4300

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

tools/release/changelog.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import {createReadStream, createWriteStream, readFileSync} from 'fs';
33
import {prompt} from 'inquirer';
44
import {join} from 'path';
55
import {Readable} from 'stream';
6-
import {releasePackages} from './release-output/release-packages';
76

87
// These imports lack type definitions.
98
const conventionalChangelog = require('conventional-changelog');
@@ -17,7 +16,7 @@ interface ChangelogPackage {
1716
}
1817

1918
/** Hardcoded order of packages shown in the changelog. */
20-
const changelogPackageOrder = [
19+
const orderedChangelogPackages = [
2120
'cdk',
2221
'material',
2322
'google-maps',
@@ -97,6 +96,7 @@ export async function promptChangelogReleaseName(): Promise<string> {
9796
function createChangelogWriterOptions(changelogPath: string) {
9897
const existingChangelogContent = readFileSync(changelogPath, 'utf8');
9998
const commitSortFunction = changelogCompare.functionify(['type', 'scope', 'subject']);
99+
const allPackages = [...orderedChangelogPackages, ...excludedChangelogPackages];
100100

101101
return {
102102
// Overwrite the changelog templates so that we can render the commits grouped
@@ -125,7 +125,7 @@ function createChangelogWriterOptions(changelogPath: string) {
125125
// a commit targets the whole package and does not specify a specific scope.
126126
// e.g. "refactor(material-experimental): support strictness flags".
127127
if (!commit.package && commit.scope) {
128-
const matchingPackage = releasePackages.find(pkgName => pkgName === commit.scope);
128+
const matchingPackage = allPackages.find(pkgName => pkgName === commit.scope);
129129
if (matchingPackage) {
130130
commit.scope = null;
131131
commit.package = matchingPackage;
@@ -173,8 +173,8 @@ function createChangelogWriterOptions(changelogPath: string) {
173173
* sorted in alphabetical order after the hardcoded entries.
174174
*/
175175
function preferredOrderComparator(a: string, b: string): number {
176-
const aIndex = changelogPackageOrder.indexOf(a);
177-
const bIndex = changelogPackageOrder.indexOf(b);
176+
const aIndex = orderedChangelogPackages.indexOf(a);
177+
const bIndex = orderedChangelogPackages.indexOf(b);
178178
// If a package name could not be found in the hardcoded order, it should be
179179
// sorted after the hardcoded entries in alphabetical order.
180180
if (aIndex === -1) {

0 commit comments

Comments
 (0)