Skip to content

Commit cce395a

Browse files
devversionAndrewKushnir
authored andcommitted
build: load ng-dev release package builder using CJS interop (#46454)
We need to switch the package builder to ESM or TS, like we did in the components repo, but for now until we can, the release script should work by loading the package builder CJS through the dynamic import expression. PR Close #46454
1 parent 2512f65 commit cce395a

2 files changed

Lines changed: 22 additions & 2 deletions

File tree

‎.ng-dev/release.mts‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,10 @@ export const release: ReleaseConfig = {
2626
buildPackages: async () => {
2727
// The buildTargetPackages function is loaded at runtime as the loading the script causes an
2828
// invocation of bazel.
29-
const {buildTargetPackages} = require(join(__dirname, '../scripts/build/package-builder'));
30-
return buildTargetPackages('dist/release-output', false, 'Release', /* isRelease */ true);
29+
const packageBuilder = await import('../scripts/build/package-builder.js');
30+
31+
return packageBuilder.default.buildTargetPackages(
32+
'dist/release-output', 'Release', /* isRelease */ true);
3133
},
3234
releaseNotes: {
3335
hiddenScopes: ['aio', 'bazel', 'dev-infra', 'docs-infra', 'zone.js', 'devtools'],

‎scripts/build/package-builder.d.ts‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/**
2+
* @license
3+
* Copyright Google LLC All Rights Reserved.
4+
*
5+
* Use of this source code is governed by an MIT-style license that can be
6+
* found in the LICENSE file at https://angular.io/license
7+
*/
8+
9+
/**
10+
* Build the Angular packages.
11+
*
12+
* @param {string} destDir Path to the output directory into which we copy the npm packages.
13+
* This path should either be absolute or relative to the project root.
14+
* @param {string} description Human-readable description of the build.
15+
* @param {boolean?} isRelease True, if the build should be stamped for a release.
16+
* @returns {Array<{name: string, outputPath: string}} A list of packages built.
17+
*/
18+
export declare function buildTargetPackages(destDir, description, isRelease: boolean): {name: string, outputPath: string}[];

0 commit comments

Comments
 (0)