@@ -39,20 +39,34 @@ For a more robust developer experience, see the [sample shell script](https://gi
3939For developers to be able to run a CLI tool without needing manual installation:
4040
41411 . Add the tool to ` tools/tools.lock.json `
42- 2 . ` cd tools; ln -s _multitool_run_under_cwd .sh name_of_tool `
42+ 2 . ` cd tools; ln -s _run_under_cwd .sh name_of_tool `
43433 . Instruct developers to run ` ./tools/name_of_tool ` rather than install that tool on their machine.
4444
45+ To update the versions of installed tools, run:
46+
47+ ``` shell
48+ % cd $( bazel info workspace) /tools; ./multitool --lockfile tools.lock.json update
49+ ```
50+
4551See https://blog.aspect.build/run-tools-installed-by-bazel for details.
4652
4753## Working with npm packages
4854
49- To install a ` node_modules ` tree locally for the editor or other tooling outside of Bazel:
55+ To install a ` node_modules ` tree locally for the editor or other tooling outside of Bazel,
56+ run this command from any folder with a ` package.json ` file:
5057
58+ ``` shell
59+ % $( bazel info workspace) /tools/pnpm install
5160```
52- bazel run -- @pnpm --dir $PWD install
61+
62+ > NB: ` bazel info workspace ` avoids having a bunch of ` ../ ` segments when running tools from a subdirectory.
63+
64+ Similarly, you can run other ` pnpm ` commands to add or remove packages.
65+
66+ ``` shell
67+ % $( bazel info workspace) /tools/pnpm add http-server
5368```
5469
55- Similarly, you can run other ` pnpm ` commands to install or remove packages.
5670This ensures you use the same pnpm version as other developers, and the lockfile format will stay constant.
5771
5872## Working with Python packages
@@ -88,11 +102,12 @@ Then edit the new entry in `tools/BUILD` to replace `package_name_snake_case` wi
88102
89103After adding a new ` import ` statement in Go code, run ` bazel configure ` to update the BUILD file.
90104
91- If the package is not already a dependency of the project, you'll have to do some additional steps:
105+ If the package is not already a dependency of the project, you'll have to do some additional steps.
106+ Run these commands from the workspace root:
92107
93108``` shell
94109# Update go.mod and go.sum, using same Go SDK as Bazel
95- % bazel run @rules_go/ /go -- mod tidy -v
110+ % $( bazel info workspace ) /tools /go mod tidy -v
96111# Update MODULE.bazel to include the package in `use_repo`
97112% bazel mod tidy
98113# Repeat
0 commit comments