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.
This commit is contained in:
silverwind 2022-01-15 12:06:29 -08:00 committed by GitHub
parent d7c2a2951c
commit 0ed9b006e8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 1 deletions

View file

@ -292,7 +292,7 @@ fmt-check:
checks: checks-frontend checks-backend checks: checks-frontend checks-backend
.PHONY: checks-frontend .PHONY: checks-frontend
checks-frontend: svg-check checks-frontend: lockfile-check svg-check
.PHONY: checks-backend .PHONY: checks-backend
checks-backend: swagger-check swagger-validate checks-backend: swagger-check swagger-validate
@ -700,6 +700,17 @@ svg-check: svg
exit 1; \ exit 1; \
fi 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 .PHONY: update-translations
update-translations: update-translations:
mkdir -p ./translations mkdir -p ./translations

1
package-lock.json generated
View file

@ -4,6 +4,7 @@
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "gitea",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@claviska/jquery-minicolors": "2.3.6", "@claviska/jquery-minicolors": "2.3.6",

View file

@ -1,4 +1,5 @@
{ {
"name": "gitea",
"license": "MIT", "license": "MIT",
"private": true, "private": true,
"type": "module", "type": "module",