diff --git a/ng-dev/release/publish/external-commands.ts b/ng-dev/release/publish/external-commands.ts index 7a6c764ac..b977867b4 100644 --- a/ng-dev/release/publish/external-commands.ts +++ b/ng-dev/release/publish/external-commands.ts @@ -19,6 +19,7 @@ import {ReleaseInfoJsonStdout} from '../info/cli.js'; import {ReleasePrecheckJsonStdin} from '../precheck/cli.js'; import {BuiltPackageWithInfo} from '../config/index.js'; import {green, Log} from '../../utils/logging.js'; +import {getBazelBin} from '../../utils/bazel-bin.js'; /* * ############################################################### @@ -262,19 +263,10 @@ export abstract class ExternalCommands { * to refresh Aspect lock files. */ static async invokeBazelUpdateAspectLockFiles(projectDir: string): Promise { - // Note: We cannot use `yarn` directly as command because we might operate in - // a different publish branch and the current `PATH` will point to the Yarn version - // that invoked the release tool. More details in the function description. - const yarnCommand = await resolveYarnScriptForProject(projectDir); - try { // Note: No progress indicator needed as that is the responsibility of the command. // TODO: Consider using an Ora spinner instead to ensure minimal console output. - await ChildProcess.spawn( - yarnCommand.binary, - [...yarnCommand.args, 'bazelisk', 'run', '@npm2//:sync'], - {cwd: projectDir}, - ); + await ChildProcess.spawn(getBazelBin(), ['run', '@npm2//:sync'], {cwd: projectDir}); } catch (e) { // Note: Gracefully handling these errors because `sync` command // alway exits with a non-zero exit code.