summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOwen Jacobson <owen@grimoire.ca>2025-05-27 00:11:06 -0400
committerOwen Jacobson <owen@grimoire.ca>2025-06-11 12:31:00 -0400
commit0fe097759f175a8727ff9353bf9570acfe25765c (patch)
treebc8ff93911996678fa206e17fe86884932cadb9f
parenta6ae7ee0170e2235ffc9c4eacddae2fb6878ad07 (diff)
Create dedicated check scripts for lockfile accuracy.
There isn't a corresponding fix script for this as the lockfiles are rebuilt every time you run a command that resolves dependencies, in either `cargo` or `npm`. Furthermore, `cargo build` (and anything else that runs `build.rs`) will implicitly run `npm install` and update `package-lock.json` in the process.
-rwxr-xr-xgit-hooks/pre-commit5
-rwxr-xr-xtools/check-lockfiles11
2 files changed, 12 insertions, 4 deletions
diff --git a/git-hooks/pre-commit b/git-hooks/pre-commit
index ea34684..3ec2289 100755
--- a/git-hooks/pre-commit
+++ b/git-hooks/pre-commit
@@ -3,13 +3,10 @@
# Don't put anything here that routinely takes longer than a second or so to
# run. It gets old fast. That's why this doesn't run tests, for example.
+tools/check-lockfiles
tools/check-format
tools/check-lint
-# Make sure package-lock.json is up to date with package.json
-npm ci --dry-run
-# Make sure Cargo.lock is up to date with Cargo.toml.
-cargo update --locked --workspace
# Make sure the prepared statement data in .sqlx is up to date. Requires
# `cargo-sqlx` (`cargo install cargo-sqlx`).
export DATABASE_URL=sqlite://pilcrow.db.pre-commit?mode=rwc
diff --git a/tools/check-lockfiles b/tools/check-lockfiles
new file mode 100755
index 0000000..5e27fa7
--- /dev/null
+++ b/tools/check-lockfiles
@@ -0,0 +1,11 @@
+#!/bin/bash -e
+
+## tools/check-lockfiles
+##
+## Verifies that the various dependency lockfiles used in this project match
+## the dependencies configured.
+
+cd "$(dirname "$0")/.."
+
+npm ci --dry-run
+cargo update --locked --workspace