Skip to content

chore(deps): add lint:yarn-lock make target + pre-commit hook#517

Merged
DorianZheng merged 1 commit into
mainfrom
chore/yarn-lock-sync-hook
May 14, 2026
Merged

chore(deps): add lint:yarn-lock make target + pre-commit hook#517
DorianZheng merged 1 commit into
mainfrom
chore/yarn-lock-sync-hook

Conversation

@DorianZheng

Copy link
Copy Markdown
Member

Summary

Adds a local-side gate that catches the failure mode from PR #516 (Api deploy died at Docker yarn install --immutable because apps/package.json had a new @opentelemetry/sdk-node constraint that the developer's local — gitignored — apps/yarn.lock hadn't been re-resolved against).

  • make lint:yarn-lock runs cd apps && yarn install --immutable. Mirrors what apps/api/Dockerfile already does, so a local pass means the Docker build will also pass.
  • yarn-lock-sync pre-commit hook (gated on apps/package.json) calls the make target. Same shape as the existing lint-fix / full-test-matrix hooks: thin prek wrapper around a make entry.

Catches the symptom at commit time instead of at deploy time.

Why a gate even though yarn.lock isn't tracked

apps/yarn.lock is in .gitignore, so each developer maintains their own copy. sst deploy reads from the working tree (no .dockerignore exclusion). The failure isn't lockfile-in-commit drift; it's working-tree-lockfile-vs-working-tree-package.json drift — and that's exactly what yarn install --immutable detects.

Test plan

  • make lint:yarn-lock passes on this branch's working tree.
  • Local commit on this branch triggered lint-fix (passed) and yarn-lock-sync (correctly skipped — no apps/package.json change in this PR).
  • Verify by inducing drift in a follow-up: stage a no-op edit to apps/package.json and confirm the hook rejects the commit.

apps/yarn.lock is gitignored, so `sst deploy` Docker-COPYs the developer's
local working-tree lockfile into the image. When apps/package.json changes
without a paired local `yarn install`, the Docker build's
`yarn install --immutable` fails with YN0028 — only surfaced at deploy
time (cost: rebuild a container layer to discover a 1-line lockfile drift).

This adds a local-side gate:

- `make lint:yarn-lock` runs `yarn install --immutable` in apps/. Mirrors
  exactly what apps/api/Dockerfile does, so a local pass means the Docker
  yarn install will also pass.
- A `yarn-lock-sync` pre-commit hook (gated on apps/package.json) calls
  the target so the commit fails locally when the working-tree lockfile
  doesn't match the new package.json.

Same shape as the existing `lint-fix` and `full-test-matrix` hooks: thin
prek wrapper around a make target.

Catches the symptom at commit time instead of at deploy time. Motivated
by an Api deploy failure traced back to PR #516 modifying package.json
without refreshing the developer's local yarn.lock.
@DorianZheng DorianZheng merged commit 2b60703 into main May 14, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant