summaryrefslogtreecommitdiffstats
path: root/webpack.config.js
Commit message (Collapse)AuthorAgeFilesLines
* Replace Less with CSS (#23508)silverwind2023-03-161-27/+4
| | | | | | | | | | | | | | Backport https://github.com/go-gitea/gitea/pull/23481, https://github.com/go-gitea/gitea/pull/23504 and https://github.com/go-gitea/gitea/pull/23520 to 1.19, just so we have an easier time with future backports. Seems to work on a basic level. There was a merge conflict in `RepoActionView.vue`, otherwise it merged cleanly. --------- Co-authored-by: John Olheiser <john.olheiser@gmail.com> Co-authored-by: Lauris BH <lauris@nix.lv>
* update to mermaid v10 (#23178) (#23299)Giteabot2023-03-051-1/+1
| | | | | | | | | Backport #23178 fix #23153 Co-authored-by: techknowlogick <techknowlogick@gitea.io> Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: delvh <leon@kske.dev>
* Introduce customized HTML elements, fix incorrect AppUrl usages in templates ↵wxiaoguang2023-02-171-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (#22861) This PR follows: * #21986 * #22831 This PR also introduce customized HTML elements, which would also help problems like: * #17760 * #21429 * #21440 With customized HTML elements, there won't be any load-search-replace operations, and it can avoid page flicking (which @silverwind cares a lot). Browser support: https://developer.mozilla.org/en-US/docs/Web/API/Window/customElements # FAQ ## Why the component has the prefix? As usual, I would strongly suggest to add prefixes for our own/private names. The dedicated prefix will avoid conflicts in the future, and it makes it easier to introduce various 3rd components, like GitHub's `relative-time` component. If there is no prefix, it's impossible to introduce another public component with the same name in the future. ## Why the `custcomp.js` is loaded before HTML body? The `index.js` is after HTML body. Customized components must be registered before the content loading. Otherwise there would be still some flicking. `custcomp.js` should have its own dependencies and should be very light, so it won't affect the page loading time too much. ## Why use `data-url` attribute but not use the `textContent`? According to the standard, the `connectedCallback` occurs on the tag-opening moment. The element's children are not ready yet. ## Why not use `{{.GuessCurrentOrigin $.ctx ...}}` to let backend decide the absolute URL? It's difficult for backend to guess the correct protocol(scheme) correctly with zero configuration. Generating the absolute URL from frontend can guarantee that the URL is 100% correct -- since the user is visiting it. # Screenshot <details> ![image](https://user-images.githubusercontent.com/2114189/218256757-a267c8ba-3108-4755-9ae5-329f1b08f615.png) </details>
* Update JS dependencies and eslint (#22190)silverwind2022-12-201-3/+3
| | | | | | | - Update all JS dependencies to latest version - Enable unicorn/prefer-node-protocol and autofix issues - Regenerate SVGs - Add some comments to eslint rules - Tested build, Mermaid and Katex rendering
* Update JS dependencies (#21881)silverwind2022-11-221-2/+3
| | | | | | | | - Update all JS deps - Regenerate SVGs - Add new eslint rules, fix issues - Tested Mermaid, Swagger, Vue, Webpack, Citation Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Fix webpack license warning (#21815)silverwind2022-11-181-1/+2
| | | | | | | | | | | | | | #19999 introduced a indirect dependency with a license that was not on our allowlist yet which produced this warning during webpack: ```` WARNING in License: citeproc@2.4.62 has disallowed license CPAL-1.0 OR AGPL-1.0 ```` I've added both licenses to the allowed list and made it so webpack will now abort on such license errors so that we don't miss those next time. Co-authored-by: John Olheiser <john.olheiser@gmail.com> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* chore: add webpack export type check (#21857)Percy Ma2022-11-181-0/+1
| | | | | add webpack export type check Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Update JS dependencies and eslint config (#21388)silverwind2022-10-101-1/+1
| | | | | | | | - Update all JS dependencies and playwright image - Add new eslint rules, enable a few more, fix issues - Regenerate SVGs - Tested Vue and Swagger Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Refactor from Vue2 to Vue3 (#20044)André Jaenisch2022-10-011-5/+1
| | | Close #19902
* Add KaTeX rendering to Markdown. (#20571)zeripath2022-09-141-0/+4
| | | | | | | | | | | | | | | | | | | | This PR adds mathematical rendering with KaTeX. The first step is to add a Goldmark extension that detects the latex (and tex) mathematics delimiters. The second step to make this extension only run if math support is enabled. The second step is to then add KaTeX CSS and JS to the head which will load after the dom is rendered. Fix #3445 Signed-off-by: Andrew Thornton <art27@cantab.net> Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Rewrite go license generator in go (#21078)silverwind2022-09-071-3/+7
| | | | | | | | | | This removes the JS dependency in the checks pipeline. JSON output is different because the previous JS did indent the license data differently and a JSON key was changed, but the end result is the same as it gets re-indented by wepack. Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: zeripath <art27@cantab.net>
* Add go licenses to licenses.txt (#21034)silverwind2022-09-041-3/+10
| | | | | | | `make go-licenses` will generate `assets/go-licenses.json` which is then included in the webpack build. This step depends on both go and node being present, so unfortunately, I could not automate the generation by hooking it up to `tidy` as that target is triggered on CI where we do not have a docker image with both go an node. It should be ran from time to time, ideally after each go mod update.
* Enable contenthash in filename for dynamic assets (#20813)silverwind2022-08-231-6/+6
| | | | | This should solve the main problem of dynamic assets getting stale after a version upgrade. Everything not affected will use query-string based cache busting, which includes files loaded via HTML or worker scripts.
* Update JS dependencies (#20423)silverwind2022-07-201-1/+0
| | | | | | - Update all JS dependencies minus vue ones - Remove workaround for case-insensitive attribute selector - Add new linter rules and fix issues - Tested SVG display and swagger
* Modernize JS build scripts (#19824)silverwind2022-06-061-16/+18
| | | | | | | | | | - Remove __dirname, use file URLs instead - Upgrade fabric dependency - Use fs/promises syntax, this breaks node 12 but we require 14 already The change in public/img/favicon.svg is not caused by the fabric upgrade, but it seems it was not properly generated when introduced. Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Support webauthn (#17957)Lunny Xiao2022-01-141-0/+1
| | | | | | | Migrate from U2F to Webauthn Co-authored-by: Andrew Thornton <art27@cantab.net> Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Fix CSS specificity issue with easymde's css (#18201)silverwind2022-01-071-0/+1
| | | | | | | | | | | | | | | | * Fix CSS specificity issue with easymde's css PR #18069 introduced a regression in certain overwritten editor styles because the dynamic loading of easymde.min.css causes its's style to apply after our supposed override styles. Solve this by bundling the styles into index.css. We should later aim to completely replace easymde.min.css completely with our own styles so there are no more conflicts. * Update web_src/js/features/comp/EasyMDE.js Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Load EasyMDE/CodeMirror dynamically, remove RequireEasyMDE (#18069)wxiaoguang2022-01-051-4/+0
| | | This PR makes frontend load EasyMDE/CodeMirror dynamically, and removes `RequireEasyMDE`.
* Update JS dependencies (#17357)silverwind2021-10-191-0/+3
| | | | | | | | | | | | | * Update JS dependencies - Upgrade to eslint 8 and add new plugin rules - Adapt to various API changes - Rebuild SVGs * fix webpack warning on license * order options alphabetically Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Update JS dependencies (#16708)silverwind2021-08-171-6/+4
| | | | | | | | | | | | | | * Update JS dependencies - Update all JS dependencies - Adapt to recent webpack changes - Add new lint rules and fix issues - Regenerate SVGs and update svgo api usage Fixes: https://github.com/go-gitea/gitea/pull/16492 * adapt jest config and sort keys Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Disable legal comments in esbuild (#15929)silverwind2021-05-191-0/+1
| | | | We already serve licenses.txt so we don't need these inline comments preserved during esbuild minification. Saves around 4kB before gzip.
* Use esbuild to minify CSS (#15756)silverwind2021-05-071-15/+2
| | | | | | | | It's about a 30% speedup in webpack build time with neglible differences in the output size. We do lose the ability for CSS source maps, but I rarely have a use for them anyways. Co-authored-by: techknowlogick <techknowlogick@gitea.io> Co-authored-by: 6543 <6543@obermui.de>
* Update JS dependencies (#15591)silverwind2021-04-241-1/+0
| | | | | | | | | | | | | * Update JS dependencies - Update all JS dependencies - Regenerate SVGs - Remove unused postcss dependency - Remove removed webpack option * re-add postcss Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Raw file view tweaks (#15520)silverwind2021-04-221-0/+1
| | | | | | | | | | | - Limit SVG images to 600px width - Adjust size of view toggle buttons to match other buttons - Make Edit/Delete buttons easier to click Had to create a separate CSS file because the less parser can not parse CSS4 case-insensitive attribute selectors which are widely supported by browsers. Fixes: https://github.com/go-gitea/gitea/issues/15515
* Fix missing icons and colorpicker when mounted on suburl (#15501)zeripath2021-04-161-2/+2
| | | | | | | | | | | * Fix missing icons and colorpicker when mounted on suburl Signed-off-by: Andrew Thornton <art27@cantab.net> * as per silverwind Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: Lauris BH <lauris@nix.lv>
* Fix: npx webpack make: *** [Makefile:699: public/js/index.js] Error -… ↵Kindyroo2021-04-151-3/+5
| | | | | | | | | | | | (#15465) * Fix: npx webpack make: *** [Makefile:699: public/js/index.js] Error -1073741819 * Update webpack.config.js Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: silverwind <me@silverwind.io>
* Disable cssnano's colormin plugin (#15347)silverwind2021-04-081-0/+1
| | | | | | It produces odd rgba values which also seem to cause issues in monaco's color parser where the scoll shadow went red for some reason. Regression by: https://github.com/go-gitea/gitea/pull/15333
* Add frontend testing, require node 12 (#15315)silverwind2021-04-081-12/+15
| | | | | | | | | | - Add basic frontend unit testing infrastructure using jest in ESM mode - Rename 'make test' to 'make test-backend' - Introduce 'make test-frontend' and 'make test' that runs both - Bump Node.js requirement to v12. v10 will be EOL in less than a month. - Convert all build-related JS files to ESM. I opted to run frontend tests run as part of the compliance pipeline because they complete fast and are not platform-specific like the golang tests.
* Introduce esbuild on webpack (#14578)Lunny Xiao2021-04-021-38/+6
| | | | | | | | | | | | | | | * Vendor node mods as cache; fix esbuild/fomantic offline build * Fix --exclude; use bsdtar for consistent globbing * Fall back to GNU tar; forward-compatible for APT 2.0 * Avoid having extd. attrs with bsdtar * Dependency and misc. optimizations * Remove extra code after esbuild-loader update Co-authored-by: Mike L <cl.jeremy@qq.com>
* Remove file-loader dependency (#15196)silverwind2021-03-301-20/+10
| | | | | | | | - Upgrade webpack to 5.28 to enable publicPath option - Use asset modules in place of deprecated file-loader Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: Lauris BH <lauris@nix.lv>
* Remove raw-loader dependency (#15112)silverwind2021-03-221-5/+1
| | | | | | | Webpack now includes this functionality, allowing us to drop this now-deprecated dependency. Ref: https://webpack.js.org/guides/asset-modules/ Ref: https://webpack.js.org/loaders/raw-loader/
* Update JS dependencies and webpack (#14118)silverwind2020-12-271-33/+35
| | | | | | | | | | | | | | | | | | * Update JS dependencies - Update all JS dependencies - Adapt webpack config for version 5 - Update to Less 4.0, adapting usage of removed mixin syntax - Enable new ESLint rules and fix discovered issues * update license-webpack-plugin to fix missing licenses * update license-webpack-plugin once more to get webpack into the license output * switch to license-checker-webpack-plugin again for performance * update deps again Co-authored-by: Lauris BH <lauris@nix.lv>
* Switch from SimpleMDE to EasyMDE (#13333)zeripath2020-11-101-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Switch from SimpleMDE to EasyMDE Signed-off-by: Andrew Thornton <art27@cantab.net> * use webpack to webpack the easymde css Signed-off-by: Andrew Thornton <art27@cantab.net> * move css to only css Signed-off-by: Andrew Thornton <art27@cantab.net> * move loading codemirror modes and addons back in to footer.tmpl Signed-off-by: Andrew Thornton <art27@cantab.net> * Fix arc-green Signed-off-by: Andrew Thornton <art27@cantab.net> * as per @silverwind * reinstall codemirror Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: Lauris BH <lauris@nix.lv>
* Use CSS Variables for fonts, remove postcss-loader (#13204)silverwind2020-10-191-38/+1
| | | | | | | | | | | | | * Use CSS Variables for fonts, remove postcss-loader - Use CSS variables for fonts, making the fonts easier to customize - Remove postcss-loader, it's not doing anything useful and is actually applying strange transforms on our CSS. Fixes: https://github.com/go-gitea/gitea/issues/11045 * introduce helper variable, mark documented vars * work around case issue by always quoting specific fonts
* Update JS dependencies (#12782)silverwind2020-09-101-16/+27
| | | | | | | | | - Update all dependencies - Add explicit postcss dependency as dictated by postcss-loader - Adapt for new postcss-loader syntax - Move sourceMap options to top for consistency Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Avoid unnecessary system-ui expansion (#12522)Mike L2020-08-281-2/+8
| | | | | | | | * Avoid unnecessary system-ui expansion (fix #12325) * extract config to static object Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Extract Swagger CSS to its own file (#12616)silverwind2020-08-261-0/+1
|
* Speed up licenses.txt build during development, add additionalModules (#12510)silverwind2020-08-211-2/+6
| | | | | | | | - Emit static string for licenses.txt during development for faster builds - Manually add @primer/octicons to licenses.txt because it's never directy imported. Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Update JS dependencies (#12474)silverwind2020-08-121-7/+4
| | | | | | | | | | | * Update JS dependencies - Update worker-loader options (currently unused pending #12459) - Remove @babel/plugin-proposal-object-rest-spread, it's enabled by default - Switch cssnano-webpack-plugin to css-minimizer-webpack-plugin which had been renamed * switch to css-minimizer-webpack-plugin
* Split up monaco's language chunks (#12401)silverwind2020-08-021-8/+5
| | | | | | | | This should speed up monaco's loading time by splitting the current 3.71MB chunk monaco.js into 63 individual files named 1 to 63.js in the output directory. There seems to be no way to get a better file naming scheme unfortunately. I opted to exclude those files in the webpack output for brevity.
* Move jquery-minicolors to npm/webpack (#12305)silverwind2020-07-291-1/+14
| | | | | | | | | | | | | | | | | | | | * Move jquery-minicolors to npm/webpack - Unvendor and add as npm dependency - Removed unneeded backend variable - Fixed existing bug where picker would previously initizalize to the same green color when editing a label. There was probably a version bump because the previous version was over 3 years old but it seems to be compatible. * use file-loader * trailing comma and comment update * misc tweaks Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Update JS deps and linting config (#12295)silverwind2020-07-271-2/+2
| | | | | | | | - update js deps to latest versions - remove eslint-plugin-sonarjs to prevent a warning on install. can be added again once it's updated to support eslint 7.x - enable new linting rules from eslint-plugin-unicorn Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Direct SVG rendering (#12157)silverwind2020-07-121-26/+5
| | | | | | | | | | | | Introduce 'make svg' which calls a node script that compiles svg files to `public/img/svg`. These files are vendored to not create a dependency on Node for the backend build. On the frontend side, configure webpack using `raw-loader` so SVGs can be imported as string. Also moved our existing SVGs to web_src/svg for consistency. Fixes: https://github.com/go-gitea/gitea/issues/11618
* Fonts rework (#12114)silverwind2020-07-061-6/+8
| | | | | | | | | | | | | - Use system fonts only for text to avoid FOUT - Move font-awesome to npm/webpack - Move NotoColorEmoji to web_src - Remove presumably unneccesary 'PT Sans Narrow' - Simplify webpack import exclusions Fixes: https://github.com/go-gitea/gitea/issues/11818 Fixes: https://github.com/go-gitea/gitea/pull/11814 Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: Lauris BH <lauris@nix.lv>
* Move EventSource to SharedWorker (#12095)zeripath2020-07-031-0/+3
| | | | | | | | | | | | | Move EventSource to use a SharedWorker. This prevents issues with HTTP/1.1 open browser connections from preventing gitea from opening multiple tabs. Also allow setting EVENT_SOURCE_UPDATE_TIME to disable EventSource updating Fix #11978 Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Fix missing gitgraph css import (#12112)silverwind2020-07-011-0/+2
| | | | | | | | | The filter was wrongly excluding the gitGraph.css file. Need to clean this up later so that imports are always relative to the source file (which is not the case for fonts right now). Regressed by: https://github.com/go-gitea/gitea/pull/11997 Co-authored-by: zeripath <art27@cantab.net>
* Server-side syntax highlighting for all code (#12047)mrsdizzie2020-07-011-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Server-side syntax hilighting for all code This PR does a few things: * Remove all traces of highlight.js * Use chroma library to provide fast syntax hilighting directly on the server * Provide syntax hilighting for diffs * Re-style both unified and split diffs views * Add custom syntax hilighting styling for both regular and arc-green Fixes #7729 Fixes #10157 Fixes #11825 Fixes #7728 Fixes #3872 Fixes #3682 And perhaps gets closer to #9553 * fix line marker * fix repo search * Fix single line select * properly load settings * npm uninstall highlight.js * review suggestion * code review * forgot to call function * fix test * Apply suggestions from code review suggestions from @silverwind thanks Co-authored-by: silverwind <me@silverwind.io> * code review * copy/paste error * Use const for highlight size limit * Update web_src/less/_repository.less Co-authored-by: Lauris BH <lauris@nix.lv> * update size limit to 1MB and other styling tweaks * fix highlighting for certain diff sections * fix test * add worker back as suggested Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: Lauris BH <lauris@nix.lv>
* Use custom SVGs for commit signing lock icon (#12017)Cirno the Strongest2020-06-281-1/+4
| | | | | | | | | | | | * Use custom SVGs for commit signing lock icon * missing spans * editorconfig * xmlns and remove aria-hidden Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Move fomantic and jQuery to main webpack bundle (#11997)silverwind2020-06-271-29/+63
| | | | | | | | | | | | | | This saves around 3 MB binary size by not including useless fomantic files in the build. Also, this allows us to move jQuery into the main bundle as well which eliminates a few HTTP requests. Also included are webpack config changes: - split less and css loaders to speed up compliation - enable css sourcemaps - switch css minfier plugin to cssnano-webpack-plugin which works better for sourcemaps than the previous plugin Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Add automatic JS license generation (#11810)silverwind2020-06-121-0/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | * Add automatic JS license generation Removed librejs file and replaced it with a plaintext file that is built from all JS dependencies that are included in the webpack build. It does not cover the few remaining statically vendored files and fomantic is added manually because it's not yet in the webpack build process. Fixes: https://github.com/go-gitea/gitea/issues/11630 * fix lint * remove jslicense, we're not librejs compatible any more * remove license.txt test as it depens on absent files * small optimization * trailing comma * localize and capitalize the word 'licenses' * reduce text to just 'Licenses' Co-authored-by: Lauris BH <lauris@nix.lv>