Skip to content

Commit a65bff4

Browse files
author
junoberryferry
committed
Merge remote-tracking branch 'upstream/main' into jsonv2
2 parents 34af20c + 593a52c commit a65bff4

File tree

177 files changed

+4863
-4992
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

177 files changed

+4863
-4992
lines changed

.eslintrc.cjs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -831,7 +831,6 @@ module.exports = {
831831
'sonarjs/no-inverted-boolean-check': [2],
832832
'sonarjs/no-nested-switch': [0],
833833
'sonarjs/no-nested-template-literals': [0],
834-
'sonarjs/no-one-iteration-loop': [2],
835834
'sonarjs/no-redundant-boolean': [2],
836835
'sonarjs/no-redundant-jump': [2],
837836
'sonarjs/no-same-line-conditional': [2],

.github/workflows/pull-compliance.yml

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,9 @@ jobs:
3535
- uses: astral-sh/setup-uv@v6
3636
- run: uv python install 3.12
3737
- uses: pnpm/action-setup@v4
38-
- uses: actions/setup-node@v4
38+
- uses: actions/setup-node@v5
3939
with:
4040
node-version: 24
41-
cache: pnpm
42-
cache-dependency-path: pnpm-lock.yaml
4341
- run: make deps-py
4442
- run: make deps-frontend
4543
- run: make lint-templates
@@ -62,11 +60,9 @@ jobs:
6260
steps:
6361
- uses: actions/checkout@v4
6462
- uses: pnpm/action-setup@v4
65-
- uses: actions/setup-node@v4
63+
- uses: actions/setup-node@v5
6664
with:
6765
node-version: 24
68-
cache: pnpm
69-
cache-dependency-path: pnpm-lock.yaml
7066
- run: make deps-frontend
7167
- run: make lint-swagger
7268

@@ -134,11 +130,9 @@ jobs:
134130
steps:
135131
- uses: actions/checkout@v4
136132
- uses: pnpm/action-setup@v4
137-
- uses: actions/setup-node@v4
133+
- uses: actions/setup-node@v5
138134
with:
139135
node-version: 24
140-
cache: pnpm
141-
cache-dependency-path: pnpm-lock.yaml
142136
- run: make deps-frontend
143137
- run: make lint-frontend
144138
- run: make checks-frontend
@@ -184,11 +178,9 @@ jobs:
184178
steps:
185179
- uses: actions/checkout@v4
186180
- uses: pnpm/action-setup@v4
187-
- uses: actions/setup-node@v4
181+
- uses: actions/setup-node@v5
188182
with:
189183
node-version: 24
190-
cache: pnpm
191-
cache-dependency-path: pnpm-lock.yaml
192184
- run: make deps-frontend
193185
- run: make lint-md
194186

.github/workflows/pull-e2e-tests.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,9 @@ jobs:
2424
go-version-file: go.mod
2525
check-latest: true
2626
- uses: pnpm/action-setup@v4
27-
- uses: actions/setup-node@v4
27+
- uses: actions/setup-node@v5
2828
with:
2929
node-version: 24
30-
cache: pnpm
31-
cache-dependency-path: pnpm-lock.yaml
3230
- run: make deps-frontend frontend deps-backend
3331
- run: pnpm exec playwright install --with-deps
3432
- run: make test-e2e-sqlite

.github/workflows/release-nightly.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,9 @@ jobs:
2121
go-version-file: go.mod
2222
check-latest: true
2323
- uses: pnpm/action-setup@v4
24-
- uses: actions/setup-node@v4
24+
- uses: actions/setup-node@v5
2525
with:
2626
node-version: 24
27-
cache: pnpm
28-
cache-dependency-path: pnpm-lock.yaml
2927
- run: make deps-frontend deps-backend
3028
# xgo build
3129
- run: make release

.github/workflows/release-tag-rc.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,9 @@ jobs:
2222
go-version-file: go.mod
2323
check-latest: true
2424
- uses: pnpm/action-setup@v4
25-
- uses: actions/setup-node@v4
25+
- uses: actions/setup-node@v5
2626
with:
2727
node-version: 24
28-
cache: pnpm
29-
cache-dependency-path: pnpm-lock.yaml
3028
- run: make deps-frontend deps-backend
3129
# xgo build
3230
- run: make release

.github/workflows/release-tag-version.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,9 @@ jobs:
2626
go-version-file: go.mod
2727
check-latest: true
2828
- uses: pnpm/action-setup@v4
29-
- uses: actions/setup-node@v4
29+
- uses: actions/setup-node@v5
3030
with:
3131
node-version: 24
32-
cache: pnpm
33-
cache-dependency-path: pnpm-lock.yaml
3432
- run: make deps-frontend deps-backend
3533
# xgo build
3634
- run: make release

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,11 @@ cpu.out
7474
/tests/*.ini
7575
/tests/**/*.git/**/*.sample
7676
/node_modules
77-
/tools/node_modules
7877
/.venv
7978
/yarn.lock
8079
/yarn-error.log
8180
/npm-debug.log*
81+
/.pnpm-store
8282
/public/assets/js
8383
/public/assets/css
8484
/public/assets/fonts

MAINTAINERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,4 @@ hiifong <[email protected]> (@hiifong)
6363
metiftikci <[email protected]> (@metiftikci)
6464
Christopher Homberger <[email protected]> (@ChristopherHX)
6565
Tobias Balle-Petersen <[email protected]> (@tobiasbp)
66+
TheFox <[email protected]> (@TheFox0x7)

Makefile

Lines changed: 37 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ XGO_VERSION := go-1.25.x
3131

3232
AIR_PACKAGE ?= github.com/air-verse/air@v1
3333
EDITORCONFIG_CHECKER_PACKAGE ?= github.com/editorconfig-checker/editorconfig-checker/v3/cmd/editorconfig-checker@v3
34-
GOFUMPT_PACKAGE ?= mvdan.cc/gofumpt@v0.8.0
34+
GOFUMPT_PACKAGE ?= mvdan.cc/gofumpt@v0.9.1
3535
GOLANGCI_LINT_PACKAGE ?= github.com/golangci/golangci-lint/v2/cmd/[email protected]
3636
GXZ_PACKAGE ?= github.com/ulikunitz/xz/cmd/[email protected]
3737
MISSPELL_PACKAGE ?= github.com/golangci/misspell/cmd/[email protected]
@@ -100,6 +100,15 @@ STORED_VERSION_FILE := VERSION
100100
GITHUB_REF_TYPE ?= branch
101101
GITHUB_REF_NAME ?= $(shell git rev-parse --abbrev-ref HEAD)
102102

103+
# Enable typescript support in Node.js before 22.18
104+
# TODO: Remove this once we can raise the minimum Node.js version to 22.18 (alpine >= 3.23)
105+
NODE_VERSION := $(shell printf "%03d%03d%03d" $(shell node -v 2>/dev/null | cut -c2- | tr '.' ' '))
106+
ifeq ($(shell test "$(NODE_VERSION)" -lt "022018000"; echo $$?),0)
107+
NODE_VARS := NODE_OPTIONS="--experimental-strip-types"
108+
else
109+
NODE_VARS :=
110+
endif
111+
103112
ifneq ($(GITHUB_REF_TYPE),branch)
104113
VERSION ?= $(subst v,,$(GITHUB_REF_NAME))
105114
GITEA_VERSION ?= $(VERSION)
@@ -131,7 +140,7 @@ GO_TEST_PACKAGES ?= $(filter-out $(shell $(GO) list code.gitea.io/gitea/models/m
131140
MIGRATE_TEST_PACKAGES ?= $(shell $(GO) list code.gitea.io/gitea/models/migrations/...)
132141

133142
WEBPACK_SOURCES := $(shell find web_src/js web_src/css -type f)
134-
WEBPACK_CONFIGS := webpack.config.js tailwind.config.js
143+
WEBPACK_CONFIGS := webpack.config.ts tailwind.config.ts
135144
WEBPACK_DEST := public/assets/js/index.js public/assets/css/index.css
136145
WEBPACK_DEST_ENTRIES := public/assets/js public/assets/css public/assets/fonts
137146

@@ -157,9 +166,9 @@ TAR_EXCLUDES := .git data indexers queues log node_modules $(EXECUTABLE) $(DIST)
157166
GO_DIRS := build cmd models modules routers services tests
158167
WEB_DIRS := web_src/js web_src/css
159168

160-
ESLINT_FILES := web_src/js tools *.js *.ts *.cjs tests/e2e
169+
ESLINT_FILES := web_src/js tools *.ts *.cjs tests/e2e
161170
STYLELINT_FILES := web_src/css web_src/js/components/*.vue
162-
SPELLCHECK_FILES := $(GO_DIRS) $(WEB_DIRS) templates options/locale/locale_en-US.ini .github $(filter-out CHANGELOG.md, $(wildcard *.go *.js *.md *.yml *.yaml *.toml)) $(filter-out tools/misspellings.csv, $(wildcard tools/*))
171+
SPELLCHECK_FILES := $(GO_DIRS) $(WEB_DIRS) templates options/locale/locale_en-US.ini .github $(filter-out CHANGELOG.md, $(wildcard *.go *.md *.yml *.yaml *.toml)) $(filter-out tools/misspellings.csv, $(wildcard tools/*))
163172
EDITORCONFIG_FILES := templates .github/workflows options/locale/locale_en-US.ini
164173

165174
GO_SOURCES := $(wildcard *.go)
@@ -221,7 +230,6 @@ git-check:
221230
node-check:
222231
$(eval MIN_NODE_VERSION_STR := $(shell grep -Eo '"node":.*[0-9.]+"' package.json | sed -n 's/.*[^0-9.]\([0-9.]*\)"/\1/p'))
223232
$(eval MIN_NODE_VERSION := $(shell printf "%03d%03d%03d" $(shell echo '$(MIN_NODE_VERSION_STR)' | tr '.' ' ')))
224-
$(eval NODE_VERSION := $(shell printf "%03d%03d%03d" $(shell node -v | cut -c2- | tr '.' ' ');))
225233
$(eval PNPM_MISSING := $(shell hash pnpm > /dev/null 2>&1 || echo 1))
226234
@if [ "$(NODE_VERSION)" -lt "$(MIN_NODE_VERSION)" ]; then \
227235
echo "Gitea requires Node.js $(MIN_NODE_VERSION_STR) or greater to build. You can get it at https://nodejs.org/en/download/"; \
@@ -234,7 +242,7 @@ node-check:
234242

235243
.PHONY: clean-all
236244
clean-all: clean ## delete backend, frontend and integration files
237-
rm -rf $(WEBPACK_DEST_ENTRIES) node_modules tools/node_modules
245+
rm -rf $(WEBPACK_DEST_ENTRIES) node_modules
238246

239247
.PHONY: clean
240248
clean: ## delete backend and integration files
@@ -342,29 +350,29 @@ lint-backend-fix: lint-go-fix lint-go-gitea-vet lint-editorconfig ## lint backen
342350

343351
.PHONY: lint-js
344352
lint-js: node_modules ## lint js files
345-
pnpm exec eslint --color --max-warnings=0 --ext js,ts,vue $(ESLINT_FILES)
346-
pnpm exec vue-tsc
353+
$(NODE_VARS) pnpm exec eslint --color --max-warnings=0 --ext js,ts,vue $(ESLINT_FILES)
354+
$(NODE_VARS) pnpm exec vue-tsc
347355

348356
.PHONY: lint-js-fix
349357
lint-js-fix: node_modules ## lint js files and fix issues
350-
pnpm exec eslint --color --max-warnings=0 --ext js,ts,vue $(ESLINT_FILES) --fix
351-
pnpm exec vue-tsc
358+
$(NODE_VARS) pnpm exec eslint --color --max-warnings=0 --ext js,ts,vue $(ESLINT_FILES) --fix
359+
$(NODE_VARS) pnpm exec vue-tsc
352360

353361
.PHONY: lint-css
354362
lint-css: node_modules ## lint css files
355-
pnpm exec stylelint --color --max-warnings=0 $(STYLELINT_FILES)
363+
$(NODE_VARS) pnpm exec stylelint --color --max-warnings=0 $(STYLELINT_FILES)
356364

357365
.PHONY: lint-css-fix
358366
lint-css-fix: node_modules ## lint css files and fix issues
359-
pnpm exec stylelint --color --max-warnings=0 $(STYLELINT_FILES) --fix
367+
$(NODE_VARS) pnpm exec stylelint --color --max-warnings=0 $(STYLELINT_FILES) --fix
360368

361369
.PHONY: lint-swagger
362370
lint-swagger: node_modules ## lint swagger files
363-
pnpm exec spectral lint -q -F hint $(SWAGGER_SPEC)
371+
$(NODE_VARS) pnpm exec spectral lint -q -F hint $(SWAGGER_SPEC)
364372

365373
.PHONY: lint-md
366374
lint-md: node_modules ## lint markdown files
367-
pnpm exec markdownlint *.md
375+
$(NODE_VARS) pnpm exec markdownlint *.md
368376

369377
.PHONY: lint-spell
370378
lint-spell: ## lint spelling
@@ -411,7 +419,7 @@ lint-actions: ## lint action workflow files
411419

412420
.PHONY: lint-templates
413421
lint-templates: .venv node_modules ## lint template files
414-
@node tools/lint-templates-svg.js
422+
@node tools/lint-templates-svg.ts
415423
@uv run --frozen djlint $(shell find templates -type f -iname '*.tmpl')
416424

417425
.PHONY: lint-yaml
@@ -425,7 +433,7 @@ watch: ## watch everything and continuously rebuild
425433
.PHONY: watch-frontend
426434
watch-frontend: node-check node_modules ## watch frontend files and continuously rebuild
427435
@rm -rf $(WEBPACK_DEST_ENTRIES)
428-
NODE_ENV=development pnpm exec webpack --watch --progress
436+
NODE_ENV=development $(NODE_VARS) pnpm exec webpack --watch --progress --disable-interpret
429437

430438
.PHONY: watch-backend
431439
watch-backend: go-check ## watch backend files and continuously rebuild
@@ -441,7 +449,7 @@ test-backend: ## test backend files
441449

442450
.PHONY: test-frontend
443451
test-frontend: node_modules ## test frontend files
444-
pnpm exec vitest
452+
$(NODE_VARS) pnpm exec vitest
445453

446454
.PHONY: test-check
447455
test-check:
@@ -584,7 +592,7 @@ test-mssql-migration: migrations.mssql.test migrations.individual.mssql.test
584592

585593
.PHONY: playwright
586594
playwright: deps-frontend
587-
pnpm exec playwright install $(PLAYWRIGHT_FLAGS)
595+
$(NODE_VARS) pnpm exec playwright install $(PLAYWRIGHT_FLAGS)
588596

589597
.PHONY: test-e2e%
590598
test-e2e%: TEST_TYPE ?= e2e
@@ -848,13 +856,9 @@ deps-tools: ## install tool dependencies
848856
wait
849857

850858
node_modules: pnpm-lock.yaml
851-
pnpm install --frozen-lockfile
859+
$(NODE_VARS) pnpm install --frozen-lockfile
852860
@touch node_modules
853861

854-
tools/node_modules: tools/package.json
855-
cd tools && pnpm install
856-
@touch tools/node_modules
857-
858862
.venv: uv.lock
859863
uv sync
860864
@touch .venv
@@ -864,16 +868,16 @@ update: update-js update-py ## update js and py dependencies
864868

865869
.PHONY: update-js
866870
update-js: node-check | node_modules ## update js dependencies
867-
pnpm exec updates -u -f package.json
871+
$(NODE_VARS) pnpm exec updates -u -f package.json
868872
rm -rf node_modules pnpm-lock.yaml
869-
pnpm install
870-
pnpm exec nolyfill install
871-
pnpm install
873+
$(NODE_VARS) pnpm install
874+
$(NODE_VARS) pnpm exec nolyfill install
875+
$(NODE_VARS) pnpm install
872876
@touch node_modules
873877

874878
.PHONY: update-py
875879
update-py: node-check | node_modules ## update py dependencies
876-
pnpm exec updates -u -f pyproject.toml
880+
$(NODE_VARS) pnpm exec updates -u -f pyproject.toml
877881
rm -rf .venv uv.lock
878882
uv sync
879883
@touch .venv
@@ -885,13 +889,13 @@ $(WEBPACK_DEST): $(WEBPACK_SOURCES) $(WEBPACK_CONFIGS) pnpm-lock.yaml
885889
@$(MAKE) -s node-check node_modules
886890
@rm -rf $(WEBPACK_DEST_ENTRIES)
887891
@echo "Running webpack..."
888-
@BROWSERSLIST_IGNORE_OLD_DATA=true pnpm exec webpack
892+
@BROWSERSLIST_IGNORE_OLD_DATA=true $(NODE_VARS) pnpm exec webpack --disable-interpret
889893
@touch $(WEBPACK_DEST)
890894

891895
.PHONY: svg
892896
svg: node-check | node_modules ## build svg files
893897
rm -rf $(SVG_DEST_DIR)
894-
node tools/generate-svg.js
898+
node tools/generate-svg.ts
895899

896900
.PHONY: svg-check
897901
svg-check: svg
@@ -905,7 +909,7 @@ svg-check: svg
905909

906910
.PHONY: lockfile-check
907911
lockfile-check:
908-
pnpm install --frozen-lockfile
912+
$(NODE_VARS) pnpm install --frozen-lockfile
909913
@diff=$$(git diff --color=always pnpm-lock.yaml); \
910914
if [ -n "$$diff" ]; then \
911915
echo "pnpm-lock.yaml is inconsistent with package.json"; \
@@ -929,8 +933,8 @@ generate-gitignore: ## update gitignore files
929933
$(GO) run build/generate-gitignores.go
930934

931935
.PHONY: generate-images
932-
generate-images: | node_modules tools/node_modules ## generate images (requires cairo development packages)
933-
cd tools && node generate-images.js $(TAGS)
936+
generate-images: | node_modules ## generate images
937+
cd tools && node generate-images.ts $(TAGS)
934938

935939
.PHONY: generate-manpage
936940
generate-manpage: ## generate manpage

build/code-batch-process.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ func parseArgs() (mainOptions map[string]string, subCmd string, subArgs []string
181181
break
182182
}
183183
}
184-
return
184+
return mainOptions, subCmd, subArgs
185185
}
186186

187187
func showUsage() {

0 commit comments

Comments
 (0)