Skip to content

Commit 633a1e5

Browse files
committed
build: changelog should not show changes to google-maps
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 633a1e5

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

tools/release/changelog.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import chalk from 'chalk';
22
import {createReadStream, createWriteStream, readFileSync} from 'fs';
33
import {prompt} from 'inquirer';
4-
import {join} from 'path';
4+
import {join, basename} from 'path';
55
import {Readable} from 'stream';
6-
import {releasePackages} from './release-output/release-packages';
6+
import {sync as globSync} from 'glob';
77

88
// These imports lack type definitions.
99
const conventionalChangelog = require('conventional-changelog');
@@ -17,7 +17,7 @@ interface ChangelogPackage {
1717
}
1818

1919
/** Hardcoded order of packages shown in the changelog. */
20-
const changelogPackageOrder = [
20+
const orderedChangelogPackages = [
2121
'cdk',
2222
'material',
2323
'google-maps',
@@ -97,6 +97,7 @@ export async function promptChangelogReleaseName(): Promise<string> {
9797
function createChangelogWriterOptions(changelogPath: string) {
9898
const existingChangelogContent = readFileSync(changelogPath, 'utf8');
9999
const commitSortFunction = changelogCompare.functionify(['type', 'scope', 'subject']);
100+
const allPackages = [...orderedChangelogPackages, ...excludedChangelogPackages];
100101

101102
return {
102103
// Overwrite the changelog templates so that we can render the commits grouped
@@ -125,7 +126,7 @@ function createChangelogWriterOptions(changelogPath: string) {
125126
// a commit targets the whole package and does not specify a specific scope.
126127
// e.g. "refactor(material-experimental): support strictness flags".
127128
if (!commit.package && commit.scope) {
128-
const matchingPackage = releasePackages.find(pkgName => pkgName === commit.scope);
129+
const matchingPackage = allPackages.find(pkgName => pkgName === commit.scope);
129130
if (matchingPackage) {
130131
commit.scope = null;
131132
commit.package = matchingPackage;
@@ -173,8 +174,8 @@ function createChangelogWriterOptions(changelogPath: string) {
173174
* sorted in alphabetical order after the hardcoded entries.
174175
*/
175176
function preferredOrderComparator(a: string, b: string): number {
176-
const aIndex = changelogPackageOrder.indexOf(a);
177-
const bIndex = changelogPackageOrder.indexOf(b);
177+
const aIndex = orderedChangelogPackages.indexOf(a);
178+
const bIndex = orderedChangelogPackages.indexOf(b);
178179
// If a package name could not be found in the hardcoded order, it should be
179180
// sorted after the hardcoded entries in alphabetical order.
180181
if (aIndex === -1) {

0 commit comments

Comments
 (0)