From 97bad007fafd955950507e851f37acf475be155c Mon Sep 17 00:00:00 2001 From: Joey Perrott Date: Mon, 15 Mar 2021 10:59:06 -0700 Subject: [PATCH] build: lay foundation for migrating to ng-dev release tooling (#22167) Configure the release tooling from ng-dev. (cherry picked from commit d66cb83f7af069e066ad3a046fe720df1f1ac420) --- .ng-dev/config.ts | 2 ++ .ng-dev/merge.ts | 3 ++- .ng-dev/release.ts | 20 ++++++++++++++++++++ scripts/build-packages-dist.js | 12 ++++++++++-- 4 files changed, 34 insertions(+), 3 deletions(-) create mode 100644 .ng-dev/release.ts diff --git a/.ng-dev/config.ts b/.ng-dev/config.ts index d8e23b5e1ce9..b9adee5c7b47 100644 --- a/.ng-dev/config.ts +++ b/.ng-dev/config.ts @@ -3,6 +3,7 @@ import {github} from './github'; import {merge} from './merge'; import {commitMessage} from './commit-message'; import {caretaker} from './caretaker'; +import {release} from './release'; module.exports = { commitMessage, @@ -10,4 +11,5 @@ module.exports = { github, merge, caretaker, + release, }; diff --git a/.ng-dev/merge.ts b/.ng-dev/merge.ts index 9986012dc9c4..82d1a8388073 100644 --- a/.ng-dev/merge.ts +++ b/.ng-dev/merge.ts @@ -1,6 +1,7 @@ import {DevInfraMergeConfig} from '@angular/dev-infra-private/pr/merge/config'; import {getDefaultTargetLabelConfiguration} from '@angular/dev-infra-private/pr/merge/defaults'; import {github} from './github'; +import {release} from './release'; /** * Configuration for the merge tool in `ng-dev`. This sets up the labels which @@ -22,6 +23,6 @@ export const merge: DevInfraMergeConfig['merge'] = async api => { mergeReadyLabel: 'merge ready', commitMessageFixupLabel: 'commit message fixup', caretakerNoteLabel: 'caretaker note', - labels: await getDefaultTargetLabelConfiguration(api, github, '@angular/cdk'), + labels: await getDefaultTargetLabelConfiguration(api, github, release), }; }; diff --git a/.ng-dev/release.ts b/.ng-dev/release.ts new file mode 100644 index 000000000000..2cfef84dbdb7 --- /dev/null +++ b/.ng-dev/release.ts @@ -0,0 +1,20 @@ +import {join} from 'path'; +import {ReleaseConfig} from '@angular/dev-infra-private/release/config'; +import {releasePackages} from '../tools/release/release-output/release-packages'; +import {promptAndGenerateChangelog} from '../tools/release/changelog'; + +/** Configuration for the `ng-dev release` command. */ +export const release: ReleaseConfig = { + publishRegistry: 'https://wombat-dressing-room.appspot.com', + npmPackages: releasePackages.map(pkg => `@angular/${pkg}`), + buildPackages: async () => { + // The performNpmReleaseBuild function is loaded at runtime as the loading the script causes an + // invocation of bazel. + const {performNpmReleaseBuild} = require(join(__dirname, '../scripts/build-packages-dist')); + return performNpmReleaseBuild(); + }, + // TODO: This can be removed once there is an org-wide tool for changelog generation. + generateReleaseNotesForHead: async () => { + await promptAndGenerateChangelog(join(__dirname, '../CHANGELOG.md')); + }, +}; diff --git a/scripts/build-packages-dist.js b/scripts/build-packages-dist.js index 47feade58d6a..46f4f85f37b8 100755 --- a/scripts/build-packages-dist.js +++ b/scripts/build-packages-dist.js @@ -44,7 +44,7 @@ if (module === require.main) { /** Builds the release packages for NPM. */ function performNpmReleaseBuild() { - buildReleasePackages(false, defaultDistPath, /* isSnapshotBuild */ false); + return buildReleasePackages(false, defaultDistPath, /* isSnapshotBuild */ false); } /** @@ -52,7 +52,7 @@ function performNpmReleaseBuild() { * Git HEAD SHA is included in the version (for easier debugging and back tracing). */ function performDefaultSnapshotBuild() { - buildReleasePackages(false, defaultDistPath, /* isSnapshotBuild */ true); + return buildReleasePackages(false, defaultDistPath, /* isSnapshotBuild */ true); } /** @@ -103,6 +103,14 @@ function buildReleasePackages(useIvy, distPath, isSnapshotBuild) { cp('-R', outputPath, targetFolder); chmod('-R', 'u+w', targetFolder); }); + + return packageNames.map(pkg => { + const outputPath = getOutputPath(pkg); + return { + name: `@angular/${pkg}`, + outputPath + } + }) } /**