Skip to content

Commit 9f4e818

Browse files
clydindgp1130
authored andcommitted
build: add infrastructure to build local-variant package outputs to main build script
The main release build script now has the infrastructure needed to build using the `local` bazel configuration. This is not yet used within the build process but provides the base infrastructure to support local builds of the packages in the future. `local` builds are package builds that contain file path dependencies to the other built package archives in the workspace and are used for local development and testing purposes only.
1 parent c7b2085 commit 9f4e818

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

scripts/build-packages-dist.mts

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,24 +38,28 @@ const defaultDistPath = join(projectDir, 'dist/releases');
3838

3939
/** Builds the release packages for NPM. */
4040
export function performNpmReleaseBuild(): BuiltPackage[] {
41-
return buildReleasePackages(defaultDistPath, /* isSnapshotBuild */ false);
41+
return buildReleasePackages(defaultDistPath, /* config */ 'release');
4242
}
4343

4444
/**
4545
* Builds the release packages as snapshot build. This means that the current
4646
* Git HEAD SHA is included in the version (for easier debugging and back tracing).
4747
*/
4848
export function performDefaultSnapshotBuild(): BuiltPackage[] {
49-
return buildReleasePackages(defaultDistPath, /* isSnapshotBuild */ true);
49+
return buildReleasePackages(defaultDistPath, /* config */'snapshot');
50+
}
51+
52+
export function performLocalPackageBuild(): BuiltPackage[] {
53+
return buildReleasePackages(defaultDistPath, /* config */'local');
5054
}
5155

5256
/**
5357
* Builds the release packages with the given compile mode and copies
5458
* the package output into the given directory.
5559
*/
56-
function buildReleasePackages(distPath: string, isSnapshotBuild: boolean): BuiltPackage[] {
60+
function buildReleasePackages(distPath: string, config: 'release' | 'snapshot' | 'local'): BuiltPackage[] {
5761
console.log('######################################');
58-
console.log(' Building release packages...');
62+
console.log(` Building ${config} packages...`);
5963
console.log('######################################');
6064

6165
// List of targets to build. e.g. "packages/angular/cli:npm_package"
@@ -69,7 +73,10 @@ function buildReleasePackages(distPath: string, isSnapshotBuild: boolean): Built
6973
// Build with "--config=release" or `--config=snapshot` so that Bazel
7074
// runs the workspace stamping script. The stamping script ensures that the
7175
// version placeholder is populated in the release output.
72-
const stampConfigArg = `--config=${isSnapshotBuild ? 'snapshot' : 'release'}`;
76+
if (!['release', 'snapshot', 'local'].includes(config)) {
77+
throw new Error('Invalid config value: ' + config);
78+
}
79+
const stampConfigArg = `--config=${config}`;
7380

7481
// Walk through each release package and clear previous "npm_package" outputs. This is
7582
// a workaround for: https://github.com/bazelbuild/rules_nodejs/issues/1219. We need to

0 commit comments

Comments
 (0)