- move "vendor" files to js/vendor and less/vendor - move swagger to js/standalone (meant for standalone pages) - move gitgraph to features and streamline its loading - add linting configs to webpack dependencies in make - set ignored files for eslint/stylelint directly in their configs Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: Antoine GIRARD <sapk@users.noreply.github.com>tags/v1.10.5
/web_src/js/semanticDropdown.js |
- eslint-config-airbnb-base | - eslint-config-airbnb-base | ||||
- eslint:recommended | - eslint:recommended | ||||
ignorePatterns: | |||||
- /web_src/js/vendor | |||||
parserOptions: | parserOptions: | ||||
ecmaVersion: 2020 | ecmaVersion: 2020 | ||||
extends: stylelint-config-standard | extends: stylelint-config-standard | ||||
ignoreFiles: | |||||
- web_src/less/vendor/**/* | |||||
rules: | rules: | ||||
at-rule-empty-line-before: null | |||||
block-closing-brace-empty-line-before: null | block-closing-brace-empty-line-before: null | ||||
color-hex-length: null | color-hex-length: null | ||||
comment-empty-line-before: null | comment-empty-line-before: null |
PACKAGES ?= $(filter-out code.gitea.io/gitea/integrations/migration-test,$(filter-out code.gitea.io/gitea/integrations,$(shell GO111MODULE=on $(GO) list -mod=vendor ./... | grep -v /vendor/))) | PACKAGES ?= $(filter-out code.gitea.io/gitea/integrations/migration-test,$(filter-out code.gitea.io/gitea/integrations,$(shell GO111MODULE=on $(GO) list -mod=vendor ./... | grep -v /vendor/))) | ||||
GO_SOURCES ?= $(shell find . -name "*.go" -type f) | GO_SOURCES ?= $(shell find . -name "*.go" -type f) | ||||
WEBPACK_SOURCES ?= $(shell find web_src/js web_src/css web_src/less -type f) | |||||
WEBPACK_SOURCES ?= $(shell find web_src/js web_src/less -type f) | |||||
WEBPACK_CONFIGS := webpack.config.js .eslintrc .stylelintrc | |||||
WEBPACK_DEST := public/js/index.js public/css/index.css | WEBPACK_DEST := public/js/index.js public/css/index.css | ||||
BINDATA_DEST := modules/public/bindata.go modules/options/bindata.go modules/templates/bindata.go | BINDATA_DEST := modules/public/bindata.go modules/options/bindata.go modules/templates/bindata.go | ||||
.PHONY: webpack | .PHONY: webpack | ||||
webpack: node-check $(WEBPACK_DEST) | webpack: node-check $(WEBPACK_DEST) | ||||
$(WEBPACK_DEST): $(WEBPACK_SOURCES) webpack.config.js | node_modules | |||||
$(WEBPACK_DEST): $(WEBPACK_SOURCES) $(WEBPACK_CONFIGS) | node_modules | |||||
npx eslint web_src/js webpack.config.js | npx eslint web_src/js webpack.config.js | ||||
npx stylelint web_src/less | npx stylelint web_src/less | ||||
npx webpack --hide-modules --display-entrypoints=false | npx webpack --hide-modules --display-entrypoints=false |
$(async () => { | |||||
export default async function initGitGraph() { | |||||
const graphCanvas = document.getElementById('graph-canvas'); | const graphCanvas = document.getElementById('graph-canvas'); | ||||
if (!graphCanvas) return; | if (!graphCanvas) return; | ||||
const { default: gitGraph } = await import(/* webpackChunkName: "gitgraph" */'./gitGraph.js'); | |||||
const { default: gitGraph } = await import(/* webpackChunkName: "gitgraph" */'../vendor/gitGraph.js'); | |||||
const graphList = []; | const graphList = []; | ||||
$('#graph-raw-list li span.node-relation').each(function () { | $('#graph-raw-list li span.node-relation').each(function () { | ||||
}); | }); | ||||
gitGraph(graphCanvas, graphList); | gitGraph(graphCanvas, graphList); | ||||
}); | |||||
} |
import 'jquery.are-you-sure'; | import 'jquery.are-you-sure'; | ||||
import './publicPath.js'; | import './publicPath.js'; | ||||
import './polyfills.js'; | import './polyfills.js'; | ||||
import './gitGraphLoader.js'; | |||||
import './semanticDropdown.js'; | |||||
import './vendor/semanticDropdown.js'; | |||||
import initContextPopups from './features/contextPopup.js'; | import initContextPopups from './features/contextPopup.js'; | ||||
import initHighlight from './features/highlight.js'; | import initHighlight from './features/highlight.js'; | ||||
import initGitGraph from './features/gitGraph.js'; | |||||
import ActivityTopAuthors from './components/ActivityTopAuthors.vue'; | import ActivityTopAuthors from './components/ActivityTopAuthors.vue'; | ||||
initRepoStatusChecker(); | initRepoStatusChecker(); | ||||
initTemplateSearch(); | initTemplateSearch(); | ||||
initContextPopups(suburl); | initContextPopups(suburl); | ||||
initGitGraph(); | |||||
// Repo clone url. | // Repo clone url. | ||||
if ($('#repo-clone-url').length > 0) { | if ($('#repo-clone-url').length > 0) { |
@import "~highlight.js/styles/github.css"; | |||||
@import "./vendor/gitGraph.css"; | |||||
@import "_tribute"; | @import "_tribute"; | ||||
@import "_emojify"; | @import "_emojify"; | ||||
@import "_base"; | @import "_base"; | ||||
@import "_admin"; | @import "_admin"; | ||||
@import "_explore"; | @import "_explore"; | ||||
@import "_review"; | @import "_review"; | ||||
@import "~highlight.js/styles/github.css"; | |||||
@import "../css/gitGraph.css"; |
resolve(__dirname, 'web_src/less/index.less'), | resolve(__dirname, 'web_src/less/index.less'), | ||||
], | ], | ||||
swagger: [ | swagger: [ | ||||
resolve(__dirname, 'web_src/js/swagger.js'), | |||||
resolve(__dirname, 'web_src/js/standalone/swagger.js'), | |||||
], | ], | ||||
jquery: [ | jquery: [ | ||||
resolve(__dirname, 'web_src/js/jquery.js'), | resolve(__dirname, 'web_src/js/jquery.js'), |