Skip to content

Commit 0ed9b00

Browse files
authored
Add lockfile-check (#18285)
* Add lockfile-check This check runs `npm install` which will rewrite the lockfile in case it is inconsistent with package.json. This check detects this and will fail the CI in such a case.
1 parent d7c2a29 commit 0ed9b00

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

Makefile

+12-1
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ fmt-check:
292292
checks: checks-frontend checks-backend
293293

294294
.PHONY: checks-frontend
295-
checks-frontend: svg-check
295+
checks-frontend: lockfile-check svg-check
296296

297297
.PHONY: checks-backend
298298
checks-backend: swagger-check swagger-validate
@@ -700,6 +700,17 @@ svg-check: svg
700700
exit 1; \
701701
fi
702702

703+
.PHONY: lockfile-check
704+
lockfile-check:
705+
npm install --package-lock-only
706+
@diff=$$(git diff package-lock.json); \
707+
if [ -n "$$diff" ]; then \
708+
echo "package-lock.json is inconsistent with package.json"; \
709+
echo "Please run 'npm install --package-lock-only' and commit the result:"; \
710+
echo "$${diff}"; \
711+
exit 1; \
712+
fi
713+
703714
.PHONY: update-translations
704715
update-translations:
705716
mkdir -p ./translations

package-lock.json

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"name": "gitea",
23
"license": "MIT",
34
"private": true,
45
"type": "module",

0 commit comments

Comments
 (0)