Skip to content

Commit

Permalink
Add lockfile-check (#18285)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
silverwind authored Jan 15, 2022
1 parent d7c2a29 commit 0ed9b00
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
13 changes: 12 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ fmt-check:
checks: checks-frontend checks-backend

.PHONY: checks-frontend
checks-frontend: svg-check
checks-frontend: lockfile-check svg-check

.PHONY: checks-backend
checks-backend: swagger-check swagger-validate
Expand Down Expand Up @@ -700,6 +700,17 @@ svg-check: svg
exit 1; \
fi

.PHONY: lockfile-check
lockfile-check:
npm install --package-lock-only
@diff=$$(git diff package-lock.json); \
if [ -n "$$diff" ]; then \
echo "package-lock.json is inconsistent with package.json"; \
echo "Please run 'npm install --package-lock-only' and commit the result:"; \
echo "$${diff}"; \
exit 1; \
fi

.PHONY: update-translations
update-translations:
mkdir -p ./translations
Expand Down
1 change: 1 addition & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"name": "gitea",
"license": "MIT",
"private": true,
"type": "module",
Expand Down

0 comments on commit 0ed9b00

Please sign in to comment.