diff --git a/dev-infra/ng-dev.js b/dev-infra/ng-dev.js index ef56b441e7..b849312806 100755 --- a/dev-infra/ng-dev.js +++ b/dev-infra/ng-dev.js @@ -6800,11 +6800,15 @@ class ReleaseAction { /** Verify the version of each generated package exact matches the specified version. */ _verifyPackageVersions(version, packages) { return tslib.__awaiter(this, void 0, void 0, function* () { + /** Experimental equivalent version for packages created with the provided version. */ + const experimentalVersion = new semver.SemVer(`0.${version.major * 100 + version.minor}.${version.patch}`); for (const pkg of packages) { const { version: packageJsonVersion } = JSON.parse(yield fs.promises.readFile(path.join(pkg.outputPath, 'package.json'), 'utf8')); - if (version.compare(packageJsonVersion) !== 0) { + const mismatchesVersion = version.compare(packageJsonVersion) !== 0; + const mismatchesExperimental = experimentalVersion.compare(packageJsonVersion) !== 0; + if (mismatchesExperimental && mismatchesVersion) { error(red('The built package version does not match the version being released.')); - error(` Release Version: ${version.version}`); + error(` Release Version: ${version.version} (${experimentalVersion.version})`); error(` Generated Version: ${packageJsonVersion}`); throw new FatalReleaseActionError(); } diff --git a/dev-infra/release/publish/actions.ts b/dev-infra/release/publish/actions.ts index 437f0ccc79..e040ef4c2a 100644 --- a/dev-infra/release/publish/actions.ts +++ b/dev-infra/release/publish/actions.ts @@ -508,13 +508,20 @@ export abstract class ReleaseAction { /** Verify the version of each generated package exact matches the specified version. */ private async _verifyPackageVersions(version: semver.SemVer, packages: BuiltPackage[]) { + /** Experimental equivalent version for packages created with the provided version. */ + const experimentalVersion = + new semver.SemVer(`0.${version.major * 100 + version.minor}.${version.patch}`); for (const pkg of packages) { const {version: packageJsonVersion} = JSON.parse(await fs.readFile(join(pkg.outputPath, 'package.json'), 'utf8')) as {version: string, [key: string]: any}; - if (version.compare(packageJsonVersion) !== 0) { + + const mismatchesVersion = version.compare(packageJsonVersion) !== 0; + const mismatchesExperimental = experimentalVersion.compare(packageJsonVersion) !== 0; + + if (mismatchesExperimental && mismatchesVersion) { error(red('The built package version does not match the version being released.')); - error(` Release Version: ${version.version}`); + error(` Release Version: ${version.version} (${experimentalVersion.version})`); error(` Generated Version: ${packageJsonVersion}`); throw new FatalReleaseActionError(); }