Merge pull request #2265 from overleaf/as-move-vendored-deps

Move vendored dependencies out of output directory

GitOrigin-RevId: bad086bdc2a80f9df5d3f934098cb7b05e8f6db5
This commit is contained in:
Alasdair Smith 2019-10-30 11:19:44 +00:00 committed by sharelatex
parent 4f637f14b5
commit 78c30015f4
668 changed files with 78 additions and 94 deletions

View file

@ -1,5 +1,4 @@
node_modules node_modules
modules/**/scripts modules/**/scripts
public/js public/src/vendor
public/minjs public/minjs
modules/**/public/js

View file

@ -1,5 +1,4 @@
node_modules node_modules
modules/**/scripts modules/**/scripts
public/js public/src/vendor
public/minjs public/minjs
modules/**/public/js

View file

@ -1053,7 +1053,11 @@ var defaultSettingsForAnonymousUser = userId => ({
var THEME_LIST = [] var THEME_LIST = []
function generateThemeList() { function generateThemeList() {
const files = fs.readdirSync( const files = fs.readdirSync(
Path.join(__dirname, '/../../../../public/js/', PackageVersions.lib('ace')) Path.join(
__dirname,
'/../../../../public/src/vendor/',
PackageVersions.lib('ace')
)
) )
const result = [] const result = []
for (let file of files) { for (let file of files) {

View file

@ -145,8 +145,11 @@ module.exports = function(webRouter, privateApiRouter, publicApiRouter) {
res.locals.buildJsPath = function(jsFile, opts = {}) { res.locals.buildJsPath = function(jsFile, opts = {}) {
// Resolve path from webpack manifest file // Resolve path from webpack manifest file
let path = webpackManifest[jsFile] let path = webpackManifest[jsFile]
// If not found in manifest, it is directly linked, so fallback to
// relevant public directory // HACK: If file can't be found within the webpack manifest, force url
// to be relative to JS asset directory.
// This should never happen in production, but it can happen in local
// testing if webpack hasn't compiled
if (!path) { if (!path) {
path = Path.join(jsPath, jsFile) path = Path.join(jsPath, jsFile)
} }
@ -162,6 +165,10 @@ module.exports = function(webRouter, privateApiRouter, publicApiRouter) {
return path return path
} }
res.locals.buildAssetsPath = function(path) {
return `${jsPath}/${path}`
}
res.locals.mathJaxPath = res.locals.buildJsPath('libs/mathjax/MathJax.js', { res.locals.mathJaxPath = res.locals.buildJsPath('libs/mathjax/MathJax.js', {
cdn: false, cdn: false,
qs: { config: 'TeX-AMS_HTML,Safe' } qs: { config: 'TeX-AMS_HTML,Safe' }

View file

@ -137,9 +137,9 @@ block content
window.wikiEnabled = #{!!(settings.apis.wiki && settings.apis.wiki.url)}; window.wikiEnabled = #{!!(settings.apis.wiki && settings.apis.wiki.url)};
window.gitBridgePublicBaseUrl = '#{gitBridgePublicBaseUrl}' window.gitBridgePublicBaseUrl = '#{gitBridgePublicBaseUrl}'
//- Set base path for Ace scripts loaded on demand/workers and don't use cdn //- Set base path for Ace scripts loaded on demand/workers and don't use cdn
window.aceBasePath = "#{buildJsPath(lib('ace'), {cdn:false})}" window.aceBasePath = "#{buildAssetsPath(lib('ace'))}"
//- Set path for PDFjs CMaps //- Set path for PDFjs CMaps
window.pdfCMapsPath = "#{buildJsPath('cmaps/', {cdn: false})}" window.pdfCMapsPath = "#{buildAssetsPath('cmaps/')}"
window.uiConfig = JSON.parse('!{StringHelper.stringifyJsonForScript(uiConfig)}'); window.uiConfig = JSON.parse('!{StringHelper.stringifyJsonForScript(uiConfig)}');
//- enable doc hash checking for all projects //- enable doc hash checking for all projects
//- used in public/js/libs/sharejs.js //- used in public/js/libs/sharejs.js

View file

@ -15,18 +15,17 @@ module.exports = function(config) {
files: [ files: [
'test/unit_frontend/bootstrap.js', 'test/unit_frontend/bootstrap.js',
// Include scripts that are injected into the page outside of webpack // Include scripts that are injected into the page outside of webpack
'public/js/libs/angular-1.6.4.min.js', 'public/src/vendor/libs/angular-1.6.4.min.js',
'public/js/libs/jquery-1.11.1.min.js', 'public/src/vendor/libs/jquery-1.11.1.min.js',
// Allow mocking of angular // Allow mocking of angular
'public/js/libs/angular-mocks.js', 'public/src/vendor/libs/angular-mocks.js',
// Import all tests (see comment in the file for why this is necessary) // Import all tests (see comment in the file for why this is necessary)
'test/unit_frontend/import_tests.js', 'test/unit_frontend/import_tests.js',
// Include CSS (there is some in js/libs dir) // Include CSS
'public/stylesheets/**/*.css', 'public/stylesheets/**/*.css'
'public/js/libs/**/*.css'
], ],
middleware: ['fake-img'], middleware: ['fake-img'],
preprocessors: { preprocessors: {

Binary file not shown.

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Some files were not shown because too many files have changed in this diff Show more