Skip to content
Closed
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
3 changes: 2 additions & 1 deletion ng-dev/misc/sync-module-bazel/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,11 @@ async function handler() {
if (originalBazelContent !== moduleBazelContent) {
writeFileSync(moduleBazelPath, moduleBazelContent);

await formatFiles(['MODULE.bazel']);
await formatFiles([moduleBazelPath]);

ChildProcess.spawnSync('pnpm', ['bazel', 'mod', 'deps', '--lockfile_mode=update'], {
suppressErrorOnFailingExitCode: true,
cwd: rootDir,
});
Comment on lines 70 to 73
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

This change aims to fix execution from nested directories by setting cwd. However, as rootDir is initialized to process.cwd() on line 25, this change is ineffective because spawnSync already defaults to using the current working directory.

To achieve the goal of this PR, rootDir must point to the repository's root directory. This would also make the change on line 68 (using moduleBazelPath) work as intended when running from a nested directory.

A full fix would involve changing how rootDir is initialized at the start of the handler function. For example:

// At line 25
const rootDir = determineRepoBaseDirFromCwd();

While this change is outside the current diff, it is essential for this PR's stated goal to be met.

}
}
Expand Down
Loading