mirror of
https://github.com/willchen96/mike.git
synced 2026-07-24 23:41:04 +02:00
Merge pull request #240 from amal66/olp-pr/lockfile-merge-guard
ci: guard against silently merge-corrupted lockfiles
This commit is contained in:
commit
7460b065e5
2 changed files with 20 additions and 0 deletions
8
.gitattributes
vendored
Normal file
8
.gitattributes
vendored
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
# Lockfiles are generated files. Git's line-level text merge can combine
|
||||
# both sides' insertions into syntactically invalid JSON *without raising a
|
||||
# conflict* (this silently broke backend/package.json + package-lock.json in
|
||||
# PR #233). Merge them as binary so any concurrent change surfaces as an
|
||||
# explicit conflict; resolve by taking main's copy and regenerating:
|
||||
# git checkout origin/main -- package-lock.json && npm install
|
||||
package-lock.json merge=binary
|
||||
bun.lock merge=binary
|
||||
12
.github/workflows/ci.yml
vendored
12
.github/workflows/ci.yml
vendored
|
|
@ -32,6 +32,14 @@ jobs:
|
|||
cache: npm
|
||||
cache-dependency-path: backend/package-lock.json
|
||||
|
||||
# Git's line-level merge can splice both sides of package(-lock).json
|
||||
# into invalid JSON without a conflict (bit PR #233). npm's own error
|
||||
# for an unparseable lockfile is the misleading "npm ci can only
|
||||
# install with an existing package-lock.json" — fail fast with the real
|
||||
# reason instead.
|
||||
- name: Validate package.json and lockfile parse
|
||||
run: node -e "for (const f of ['package.json','package-lock.json']) JSON.parse(require('fs').readFileSync(f, 'utf8'))"
|
||||
|
||||
- run: npm ci
|
||||
|
||||
# No-ops on a tree without a "test" script (e.g. before the vitest
|
||||
|
|
@ -55,6 +63,10 @@ jobs:
|
|||
cache: npm
|
||||
cache-dependency-path: frontend/package-lock.json
|
||||
|
||||
# Same silent-merge-corruption guard as the backend job.
|
||||
- name: Validate package.json and lockfile parse
|
||||
run: node -e "for (const f of ['package.json','package-lock.json']) JSON.parse(require('fs').readFileSync(f, 'utf8'))"
|
||||
|
||||
- run: npm ci
|
||||
|
||||
# No-ops on a tree without a "test" script (e.g. before the vitest
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue