Skip to content

Commit 86aa9c1

Browse files
authored
build: fix staging release checks after auto-generating material-experimental package json (#24846)
We recently started auto-generating the material-experimental package.json file to avoid duplicating the MDC version/deps across multiple places. The staging checks assume a `package.json` file to be visible in the source files. For our checks it is sufficient to use the handwritten base package.json file.
1 parent 5ab04ec commit 86aa9c1

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

tools/release-checks/check-migration-collections.ts

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,31 @@
11
import {error} from '@angular/dev-infra-private/ng-dev';
2-
import {dirname, join} from 'path';
32
import chalk from 'chalk';
4-
import {releasePackages} from '../../.ng-dev/release';
5-
import {readFileSync} from 'fs';
3+
import {existsSync, readFileSync} from 'fs';
4+
import {dirname, join} from 'path';
65
import semver from 'semver';
76

7+
import {releasePackages} from '../../.ng-dev/release';
8+
89
/** Path to the directory containing all package sources. */
910
const packagesDir = join(__dirname, '../../src');
1011

1112
/** Asserts that valid migration collections for `ng-update` are configured. */
1213
export async function assertValidUpdateMigrationCollections(newVersion: semver.SemVer) {
1314
const failures: string[] = [];
1415
releasePackages.forEach(packageName => {
16+
const packageDir = join(packagesDir, packageName);
17+
let packageJsonPath = join(packageDir, 'package.json');
18+
19+
// Some `package.json` files are auto-generated. In such cases we will have
20+
// a `package-base.json` file (as seen in the `material-experimental` package).
21+
// This will be the handwritten base config we use for validation.
22+
if (!existsSync(packageJsonPath)) {
23+
packageJsonPath = join(packageDir, 'package-base.json');
24+
}
25+
1526
failures.push(
16-
...checkPackageJsonMigrations(join(packagesDir, packageName, 'package.json'), newVersion).map(
17-
f => chalk.yellow(` ⮑ ${chalk.bold(packageName)}: ${f}`),
27+
...checkPackageJsonMigrations(packageJsonPath, newVersion).map(f =>
28+
chalk.yellow(` ⮑ ${chalk.bold(packageName)}: ${f}`),
1829
),
1930
);
2031
});

0 commit comments

Comments
 (0)