chore(deps): add lint:yarn-lock make target + pre-commit hook#517
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a local-side gate that catches the failure mode from PR #516 (Api deploy died at Docker
yarn install --immutablebecauseapps/package.jsonhad a new@opentelemetry/sdk-nodeconstraint that the developer's local — gitignored —apps/yarn.lockhadn't been re-resolved against).make lint:yarn-lockrunscd apps && yarn install --immutable. Mirrors whatapps/api/Dockerfilealready does, so a local pass means the Docker build will also pass.yarn-lock-syncpre-commit hook (gated onapps/package.json) calls the make target. Same shape as the existinglint-fix/full-test-matrixhooks: 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.lockis in.gitignore, so each developer maintains their own copy.sst deployreads from the working tree (no.dockerignoreexclusion). The failure isn't lockfile-in-commit drift; it's working-tree-lockfile-vs-working-tree-package.json drift — and that's exactly whatyarn install --immutabledetects.Test plan
make lint:yarn-lockpasses on this branch's working tree.lint-fix(passed) andyarn-lock-sync(correctly skipped — noapps/package.jsonchange in this PR).apps/package.jsonand confirm the hook rejects the commit.