Create `bazel mod deps` hook
In rules_labgrid
, we currently have a section in our pre-commit
hook that keeps MODULE.bazel.lock
files up-to-date:
printf >&2 'Updating lockfiles\n'
for ROOT in . e2e; do
(
cd "${ROOT}"
if ! bazelisk mod deps --lockfile_mode=error &>/dev/null; then
bazelisk mod deps --lockfile_mode=update
exit 1
fi
)
done
Rather than hardcoding .
and e2e
, it probably makes sense to use the parent directories of all MODULE.bazel.lock
files that aren't ignored by Git.