chore: gitignore auto-generated mockServiceWorker.js#2708
Closed
chore: gitignore auto-generated mockServiceWorker.js#2708
Conversation
MSW postinstall auto-syncs public/mockServiceWorker.js via package.json "msw.workerDirectory", so the update-msw.yml workflow is redundant. Ignore the generated file and remove the workflow. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
pnpm hardlinks msw from its global store after the first build, so msw's postinstall doesn't re-run on subsequent installs — new clones hitting a warm store would not get public/mockServiceWorker.js. Run `msw init public --save` in the prepare script so every `pnpm install` regenerates the worker deterministically. Normalize workerDirectory to "public" to keep `--save` idempotent (passing "./public" triggers msw to append both forms). Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
postinstall runs on every install variant (including `pnpm add`), while prepare can skip under `--production` or single-package adds. postinstall also avoids a future conflict with tools that claim prepare (e.g., Husky). Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
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
package.jsonのmsw.workerDirectory設定を見てpublic/mockServiceWorker.jsを自動同期するため、update-msw.ymlワークフローは不要。.gitignoreに追加し、ワークフローを削除。背景
pnpm install時に MSW の postinstall が走り、worker スクリプトが MSW バージョンと自動同期される(pnpm.onlyBuiltDependenciesにmswを許可済み)。Renovate 更新時もこの仕組みで追従するので、CI でmsw init --save→ commit するワークフローは重複している。変更
.gitignore:/public/mockServiceWorker.jsを追加public/mockServiceWorker.js: 追跡から削除(生成物).github/workflows/update-msw.yml: 削除.claude/rules/ci.md: 該当行を削除Test plan
pnpm install後にpublic/mockServiceWorker.jsが自動生成されること(ローカル検証済み)pnpm devで MSW が従来どおり動作すること🤖 Generated with Claude Code