Move vendor libraries to /vendors folder and exclude from LGTM

This commit is contained in:
John McLear 2021-02-21 15:07:39 +00:00 committed by GitHub
parent 0bb3e65020
commit 1b8cd0747d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
32 changed files with 79 additions and 75 deletions

9
lgtm.yml Normal file
View File

@ -0,0 +1,9 @@
extraction:
javascript:
index:
exclude:
- src/static/js/vendors
python:
index:
exclude:
- /

View File

@ -2,7 +2,7 @@
"pad.js": [
"pad.js"
, "pad_utils.js"
, "browser.js"
, "vendors/browser.js"
, "pad_cookie.js"
, "pad_editor.js"
, "pad_editbar.js"
@ -16,10 +16,10 @@
, "pad_savedrevs.js"
, "pad_connectionstatus.js"
, "chat.js"
, "gritter.js"
, "vendors/gritter.js"
, "$js-cookie/src/js.cookie.js"
, "$tinycon/tinycon.js"
, "farbtastic.js"
, "vendors/farbtastic.js"
, "skin_variants.js"
, "socketio.js"
]
@ -28,7 +28,7 @@
, "colorutils.js"
, "draggable.js"
, "pad_utils.js"
, "browser.js"
, "vendors/browser.js"
, "pad_cookie.js"
, "pad_editor.js"
, "pad_editbar.js"
@ -49,7 +49,7 @@
]
, "ace2_inner.js": [
"ace2_inner.js"
, "browser.js"
, "vendors/browser.js"
, "AttributePool.js"
, "Changeset.js"
, "ChangesetUtils.js"
@ -68,11 +68,11 @@
]
, "ace2_common.js": [
"ace2_common.js"
, "browser.js"
, "jquery.js"
, "vendors/browser.js"
, "vendors/jquery.js"
, "rjquery.js"
, "$async.js"
, "underscore.js"
, "vendors/underscore.js"
, "$underscore.js"
, "$underscore/underscore.js"
, "security.js"

View File

@ -100,11 +100,11 @@
"ignorePatterns": [
"/static/js/admin/jquery.autosize.js",
"/static/js/admin/minify.json.js",
"/static/js/browser.js",
"/static/js/farbtastic.js",
"/static/js/gritter.js",
"/static/js/html10n.js",
"/static/js/jquery.js",
"/static/js/vendors/browser.js",
"/static/js/vendors/farbtastic.js",
"/static/js/vendors/gritter.js",
"/static/js/vendors/html10n.js",
"/static/js/vendors/jquery.js",
"/static/js/vendors/nice-select.js",
"/tests/frontend/lib/"
],

View File

@ -2,7 +2,7 @@
const Changeset = require('./Changeset');
const ChangesetUtils = require('./ChangesetUtils');
const _ = require('./underscore');
const _ = require('./vendors/underscore');
const lineMarkerAttribute = 'lmkr';

View File

@ -18,7 +18,7 @@
*/
let documentAttributeManager;
const browser = require('./browser');
const browser = require('./vendors/browser');
const padutils = require('./pad_utils').padutils;
const Ace2Common = require('./ace2_common');
const $ = require('./rjquery').$;

View File

@ -28,7 +28,7 @@ const AttribPool = require('./AttributePool');
const Changeset = require('./Changeset');
const linestylefilter = require('./linestylefilter').linestylefilter;
const colorutils = require('./colorutils').colorutils;
const _ = require('./underscore');
const _ = require('./vendors/underscore');
const hooks = require('./pluginfw/hooks');
// These parameters were global, now they are injected. A reference to the

View File

@ -23,7 +23,7 @@
// These parameters were global, now they are injected. A reference to the
// Timeslider controller would probably be more appropriate.
const _ = require('./underscore');
const _ = require('./vendors/underscore');
const padmodals = require('./pad_modals').padmodals;
const colorutils = require('./colorutils').colorutils;

View File

@ -24,7 +24,7 @@
const chat = require('./chat').chat;
const hooks = require('./pluginfw/hooks');
const browser = require('./browser');
const browser = require('./vendors/browser');
// Dependency fill on init. This exists for `pad.socket` only.
// TODO: bind directly to the socket.

View File

@ -24,7 +24,7 @@
const Security = require('./security');
const hooks = require('./pluginfw/hooks');
const _ = require('./underscore');
const _ = require('./vendors/underscore');
const lineAttributeMarker = require('./linestylefilter').lineAttributeMarker;
const noop = () => {};

View File

@ -26,9 +26,9 @@ let socket;
// These jQuery things should create local references, but for now `require()`
// assigns to the global `$` and augments it with plugins.
require('./jquery');
require('./farbtastic');
require('./gritter');
require('./vendors/jquery');
require('./vendors/farbtastic');
require('./vendors/gritter');
const Cookies = require('./pad_utils').Cookies;
const chat = require('./chat').chat;

View File

@ -22,7 +22,7 @@
* limitations under the License.
*/
const browser = require('./browser');
const browser = require('./vendors/browser');
const hooks = require('./pluginfw/hooks');
const padutils = require('./pad_utils').padutils;
const padeditor = require('./pad_editor').padeditor;

View File

@ -1,5 +1,5 @@
'use strict';
// Provides a require'able version of jQuery without leaking $ and jQuery;
window.$ = require('./jquery');
window.$ = require('./vendors/jquery');
const jq = window.$.noConflict(true);
exports.jQuery = exports.$ = jq;

View File

@ -23,7 +23,7 @@
*/
const Ace2Common = require('./ace2_common');
const _ = require('./underscore');
const _ = require('./vendors/underscore');
const noop = Ace2Common.noop;

View File

@ -24,7 +24,7 @@
// These jQuery things should create local references, but for now `require()`
// assigns to the global `$` and augments it with plugins.
require('./jquery');
require('./vendors/jquery');
const Cookies = require('./pad_utils').Cookies;
const randomString = require('./pad_utils').randomString;

View File

@ -23,7 +23,7 @@
*/
const Changeset = require('./Changeset');
const _ = require('./underscore');
const _ = require('./vendors/underscore');
const undoModule = (() => {
const stack = (() => {

View File

@ -1,3 +1,7 @@
// WARNING: This file may have been modified from original.
// TODO: Check requirement of this file, this afaik was to cover weird edge cases
// that have probably been fixed in browsers.
/*!
* Bowser - a browser detector
* https://github.com/ded/bowser
@ -303,4 +307,4 @@
bowser._detect = detect;
return bowser
});
});

View File

@ -1,3 +1,6 @@
// WARNING: This file has been modified from original.
// TODO: Replace with https://github.com/Simonwep/pickr
// Farbtastic 2.0 alpha
// Original can be found at:
// https://github.com/mattfarina/farbtastic/blob/71ca15f4a09c8e5a08a1b0d1cf37ef028adf22f0/src/farbtastic.js

View File

@ -1,3 +1,5 @@
// WARNING: This file has been modified from the Original
/*
* Gritter for jQuery
* http://www.boedesign.com/

View File

@ -1,3 +1,5 @@
// WARNING: This file has been modified from the Original
/**
* Copyright (c) 2012 Marcel Klehr
* Copyright (c) 2011-2012 Fabien Cazenave, Mozilla

View File

@ -1,3 +1,6 @@
// WARNING: This file has been modified from the Original
// TODO: Nice Select seems relatively abandoned, we should consider other options.
/* jQuery Nice Select - v1.1.0
https://github.com/hernansartorio/jquery-nice-select
Made by Hernán Sartorio */
@ -60,14 +63,14 @@
.addClass($select.attr('class') || '')
.addClass($select.attr('disabled') ? 'disabled' : '')
.attr('tabindex', $select.attr('disabled') ? null : '0')
.html('<span class="current"></span><ul class="list thin-scrollbar"></ul>')
.html('<span class="current"></span><ul class="list"></ul>')
);
var $dropdown = $select.next();
var $options = $select.find('option');
var $selected = $select.find('option:selected');
$dropdown.find('.current').html($selected.data('display') || $selected.text());
$dropdown.find('.current').html($selected.data('display') || $selected.text());
$options.each(function(i) {
var $option = $(this);
@ -94,31 +97,12 @@
var $dropdown = $(this);
$('.nice-select').not($dropdown).removeClass('open');
$dropdown.toggleClass('open');
if ($dropdown.hasClass('open')) {
$dropdown.find('.option');
$dropdown.find('.focus').removeClass('focus');
$dropdown.find('.selected').addClass('focus');
if ($dropdown.closest('.toolbar').length > 0) {
$dropdown.find('.list').css('left', $dropdown.offset().left);
$dropdown.find('.list').css('top', $dropdown.offset().top + $dropdown.outerHeight());
$dropdown.find('.list').css('min-width', $dropdown.outerWidth() + 'px');
}
$listHeight = $dropdown.find('.list').outerHeight();
$top = $dropdown.parent().offset().top;
$bottom = $('body').height() - $top;
$maxListHeight = $bottom - $dropdown.outerHeight() - 20;
if ($maxListHeight < 200) {
$dropdown.addClass('reverse');
$maxListHeight = 250;
} else {
$dropdown.removeClass('reverse')
}
$dropdown.find('.list').css('max-height', $maxListHeight + 'px');
} else {
$dropdown.focus();
}
@ -206,4 +190,4 @@
};
}(jQuery));
}(jQuery));

View File

@ -4,10 +4,10 @@
<title data-l10n-id="admin.page-title">Admin Dashboard - Etherpad</title>
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="../static/css/admin.css">
<script src="../static/js/jquery.js"></script>
<script src="../static/js/vendors/jquery.js"></script>
<script src="../socket.io/socket.io.js"></script>
<link rel="localizations" type="application/l10n+json" href="../locales.json" />
<script src="../static/js/html10n.js"></script>
<script src="../static/js/vendors/html10n.js"></script>
<script src="../static/js/l10n.js"></script>
</head>
<body>

View File

@ -5,7 +5,7 @@
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="../../static/css/admin.css">
<link rel="localizations" type="application/l10n+json" href="../../locales.json" />
<script src="../../static/js/html10n.js"></script>
<script src="../../static/js/vendors/html10n.js"></script>
<script src="../../static/js/l10n.js"></script>
</head>
<body>

View File

@ -4,12 +4,12 @@
<title data-l10n-id="admin_plugins.page-title">Plugin manager - Etherpad</title>
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="../static/css/admin.css">
<script src="../static/js/jquery.js"></script>
<script src="../static/js/vendors/jquery.js"></script>
<script src="../socket.io/socket.io.js"></script>
<script src="../static/js/socketio.js"></script>
<script src="../static/js/admin/plugins.js"></script>
<link rel="localizations" type="application/l10n+json" href="../locales.json" />
<script src="../static/js/html10n.js"></script>
<script src="../static/js/vendors/html10n.js"></script>
<script src="../static/js/l10n.js"></script>
</head>
<body>

View File

@ -4,14 +4,14 @@
<title data-l10n-id="admin_settings.page-title">Settings - Etherpad</title>
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="../static/css/admin.css">
<script src="../static/js/jquery.js"></script>
<script src="../static/js/vendors/jquery.js"></script>
<script src="../socket.io/socket.io.js"></script>
<script src="../static/js/socketio.js"></script>
<script src="../static/js/admin/minify.json.js"></script>
<script src="../static/js/admin/settings.js"></script>
<script src="../static/js/admin/jquery.autosize.js"></script>
<link rel="localizations" type="application/l10n+json" href="../locales.json" />
<script src="../static/js/html10n.js"></script>
<script src="../static/js/vendors/html10n.js"></script>
<script src="../static/js/l10n.js"></script>
</head>
<body>

View File

@ -11,9 +11,9 @@
<link rel="shortcut icon" href="<%=settings.favicon%>">
<link rel="localizations" type="application/l10n+json" href="locales.json">
<script type="text/javascript" src="static/js/html10n.js?v=<%=settings.randomVersionString%>"></script>
<script type="text/javascript" src="static/js/vendors/html10n.js?v=<%=settings.randomVersionString%>"></script>
<script type="text/javascript" src="static/js/l10n.js?v=<%=settings.randomVersionString%>"></script>
<script src="static/js/jquery.js"></script>
<script src="static/js/vendors/jquery.js"></script>
<script src="static/js/index.js"></script>
<style>

View File

@ -9,24 +9,24 @@
<body>
<table id="jslicense-labels1">
<tr>
<td><a href="/static/js/jquery-2.1.1.min.js">jquery-2.1.1.min.js</a></td>
<td><a href="/static/js/vendors/jquery-3.0.0.min.js">jquery-3.0.1.min.js</a></td>
<td><a href="http://www.jclark.com/xml/copying.txt">Expat</a></td>
<td><a href="/static/js/jquery.js">jquery.js</a></td>
<td><a href="/static/js/vendors/jquery.js">jquery.js</a></td>
</tr>
<tr>
<td><a href="/static/js/html10n.js">html10n.js</a></td>
<td><a href="/static/js/vendors/html10n.js">html10n.js</a></td>
<td><a href="http://www.jclark.com/xml/copying.txt">Expat</a></td>
<td><a href="/static/js/html10n.js">html10n.js</a></td>
<td><a href="/static/js/vendors/html10n.js">html10n.js</a></td>
</tr>
<tr>
<td><a href="/static/js/l10n.js">l10n.js</a></td>
<td><a href="/static/js/vendors/l10n.js">l10n.js</a></td>
<td><a href="http://www.apache.org/licenses/LICENSE-2.0">Apache-2.0-only</a></td>
<td><a href="/static/js/l10n.js">l10n.js</a></td>
<td><a href="/static/js/vendors/l10n.js">l10n.js</a></td>
</tr>
<tr>
<td><a href="/static/js/socket.io.js">socket.io.js</a></td>
<td><a href="/static/js/vendors/socket.io.js">socket.io.js</a></td>
<td><a href="http://www.jclark.com/xml/copying.txt">Expat</a></td>
<td><a href="/static/js/socket.io.js">socket.io.js</a></td>
<td><a href="/static/js/vendors/socket.io.js">socket.io.js</a></td>
</tr>
<tr>
<td><a href="/static/js/require-kernel.js">require-kernel.js</a></td>

View File

@ -52,7 +52,7 @@
<% e.end_block(); %>
<link rel="localizations" type="application/l10n+json" href="../locales.json" />
<script type="text/javascript" src="../static/js/html10n.js?v=<%=settings.randomVersionString%>"></script>
<script type="text/javascript" src="../static/js/vendors/html10n.js?v=<%=settings.randomVersionString%>"></script>
<script type="text/javascript" src="../static/js/l10n.js?v=<%=settings.randomVersionString%>"></script>
<!-- head and body had been removed intentionally -->
@ -494,7 +494,7 @@
require.setGlobalKeyPath("require");
$ = jQuery = require('ep_etherpad-lite/static/js/rjquery').jQuery; // Expose jQuery #HACK
browser = require('ep_etherpad-lite/static/js/browser');
browser = require('ep_etherpad-lite/static/js/vendors/browser');
var plugins = require('ep_etherpad-lite/static/js/pluginfw/client_plugins');
var hooks = require('ep_etherpad-lite/static/js/pluginfw/hooks');

View File

@ -45,7 +45,7 @@
<link rel="localizations" type="application/l10n+json" href="../../locales.json" />
<% e.begin_block("timesliderScripts"); %>
<script type="text/javascript" src="../../static/js/html10n.js?v=<%=settings.randomVersionString%>"></script>
<script type="text/javascript" src="../../static/js/vendors/html10n.js?v=<%=settings.randomVersionString%>"></script>
<script type="text/javascript" src="../../static/js/l10n.js?v=<%=settings.randomVersionString%>"></script>
<% e.end_block(); %>
</head>
@ -278,7 +278,7 @@
require.setGlobalKeyPath("require");
$ = jQuery = require('ep_etherpad-lite/static/js/rjquery').jQuery; // Expose jQuery #HACK
browser = require('ep_etherpad-lite/static/js/browser');
browser = require('ep_etherpad-lite/static/js/vendors/browser');
var plugins = require('ep_etherpad-lite/static/js/pluginfw/client_plugins');
var socket = require('ep_etherpad-lite/static/js/timeslider').socket;

View File

@ -7,7 +7,7 @@ const helper = {};
const jsLibraries = {};
helper.init = (cb) => {
$.get('/static/js/jquery.js').done((code) => {
$.get('/static/js/vendors/jquery.js').done((code) => {
// make sure we don't override existing jquery
jsLibraries.jquery = `if(typeof $ === 'undefined') {\n${code}\n}`;

View File

@ -9,8 +9,8 @@
<div id="mocha"></div>
<div id="iframe-container"></div>
<script src="/static/js/jquery.js"></script>
<script src="/static/js/browser.js"></script>
<script src="/static/js/vendors/jquery.js"></script>
<script src="/static/js/vendors/browser.js"></script>
<script src="lib/underscore.js"></script>
<script src="lib/mocha.js"></script>
@ -20,7 +20,7 @@
<script src="helper.js"></script>
<script src="helper/methods.js"></script>
<script src="helper/ui.js"></script>
<script src="specs_list.js"></script>
<script src="runner.js"></script>
</html>