Skip to content

Commit 5e1c95e

Browse files
committed
update Makefile
1 parent 64d5c55 commit 5e1c95e

File tree

2 files changed

+72
-4
lines changed

2 files changed

+72
-4
lines changed

Makefile

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ clean:
99

1010
.PHONY: deps
1111
deps:
12-
npm i
12+
npm install
1313

1414
.PHONY: build
1515
build: clean deps
@@ -28,14 +28,22 @@ prettier-check: deps
2828
npx prettier --config .prettierrc 'src/**/*.ts' --check
2929

3030
.PHONY: ci-check
31-
ci-check: build prettier
31+
ci-check: deps build prettier
3232
@echo "Checking for uncommitted changes..."
3333
@if ! git diff --quiet --exit-code; then \
34-
echo "❌ Error: Files were modified by 'make build' or 'make prettier'"; \
34+
echo "❌ Error: Files were modified by 'npm install', build, or prettier"; \
3535
echo "Modified files:"; \
3636
git diff --name-only; \
3737
echo ""; \
38-
echo "Please run 'make build' and 'make prettier' locally and commit the changes."; \
38+
if git diff --quiet package-lock.json 2>/dev/null; then \
39+
echo "Please run 'make build' and 'make prettier' locally and commit the changes."; \
40+
else \
41+
echo "package-lock.json was modified. This means it's out of sync with package.json"; \
42+
echo "Please run 'npm install' locally and commit the updated package-lock.json"; \
43+
echo ""; \
44+
echo "Differences in package-lock.json:"; \
45+
git diff package-lock.json | head -100; \
46+
fi; \
3947
exit 1; \
4048
fi
4149
@echo "✅ No uncommitted changes detected"

scripts/verify-ci-match.sh

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
#!/bin/bash
2+
# Script to verify local environment matches CI exactly
3+
4+
set -e
5+
6+
echo "=== Verifying local matches CI ==="
7+
echo ""
8+
9+
# Check npm and node versions
10+
echo "1. Checking versions..."
11+
NPM_VERSION=$(npm --version)
12+
NODE_VERSION=$(node --version)
13+
echo " npm: $NPM_VERSION"
14+
echo " node: $NODE_VERSION"
15+
echo ""
16+
17+
# Clean state
18+
echo "2. Cleaning node_modules and dist..."
19+
rm -rf node_modules dist coverage
20+
21+
# Install exactly as CI does (npm install, not npm ci)
22+
echo "3. Installing with 'npm install' (as CI does)..."
23+
npm install
24+
25+
# Check if package-lock.json was modified
26+
if ! git diff --quiet --exit-code package-lock.json; then
27+
echo "❌ package-lock.json was modified by npm install!"
28+
echo " This means it's out of sync with package.json"
29+
echo " Differences:"
30+
git diff package-lock.json | head -50
31+
echo ""
32+
echo " To fix:"
33+
echo " 1. Review the changes above"
34+
echo " 2. Commit the updated package-lock.json"
35+
exit 1
36+
fi
37+
echo "✅ package-lock.json is up to date"
38+
echo ""
39+
40+
# Build and check for changes
41+
echo "5. Building..."
42+
npm run build
43+
44+
echo "6. Running prettier..."
45+
npm run prettier
46+
47+
echo "7. Checking for uncommitted changes..."
48+
if ! git diff --quiet --exit-code; then
49+
echo "❌ Files were modified:"
50+
git diff --name-only
51+
echo ""
52+
echo " Differences:"
53+
git diff | head -100
54+
exit 1
55+
fi
56+
57+
echo "✅ Everything matches CI!"
58+
echo ""
59+
echo "Your local environment matches what CI will produce."
60+

0 commit comments

Comments
 (0)