From af6a70daa3e5b5824dbede6636f8e5ca8ec7d282 Mon Sep 17 00:00:00 2001 From: silverwind Date: Sat, 15 Jan 2022 16:55:04 +0100 Subject: [PATCH 1/4] 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. --- Makefile | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index ca273fd50735e..e9421498f50a3 100644 --- a/Makefile +++ b/Makefile @@ -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 @@ -700,6 +700,17 @@ svg-check: svg exit 1; \ fi +.PHONY: lockfile-check +lockfile-check: + npm install + @diff=$$(git diff package-lock.json); \ + if [ -n "$$diff" ]; then \ + echo "package-lock.json is inconsistent with package.json"; \ + echo "Please run 'npm install' and commit the result:"; \ + echo "$${diff}"; \ + exit 1; \ + fi + .PHONY: update-translations update-translations: mkdir -p ./translations From 727e2dcab16d52dac35c97d130afca30522d30bb Mon Sep 17 00:00:00 2001 From: silverwind Date: Sat, 15 Jan 2022 17:06:21 +0100 Subject: [PATCH 2/4] add --package-lock-only --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index e9421498f50a3..2eceac43be49d 100644 --- a/Makefile +++ b/Makefile @@ -702,7 +702,7 @@ svg-check: svg .PHONY: lockfile-check lockfile-check: - npm install + npm install --package-lock-only @diff=$$(git diff package-lock.json); \ if [ -n "$$diff" ]; then \ echo "package-lock.json is inconsistent with package.json"; \ From 6f5e724036c425c746dad497e3a3608b7cedb8fa Mon Sep 17 00:00:00 2001 From: silverwind Date: Sat, 15 Jan 2022 17:07:44 +0100 Subject: [PATCH 3/4] add name field to prevent automatic name --- package-lock.json | 1 + package.json | 1 + 2 files changed, 2 insertions(+) diff --git a/package-lock.json b/package-lock.json index 845be7179c428..3d62eb1ab2b72 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4,6 +4,7 @@ "requires": true, "packages": { "": { + "name": "gitea", "license": "MIT", "dependencies": { "@claviska/jquery-minicolors": "2.3.6", diff --git a/package.json b/package.json index 2f8ac8df538c1..86e8b9aedd415 100644 --- a/package.json +++ b/package.json @@ -1,4 +1,5 @@ { + "name": "gitea", "license": "MIT", "private": true, "type": "module", From 18eac96bdfc04d1581f209b4a8ded081779ee177 Mon Sep 17 00:00:00 2001 From: silverwind Date: Sat, 15 Jan 2022 10:26:39 -0800 Subject: [PATCH 4/4] Also suggest --package-lock-only --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 2eceac43be49d..cb4304b812faf 100644 --- a/Makefile +++ b/Makefile @@ -706,7 +706,7 @@ lockfile-check: @diff=$$(git diff package-lock.json); \ if [ -n "$$diff" ]; then \ echo "package-lock.json is inconsistent with package.json"; \ - echo "Please run 'npm install' and commit the result:"; \ + echo "Please run 'npm install --package-lock-only' and commit the result:"; \ echo "$${diff}"; \ exit 1; \ fi