Skip to content

Commit 095fdd6

Browse files
silverwindlng2020GiteaBot
authored
move some scripts from 'build' to 'tools' directory, misc refactors (#29844)
- Move some scripts from `build` to new `tools` dir. Eventually i would like to move all but let's do it step-by-step. - Add dir to eslint and move the files into vars. - Update docs accordingly. - While updating docs I noticed we were incorrectly having `public/img` path still in a few places. Replace those with the current `public/assets/img`. --------- Co-authored-by: Nanguan Lin <nanguanlin6@gmail.com> Co-authored-by: Giteabot <teabot@gitea.io>
1 parent 5ca65d3 commit 095fdd6

10 files changed

+18
-20
lines changed

.dockerignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ cpu.out
6262
/data
6363
/indexers
6464
/log
65-
/public/img/avatar
6665
/tests/integration/gitea-integration-*
6766
/tests/integration/indexers-*
6867
/tests/e2e/gitea-e2e-*
@@ -78,6 +77,7 @@ cpu.out
7877
/public/assets/js
7978
/public/assets/css
8079
/public/assets/fonts
80+
/public/assets/img/avatar
8181
/public/assets/img/webpack
8282
/vendor
8383
/web_src/fomantic/node_modules

.eslintrc.yaml

-4
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,6 @@ overrides:
4242
worker: true
4343
rules:
4444
no-restricted-globals: [2, addEventListener, blur, close, closed, confirm, defaultStatus, defaultstatus, error, event, external, find, focus, frameElement, frames, history, innerHeight, innerWidth, isFinite, isNaN, length, locationbar, menubar, moveBy, moveTo, name, onblur, onerror, onfocus, onload, onresize, onunload, open, opener, opera, outerHeight, outerWidth, pageXOffset, pageYOffset, parent, print, removeEventListener, resizeBy, resizeTo, screen, screenLeft, screenTop, screenX, screenY, scroll, scrollbars, scrollBy, scrollTo, scrollX, scrollY, status, statusbar, stop, toolbar, top]
45-
- files: ["build/generate-images.js"]
46-
rules:
47-
i/no-unresolved: [0]
48-
i/no-extraneous-dependencies: [0]
4945
- files: ["*.config.*"]
5046
rules:
5147
i/no-unused-modules: [0]

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ cpu.out
5858
/data
5959
/indexers
6060
/log
61-
/public/img/avatar
61+
/public/assets/img/avatar
6262
/tests/integration/gitea-integration-*
6363
/tests/integration/indexers-*
6464
/tests/e2e/gitea-e2e-*

Makefile

+9-7
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,8 @@ TAR_EXCLUDES := .git data indexers queues log node_modules $(EXECUTABLE) $(FOMAN
147147
GO_DIRS := build cmd models modules routers services tests
148148
WEB_DIRS := web_src/js web_src/css
149149

150+
ESLINT_FILES := web_src/js tools *.config.js tests/e2e
151+
STYLELINT_FILES := web_src/css web_src/js/components/*.vue
150152
SPELLCHECK_FILES := $(GO_DIRS) $(WEB_DIRS) docs/content templates options/locale/locale_en-US.ini .github
151153
EDITORCONFIG_FILES := templates .github/workflows options/locale/locale_en-US.ini
152154

@@ -375,19 +377,19 @@ lint-backend-fix: lint-go-fix lint-go-vet lint-editorconfig
375377

376378
.PHONY: lint-js
377379
lint-js: node_modules
378-
npx eslint --color --max-warnings=0 --ext js,vue web_src/js build *.config.js tests/e2e
380+
npx eslint --color --max-warnings=0 --ext js,vue $(ESLINT_FILES)
379381

380382
.PHONY: lint-js-fix
381383
lint-js-fix: node_modules
382-
npx eslint --color --max-warnings=0 --ext js,vue web_src/js build *.config.js tests/e2e --fix
384+
npx eslint --color --max-warnings=0 --ext js,vue $(ESLINT_FILES) --fix
383385

384386
.PHONY: lint-css
385387
lint-css: node_modules
386-
npx stylelint --color --max-warnings=0 web_src/css web_src/js/components/*.vue
388+
npx stylelint --color --max-warnings=0 $(STYLELINT_FILES)
387389

388390
.PHONY: lint-css-fix
389391
lint-css-fix: node_modules
390-
npx stylelint --color --max-warnings=0 web_src/css web_src/js/components/*.vue --fix
392+
npx stylelint --color --max-warnings=0 $(STYLELINT_FILES) --fix
391393

392394
.PHONY: lint-swagger
393395
lint-swagger: node_modules
@@ -444,7 +446,7 @@ lint-yaml: .venv
444446

445447
.PHONY: watch
446448
watch:
447-
@bash build/watch.sh
449+
@bash tools/watch.sh
448450

449451
.PHONY: watch-frontend
450452
watch-frontend: node-check node_modules
@@ -916,7 +918,7 @@ $(WEBPACK_DEST): $(WEBPACK_SOURCES) $(WEBPACK_CONFIGS) package-lock.json
916918
.PHONY: svg
917919
svg: node-check | node_modules
918920
rm -rf $(SVG_DEST_DIR)
919-
node build/generate-svg.js
921+
node tools/generate-svg.js
920922

921923
.PHONY: svg-check
922924
svg-check: svg
@@ -960,7 +962,7 @@ generate-gitignore:
960962
.PHONY: generate-images
961963
generate-images: | node_modules
962964
npm install --no-save fabric@6.0.0-beta19 imagemin-zopfli@7
963-
node build/generate-images.js $(TAGS)
965+
node tools/generate-images.js $(TAGS)
964966

965967
.PHONY: generate-manpage
966968
generate-manpage:

docs/content/administration/cmd-embedded.zh-cn.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ gitea embedded list [--include-vendored] [patterns...]
3737

3838
- 列出所有模板文件,无论在哪个虚拟目录下:`**.tmpl`
3939
- 列出所有邮件模板文件:`templates/mail/**.tmpl`
40-
- 列出 `public/img` 目录下的所有文件:`public/img/**`
40+
列出 `public/assets/img` 目录下的所有文件:`public/assets/img/**`
4141

4242
不要忘记为模式使用引号,因为空格、`*` 和其他字符可能对命令行解释器有特殊含义。
4343

@@ -49,8 +49,8 @@ gitea embedded list [--include-vendored] [patterns...]
4949

5050
```sh
5151
$ gitea embedded list '**openid**'
52-
public/img/auth/openid_connect.svg
53-
public/img/openid-16x16.png
52+
public/assets/img/auth/openid_connect.svg
53+
public/assets/img/openid-16x16.png
5454
templates/user/auth/finalize_openid.tmpl
5555
templates/user/auth/signin_openid.tmpl
5656
templates/user/auth/signup_openid_connect.tmpl

docs/content/development/hacking-on-gitea.en-us.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ REPO_INDEXER_CONN_STR = http://elastic:changeme@localhost:9200
214214

215215
### Building and adding SVGs
216216

217-
SVG icons are built using the `make svg` target which compiles the icon sources defined in `build/generate-svg.js` into the output directory `public/assets/img/svg`. Custom icons can be added in the `web_src/svg` directory.
217+
SVG icons are built using the `make svg` target which compiles the icon sources into the output directory `public/assets/img/svg`. Custom icons can be added in the `web_src/svg` directory.
218218

219219
### Building the Logo
220220

docs/content/development/hacking-on-gitea.zh-cn.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ REPO_INDEXER_CONN_STR = http://elastic:changeme@localhost:9200
201201

202202
### 构建和添加 SVGs
203203

204-
SVG 图标是使用 `make svg` 目标构建的,该目标将 `build/generate-svg.js` 中定义的图标源编译到输出目录 `public/img/svg` 中。可以在 `web_src/svg` 目录中添加自定义图标。
204+
SVG 图标是使用 `make svg` 命令构建的,该命令将图标资源编译到输出目录 `public/assets/img/svg` 中。可以在 `web_src/svg` 目录中添加自定义图标。
205205

206206
### 构建 Logo
207207

build/generate-images.js renamed to tools/generate-images.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env node
2-
import imageminZopfli from 'imagemin-zopfli';
2+
import imageminZopfli from 'imagemin-zopfli'; // eslint-disable-line i/no-unresolved
3+
import {loadSVGFromString, Canvas, Rect, util} from 'fabric/node'; // eslint-disable-line i/no-unresolved
34
import {optimize} from 'svgo';
4-
import {loadSVGFromString, Canvas, Rect, util} from 'fabric/node';
55
import {readFile, writeFile} from 'node:fs/promises';
66
import {argv, exit} from 'node:process';
77

File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)