mirror of
https://github.com/overleaf/overleaf.git
synced 2025-03-15 04:14:47 +00:00
Merge pull request #333 from sharelatex/support-package-versions
Support package versions
This commit is contained in:
commit
2d1a0b34d5
9 changed files with 52 additions and 27 deletions
|
@ -1,4 +1,5 @@
|
|||
fs = require "fs"
|
||||
PackageVersions = require "./app/coffee/infrastructure/PackageVersions"
|
||||
|
||||
module.exports = (grunt) ->
|
||||
grunt.loadNpmTasks 'grunt-contrib-coffee'
|
||||
|
@ -157,12 +158,12 @@ module.exports = (grunt) ->
|
|||
inlineText: false
|
||||
preserveLicenseComments: false
|
||||
paths:
|
||||
"moment": "libs/moment-2.9.0"
|
||||
"moment": "libs/#{PackageVersions.lib('moment')}"
|
||||
"mathjax": "/js/libs/mathjax/MathJax.js?config=TeX-AMS_HTML"
|
||||
"libs/pdf": "libs/pdfjs-1.3.91p1/pdf"
|
||||
"libs/pdf": "libs/#{PackageVersions.lib('pdfjs')}/pdf"
|
||||
shim:
|
||||
"libs/pdf":
|
||||
deps: ["libs/pdfjs-1.3.91p1/compatibility"]
|
||||
deps: ["libs/#{PackageVersions.lib('pdfjs')}/compatibility"]
|
||||
|
||||
skipDirOptimize: true
|
||||
modules: [
|
||||
|
|
|
@ -19,6 +19,7 @@ ProjectUpdateHandler = require("./ProjectUpdateHandler")
|
|||
ProjectGetter = require("./ProjectGetter")
|
||||
PrivilegeLevels = require("../Authorization/PrivilegeLevels")
|
||||
AuthenticationController = require("../Authentication/AuthenticationController")
|
||||
PackageVersions = require("../../infrastructure/PackageVersions")
|
||||
|
||||
module.exports = ProjectController =
|
||||
|
||||
|
@ -333,7 +334,7 @@ defaultSettingsForAnonymousUser = (user_id)->
|
|||
|
||||
THEME_LIST = []
|
||||
do generateThemeList = () ->
|
||||
files = fs.readdirSync __dirname + '/../../../../public/js/ace'
|
||||
files = fs.readdirSync __dirname + '/../../../../public/js/' + PackageVersions.lib('ace')
|
||||
for file in files
|
||||
if file.slice(-2) == "js" and file.match(/^theme-/)
|
||||
cleanName = file.slice(0,-3).slice(6)
|
||||
|
|
|
@ -10,17 +10,18 @@ _ = require("underscore")
|
|||
async = require("async")
|
||||
Modules = require "./Modules"
|
||||
Url = require "url"
|
||||
|
||||
PackageVersions = require "./PackageVersions"
|
||||
fingerprints = {}
|
||||
Path = require 'path'
|
||||
|
||||
|
||||
jsPath =
|
||||
if Settings.useMinifiedJs
|
||||
"/minjs/"
|
||||
else
|
||||
"/js/"
|
||||
|
||||
ace = PackageVersions.lib('ace')
|
||||
pdfjs = PackageVersions.lib('pdfjs')
|
||||
|
||||
getFileContent = (filePath)->
|
||||
filePath = Path.join __dirname, "../../../", "public#{filePath}"
|
||||
|
@ -38,10 +39,10 @@ pathList = [
|
|||
["#{jsPath}ide.js"]
|
||||
["#{jsPath}main.js"]
|
||||
["#{jsPath}libs.js"]
|
||||
["#{jsPath}ace/ace.js","#{jsPath}ace/mode-latex.js", "#{jsPath}ace/snippets/latex.js"]
|
||||
["#{jsPath}libs/pdfjs-1.3.91p1/pdf.js"]
|
||||
["#{jsPath}libs/pdfjs-1.3.91p1/pdf.worker.js"]
|
||||
["#{jsPath}libs/pdfjs-1.3.91p1/compatibility.js"]
|
||||
["#{jsPath}#{ace}/ace.js","#{jsPath}#{ace}/mode-latex.js", "#{jsPath}#{ace}/snippets/latex.js"]
|
||||
["#{jsPath}libs/#{pdfjs}/pdf.js"]
|
||||
["#{jsPath}libs/#{pdfjs}/pdf.worker.js"]
|
||||
["#{jsPath}libs/#{pdfjs}/compatibility.js"]
|
||||
["/stylesheets/style.css"]
|
||||
]
|
||||
|
||||
|
@ -92,6 +93,7 @@ module.exports = (app, webRouter, apiRouter)->
|
|||
|
||||
res.locals.jsPath = jsPath
|
||||
res.locals.fullJsPath = Url.resolve(staticFilesBase, jsPath)
|
||||
res.locals.lib = PackageVersions.lib
|
||||
|
||||
res.locals.buildJsPath = (jsFile, opts = {})->
|
||||
path = Path.join(jsPath, jsFile)
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
version = {
|
||||
"pdfjs": "1.3.91p1"
|
||||
"moment": "2.9.0"
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
version: version
|
||||
|
||||
lib: (name) ->
|
||||
if version[name]?
|
||||
return "#{name}-#{version[name]}"
|
||||
else
|
||||
return "#{name}"
|
||||
}
|
|
@ -126,7 +126,12 @@ html(itemscope, itemtype='http://schema.org/Product')
|
|||
window.requirejs = {
|
||||
"urlArgs" : "fingerprint=#{fingerprint(jsPath + 'main.js')}-#{fingerprint(jsPath + 'libs.js')}",
|
||||
"paths" : {
|
||||
"moment": "libs/moment-2.7.0"
|
||||
"moment": "libs/#{lib('moment')}"
|
||||
},
|
||||
"config":{
|
||||
"moment":{
|
||||
"noGlobal": true
|
||||
}
|
||||
}
|
||||
};
|
||||
script(
|
||||
|
|
|
@ -101,36 +101,37 @@ block content
|
|||
window.requirejs = {
|
||||
"paths" : {
|
||||
"mathjax": "#{buildJsPath('/libs/mathjax/MathJax.js', {cdn:false, fingerprint:false, qs:{config:'TeX-AMS_HTML'}})}",
|
||||
"moment": "libs/moment-2.7.0",
|
||||
"libs/pdf": "libs/pdfjs-1.3.91p1/pdf",
|
||||
"moment": "libs/#{lib('moment')}",
|
||||
"libs/pdf": "libs/#{lib('pdfjs')}/pdf",
|
||||
"ace": "#{lib('ace')}"
|
||||
},
|
||||
"urlArgs" : "fingerprint=#{fingerprint(jsPath + 'ide.js')}-#{fingerprint(jsPath + 'libs.js')}",
|
||||
"waitSeconds": 0,
|
||||
"shim": {
|
||||
"libs/pdf": {
|
||||
deps: ["libs/pdfjs-1.3.91p1/compatibility"]
|
||||
"deps": ["libs/#{lib('pdfjs')}/compatibility"]
|
||||
},
|
||||
"ace/ext-searchbox": {
|
||||
deps: ["ace/ace"]
|
||||
"deps": ["ace/ace"]
|
||||
},
|
||||
"ace/ext-language_tools": {
|
||||
deps: ["ace/ace"]
|
||||
"deps": ["ace/ace"]
|
||||
}
|
||||
},
|
||||
config:{
|
||||
moment:{
|
||||
noGlobal: true
|
||||
"config":{
|
||||
"moment":{
|
||||
"noGlobal": true
|
||||
}
|
||||
}
|
||||
};
|
||||
window.aceFingerprint = "#{fingerprint(jsPath + 'ace/ace.js')}"
|
||||
window.aceFingerprint = "#{fingerprint(jsPath + lib('ace') + '/ace.js')}"
|
||||
|
||||
- locals.suppressDefaultJs = true
|
||||
|
||||
- var pdfPath = 'libs/pdfjs-1.3.91p1/pdf.worker.js'
|
||||
- var pdfPath = "libs/" + lib('pdfjs') + "/pdf.worker.js"
|
||||
- var fingerprintedPath = fingerprint(jsPath+pdfPath)
|
||||
- var pdfJsWorkerPath = buildJsPath(pdfPath, {cdn:false,qs:{fingerprint:fingerprintedPath}}) // don't use worker for cdn
|
||||
- var aceWorkerPath = user.betaProgram ? buildJsPath("ace", {cdn:false,fingerprint:false}) : "" // don't use worker for cdn
|
||||
- var aceWorkerPath = user.betaProgram ? buildJsPath(lib('ace'), {cdn:false,fingerprint:false}) : "" // don't use worker for cdn
|
||||
|
||||
script(type='text/javascript').
|
||||
window.pdfJsWorkerPath = "#{pdfJsWorkerPath}";
|
||||
|
@ -139,7 +140,7 @@ block content
|
|||
script(
|
||||
data-main=buildJsPath("ide.js", {fingerprint:false}),
|
||||
baseurl=fullJsPath,
|
||||
data-ace-base=buildJsPath('ace', {fingerprint:false}),
|
||||
data-ace-base=buildJsPath(lib('ace'), {fingerprint:false}),
|
||||
src=buildJsPath('libs/require.js')
|
||||
)
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
define [
|
||||
"base"
|
||||
"libs/moment-2.9.0"
|
||||
"moment"
|
||||
], (App, moment) ->
|
||||
moment.locale "en", calendar:
|
||||
lastDay : '[Yesterday]'
|
||||
|
@ -16,4 +16,4 @@ define [
|
|||
|
||||
App.filter "relativeDate", () ->
|
||||
(date) ->
|
||||
moment(date).calendar()
|
||||
moment(date).calendar()
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
define [
|
||||
"moment"
|
||||
"ide/track-changes/controllers/TrackChangesListController"
|
||||
"ide/track-changes/controllers/TrackChangesDiffController"
|
||||
"ide/track-changes/directives/infiniteScroll"
|
||||
], () ->
|
||||
], (moment) ->
|
||||
class TrackChangesManager
|
||||
constructor: (@ide, @$scope) ->
|
||||
@reset()
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
define [
|
||||
"libs/moment-2.9.0"
|
||||
"moment"
|
||||
"libs/angular-autocomplete/angular-autocomplete"
|
||||
"libs/ui-bootstrap"
|
||||
"libs/ng-context-menu-0.1.4"
|
||||
|
|
Loading…
Reference in a new issue