]> source.dussan.org Git - gitea.git/commit
enable lazy-loading of gitgraph.js (#9036)
authorsilverwind <me@silverwind.io>
Sun, 17 Nov 2019 21:39:06 +0000 (22:39 +0100)
committerLauris BH <lauris@nix.lv>
Sun, 17 Nov 2019 21:39:06 +0000 (23:39 +0200)
commitf8bd90ba60b0c362d3e39ddf702cac0e0df2b0ab
treebf0d009550720440d5e7db505b5dafec1450777e
parent06984bbcbf43ca1ebb8ef8cee98553a41e3c2e0f
enable lazy-loading of gitgraph.js (#9036)

- moved gitgraph.js to web_src and made it importable and es6-compatible
- created new webpack chunk for gitgraph
- enabled CSS loader in webpack
- enabled async/await syntax via regenerator-runtime
- added script to ensure webpack chunks are loaded correctly
- disable terser's comment extraction to prevent .LICENCE files

gitgraph.js has many issues:

1. it is incompatible with ES6 because of strict-mode violations
1. it does not export anything
1. it's css has weird styles like for `body`
1. it is not available on npm

I fixed points 1-3 in our version so it's now loadable in webpack. We should eventually consider alternatives.
25 files changed:
.eslintignore
.eslintrc
package-lock.json
package.json
public/js/gitgraph.js [new file with mode: 0644]
public/js/gitgraph.js.map [new file with mode: 0644]
public/js/index.js
public/js/index.js.map
public/vendor/VERSIONS
public/vendor/librejs.html
public/vendor/plugins/gitgraph/LICENSE [deleted file]
public/vendor/plugins/gitgraph/gitgraph.css [deleted file]
public/vendor/plugins/gitgraph/gitgraph.js [deleted file]
routers/repo/commit.go
templates/base/footer.tmpl
templates/base/head.tmpl
templates/pwa/serviceworker_js.tmpl
web_src/js/draw.js [deleted file]
web_src/js/gitGraph.js [new file with mode: 0644]
web_src/js/index.js
web_src/js/publicPath.js [new file with mode: 0644]
web_src/vendor/gitgraph.js/LICENSE [new file with mode: 0644]
web_src/vendor/gitgraph.js/gitgraph.custom.css [new file with mode: 0644]
web_src/vendor/gitgraph.js/gitgraph.custom.js [new file with mode: 0644]
webpack.config.js