Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ng-dev/release/publish/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ ts_project(
"//ng-dev:node_modules/@types/semver",
"//ng-dev:node_modules/@types/yargs",
"//ng-dev:node_modules/ejs",
"//ng-dev:node_modules/fast-glob",
"//ng-dev:node_modules/folder-hash",
"//ng-dev:node_modules/semver",
"//ng-dev:node_modules/typed-graphqlify",
Expand Down
24 changes: 22 additions & 2 deletions ng-dev/release/publish/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
* found in the LICENSE file at https://angular.io/license
*/

import {promises as fs} from 'fs';
import {existsSync, promises as fs} from 'fs';
import {join} from 'path';
import semver from 'semver';
import glob from 'fast-glob';

import {workspaceRelativePackageJsonPath} from '../../utils/constants.js';
import {AuthenticatedGitClient} from '../../utils/git/authenticated-git-client.js';
Expand Down Expand Up @@ -133,6 +134,21 @@ export abstract class ReleaseAction {
// to avoid unnecessary diff. IDEs usually add a trailing new line.
await fs.writeFile(pkgJsonPath, `${JSON.stringify(pkgJson, null, 2)}\n`);
Log.info(green(` ✓ Updated project version to ${pkgJson.version}`));

// TODO: remove when Angular version 19 is no longer in LTS.
if (existsSync(join(this.projectDir, '.aspect'))) {
await ExternalCommands.invokeBazelUpdateAspectLockFiles(this.projectDir);
}
}

/*
* Get the modified Aspect lock files if `rulesJsInteropMode` is enabled.
*/
protected getAspectLockFiles(): string[] {
// TODO: remove when Angular version 19 is no longer in LTS.
return existsSync(join(this.projectDir, '.aspect'))
? [...glob.sync('.aspect/**', {cwd: this.projectDir}), 'pnpm-lock.yaml']
: [];
}

/** Gets the most recent commit of a specified branch. */
Expand Down Expand Up @@ -202,7 +218,11 @@ export abstract class ReleaseAction {
}

// Commit message for the release point.
const filesToCommit = [workspaceRelativePackageJsonPath, workspaceRelativeChangelogPath];
const filesToCommit = [
workspaceRelativePackageJsonPath,
workspaceRelativeChangelogPath,
...this.getAspectLockFiles(),
];

const commitMessage = getCommitMessageForRelease(newVersion);

Expand Down
21 changes: 21 additions & 0 deletions ng-dev/release/publish/external-commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {ReleasePrecheckJsonStdin} from '../precheck/cli.js';
import {BuiltPackageWithInfo} from '../config/index.js';
import {green, Log} from '../../utils/logging.js';
import {PnpmVersioning} from './pnpm-versioning.js';
import {getBazelBin} from '../../utils/bazel-bin.js';

/*
* ###############################################################
Expand Down Expand Up @@ -288,4 +289,24 @@ export abstract class ExternalCommands {
});
}
}

/**
* Invokes the `yarn bazel sync --only=repo` command in order
* to refresh Aspect lock files.
*/
static async invokeBazelUpdateAspectLockFiles(projectDir: string): Promise<void> {
// TODO: remove when Angular version 19 is no longer in LTS.
const spinner = new Spinner('Updating Aspect lock files');
try {
await ChildProcess.spawn(getBazelBin(), ['sync', '--only=repo'], {
cwd: projectDir,
mode: 'silent',
});
} catch (e) {
// Note: Gracefully handling these errors because `sync` command
// exits with a non-zero exit code when pnpm-lock.yaml file is updated.
Log.debug(e);
}
spinner.success(green(' Updated Aspect `rules_js` lock files.'));
}
}
Loading