mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-09-03 17:07:15 +00:00
fix(frontend): keep the MSW worker in step with the lockfile (#6222)
The tracked frontend/public/mockServiceWorker.js is generated by msw and pinned at 2.14.7, while package-lock.json installs 2.15.0. msw rewrites the worker on postinstall, so npm ci leaves the tree dirty on a clean checkout and every contributor either commits an unrelated 30-line diff or discards it. Regenerate the worker for the locked version and add a check that compares it against the installed runtime, wired into make verify and CI so the pair cannot drift again.
This commit is contained in:
@@ -182,6 +182,9 @@ jobs:
|
|||||||
- name: Install
|
- name: Install
|
||||||
run: npm ci
|
run: npm ci
|
||||||
working-directory: frontend
|
working-directory: frontend
|
||||||
|
- name: Verify generated MSW worker is current
|
||||||
|
run: git diff --exit-code -- public/mockServiceWorker.js package-lock.json
|
||||||
|
working-directory: frontend
|
||||||
- name: Lint
|
- name: Lint
|
||||||
run: npm run lint
|
run: npm run lint
|
||||||
working-directory: frontend
|
working-directory: frontend
|
||||||
|
|||||||
@@ -41,6 +41,10 @@ lint: lint-go lint-fe ## All linters
|
|||||||
typecheck: ## tsc --noEmit
|
typecheck: ## tsc --noEmit
|
||||||
cd $(FRONTEND) && npm run typecheck
|
cd $(FRONTEND) && npm run typecheck
|
||||||
|
|
||||||
|
.PHONY: msw-worker-check
|
||||||
|
msw-worker-check: ## Verify the tracked worker matches the installed MSW runtime
|
||||||
|
cmp $(FRONTEND)/public/mockServiceWorker.js $(FRONTEND)/node_modules/msw/lib/mockServiceWorker.js
|
||||||
|
|
||||||
.PHONY: test-go
|
.PHONY: test-go
|
||||||
test-go: dist-stub ## Go tests (shuffle, no cache)
|
test-go: dist-stub ## Go tests (shuffle, no cache)
|
||||||
go test -shuffle=on -count=1 $(GO_PKGS)
|
go test -shuffle=on -count=1 $(GO_PKGS)
|
||||||
@@ -75,5 +79,5 @@ build-storybook: ## Build the static Storybook (compile-checks all stories)
|
|||||||
# The PR gate. Matches ci.yml: codegen freshness, both linters, typecheck,
|
# The PR gate. Matches ci.yml: codegen freshness, both linters, typecheck,
|
||||||
# both test suites, a full build, and the Storybook compile-check.
|
# both test suites, a full build, and the Storybook compile-check.
|
||||||
.PHONY: verify
|
.PHONY: verify
|
||||||
verify: gen-check lint typecheck test build build-storybook ## Full local gate (mirrors CI)
|
verify: gen-check lint typecheck msw-worker-check test build build-storybook ## Full local gate (mirrors CI)
|
||||||
@echo "verify: OK"
|
@echo "verify: OK"
|
||||||
|
|||||||
Reference in New Issue
Block a user