Skip to content

Commit 97bad00

Browse files
josephperrottmmalerba
authored andcommitted
build: lay foundation for migrating to ng-dev release tooling (#22167)
Configure the release tooling from ng-dev. (cherry picked from commit d66cb83)
1 parent 56851bf commit 97bad00

File tree

4 files changed

+34
-3
lines changed

4 files changed

+34
-3
lines changed

.ng-dev/config.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@ import {github} from './github';
33
import {merge} from './merge';
44
import {commitMessage} from './commit-message';
55
import {caretaker} from './caretaker';
6+
import {release} from './release';
67

78
module.exports = {
89
commitMessage,
910
format,
1011
github,
1112
merge,
1213
caretaker,
14+
release,
1315
};

.ng-dev/merge.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import {DevInfraMergeConfig} from '@angular/dev-infra-private/pr/merge/config';
22
import {getDefaultTargetLabelConfiguration} from '@angular/dev-infra-private/pr/merge/defaults';
33
import {github} from './github';
4+
import {release} from './release';
45

56
/**
67
* 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 => {
2223
mergeReadyLabel: 'merge ready',
2324
commitMessageFixupLabel: 'commit message fixup',
2425
caretakerNoteLabel: 'caretaker note',
25-
labels: await getDefaultTargetLabelConfiguration(api, github, '@angular/cdk'),
26+
labels: await getDefaultTargetLabelConfiguration(api, github, release),
2627
};
2728
};

.ng-dev/release.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import {join} from 'path';
2+
import {ReleaseConfig} from '@angular/dev-infra-private/release/config';
3+
import {releasePackages} from '../tools/release/release-output/release-packages';
4+
import {promptAndGenerateChangelog} from '../tools/release/changelog';
5+
6+
/** Configuration for the `ng-dev release` command. */
7+
export const release: ReleaseConfig = {
8+
publishRegistry: 'https://wombat-dressing-room.appspot.com',
9+
npmPackages: releasePackages.map(pkg => `@angular/${pkg}`),
10+
buildPackages: async () => {
11+
// The performNpmReleaseBuild function is loaded at runtime as the loading the script causes an
12+
// invocation of bazel.
13+
const {performNpmReleaseBuild} = require(join(__dirname, '../scripts/build-packages-dist'));
14+
return performNpmReleaseBuild();
15+
},
16+
// TODO: This can be removed once there is an org-wide tool for changelog generation.
17+
generateReleaseNotesForHead: async () => {
18+
await promptAndGenerateChangelog(join(__dirname, '../CHANGELOG.md'));
19+
},
20+
};

scripts/build-packages-dist.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,15 @@ if (module === require.main) {
4444

4545
/** Builds the release packages for NPM. */
4646
function performNpmReleaseBuild() {
47-
buildReleasePackages(false, defaultDistPath, /* isSnapshotBuild */ false);
47+
return buildReleasePackages(false, defaultDistPath, /* isSnapshotBuild */ false);
4848
}
4949

5050
/**
5151
* Builds the release packages as snapshot build. This means that the current
5252
* Git HEAD SHA is included in the version (for easier debugging and back tracing).
5353
*/
5454
function performDefaultSnapshotBuild() {
55-
buildReleasePackages(false, defaultDistPath, /* isSnapshotBuild */ true);
55+
return buildReleasePackages(false, defaultDistPath, /* isSnapshotBuild */ true);
5656
}
5757

5858
/**
@@ -103,6 +103,14 @@ function buildReleasePackages(useIvy, distPath, isSnapshotBuild) {
103103
cp('-R', outputPath, targetFolder);
104104
chmod('-R', 'u+w', targetFolder);
105105
});
106+
107+
return packageNames.map(pkg => {
108+
const outputPath = getOutputPath(pkg);
109+
return {
110+
name: `@angular/${pkg}`,
111+
outputPath
112+
}
113+
})
106114
}
107115

108116
/**

0 commit comments

Comments
 (0)