Skip to content

Commit

Permalink
move jquery and jquery-migrate to npm/webpack (go-gitea#9813)
Browse files Browse the repository at this point in the history
Currently, this needs to be its own chunk because fomantic depends
on jQuery being present. The next step is to move fomantic to webpack
too after which we can combine the index,fomantic and jquery files into
one.

jquery-migrate is still neccessary because our ancient version of Dropzone
seems to break without it. I imagine it can be removed after a Dropzone
upgrade.
  • Loading branch information
silverwind authored and lafriks committed Jan 21, 2020
1 parent 0e8b27a commit 2982afe
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 244 deletions.
5 changes: 5 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
},
"dependencies": {
"fomantic-ui": "2.8.3",
"jquery": "3.4.1",
"jquery-migrate": "3.1.0",
"swagger-ui": "3.24.3",
"vue-bar-graph": "1.2.0"
},
Expand Down
6 changes: 3 additions & 3 deletions public/vendor/librejs.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@
<td><a href="https://github.com/codedance/jquery.AreYouSure/archive/1.9.0.tar.gz">jquery.areyousure-1.9.0.tar.gz</a></td>
</tr>
<tr>
<td><a href="./plugins/jquery/jquery.min.js">jquery.min.js</a></td>
<td><a href="../js/jquery.js">jQuery</a></td>
<td><a href="https://jquery.org/license/">MIT</a></td>
<td><a href="https://code.jquery.com/jquery-3.4.1.min.js">jquery-3.4.1.min.js</a></td>
</tr>
<tr>
<td><a href="./plugins/jquery-migrate/jquery-migrate.min.js">jquery-migrate.min.js</a></td>
<td><a href="../js/jquery.js">jQuery Migrate</a></td>
<td><a href="https://jquery.org/license/">MIT</a></td>
<td><a href="https://code.jquery.com/jquery-migrate-3.0.1.min.js">jquery-migrate-3.0.1.min.js</a></td>
<td><a href="https://code.jquery.com/jquery-migrate-3.1.0.min.js">jquery-migrate-3.1.0.min.js</a></td>
</tr>
<tr>
<td><a href="./plugins/fomantic/semantic.min.js">semantic.min.js</a></td>
Expand Down
215 changes: 0 additions & 215 deletions public/vendor/plugins/jquery-migrate/jquery-migrate.min.js

This file was deleted.

18 changes: 0 additions & 18 deletions public/vendor/plugins/jquery/LICENSE

This file was deleted.

2 changes: 0 additions & 2 deletions public/vendor/plugins/jquery/jquery.min.js

This file was deleted.

5 changes: 1 addition & 4 deletions templates/base/footer.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@

{{template "base/footer_content" .}}

<script src="{{StaticUrlPrefix}}/vendor/plugins/jquery/jquery.min.js?v=3.4.1"></script>
<script src="{{StaticUrlPrefix}}/vendor/plugins/jquery-migrate/jquery-migrate.min.js?v=3.0.1"></script>
<script src="{{StaticUrlPrefix}}/js/jquery.js?v={{MD5 AppVer}}"></script>
<script src="{{StaticUrlPrefix}}/vendor/plugins/jquery.areyousure/jquery.are-you-sure.js"></script>
{{if .RequireSimpleMDE}}
<script src="{{StaticUrlPrefix}}/vendor/plugins/simplemde/simplemde.min.js"></script>
Expand Down Expand Up @@ -115,8 +114,6 @@
<script src="{{StaticUrlPrefix}}/vendor/plugins/emojify/emojify.custom.js"></script>
<script src="{{StaticUrlPrefix}}/vendor/plugins/clipboard/clipboard.min.js"></script>
<script src="{{StaticUrlPrefix}}/vendor/plugins/vue/vue.min.js"></script>

<!-- JavaScript -->
<script src="{{StaticUrlPrefix}}/fomantic/semantic.min.js?v={{MD5 AppVer}}"></script>
<script src="{{StaticUrlPrefix}}/js/index.js?v={{MD5 AppVer}}"></script>
{{if .EnableHeatmap}}
Expand Down
3 changes: 1 addition & 2 deletions templates/pwa/serviceworker_js.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@ var STATIC_CACHE = 'static-cache-v1';
var urlsToCache = [
// js
'{{StaticUrlPrefix}}/vendor/plugins/jquery.areyousure/jquery.are-you-sure.js',
'{{StaticUrlPrefix}}/vendor/plugins/jquery/jquery.min.js?v=3.4.1',
'{{StaticUrlPrefix}}/vendor/plugins/jquery-migrate/jquery-migrate.min.js?v=3.0.1',
'{{StaticUrlPrefix}}/fomantic/semantic.min.js?v={{MD5 AppVer}}',
'{{StaticUrlPrefix}}/js/index.js?v={{MD5 AppVer}}',
'{{StaticUrlPrefix}}/js/swagger.js?v={{MD5 AppVer}}',
'{{StaticUrlPrefix}}/js/gitgraph.js?v={{MD5 AppVer}}',
'{{StaticUrlPrefix}}/js/jquery.js?v={{MD5 AppVer}}',
'{{StaticUrlPrefix}}/vendor/plugins/clipboard/clipboard.min.js',
'{{StaticUrlPrefix}}/vendor/plugins/vue/vue.min.js',
'{{StaticUrlPrefix}}/vendor/plugins/emojify/emojify.custom.js',
Expand Down
5 changes: 5 additions & 0 deletions web_src/js/jquery.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import $ from 'jquery';
import 'jquery-migrate';

$.migrateMute = true;
window.$ = window.jQuery = $;
3 changes: 3 additions & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ module.exports = {
entry: {
index: ['./web_src/js/index'],
swagger: ['./web_src/js/swagger'],
jquery: ['./web_src/js/jquery'],
},
devtool: false,
output: {
Expand Down Expand Up @@ -77,6 +78,8 @@ module.exports = {
}),
],
performance: {
maxEntrypointSize: 512000,
maxAssetSize: 512000,
assetFilter: (filename) => {
return !filename.endsWith('.map') && filename !== 'swagger.js';
}
Expand Down

0 comments on commit 2982afe

Please sign in to comment.