Merge pull request #15629 from overleaf/ae-web-target

Use production `web` dependencies for development

GitOrigin-RevId: e89942d1a24c32bf60b319932c6d74905db74a19
This commit is contained in:
Alf Eaton 2023-11-07 11:52:06 +00:00 committed by Copybot
parent 54c55360c4
commit 3912de589f
4 changed files with 20 additions and 19 deletions

View file

@ -36,6 +36,13 @@ ENV CYPRESS_INSTALL_BINARY=0
RUN cd /overleaf && npm install
# the web image with only production dependencies but no webpack production build, for development
FROM deps-prod as app-only
COPY services/web /overleaf/services/web
USER node
CMD ["node", "--expose-gc", "app.js"]
# the dev is suitable for running tests
FROM deps as dev

View file

@ -196,11 +196,7 @@ module.exports = function (webRouter, privateApiRouter, publicApiRouter) {
}
)}`
res.locals.mathJax3Path = `/js/libs/mathjax3/es5/tex-svg-full.js?${querystring.stringify(
{
v: PackageVersions.version['mathjax-3'],
}
)}`
res.locals.mathJax3Path = `/js/libs/mathjax-3-${PackageVersions.version['mathjax-3']}/es5/tex-svg-full.js`
res.locals.lib = PackageVersions.lib

View file

@ -1,8 +1,8 @@
const MATHJAX_STUB = `
window.MathJax = {
window.MathJax = {
startup: {
promise: Promise.resolve()
},
},
svgStylesheet: () => document.createElement("STYLE"),
typesetPromise: (elements) => {
for (const element of elements) {
@ -23,15 +23,10 @@ window.MathJax = {
`
export const interceptMathJax = () => {
// NOTE: this is just a URL to be intercepted with the stub, not the real (versioned) MathJax URL
const url = '/js/libs/mathjax-3/es5/tex-svg-full.js'
cy.window().then(win => {
win.metaAttributesCache.set(
'ol-mathJax3Path',
'/js/libs/mathjax3/es5/tex-svg-full.js'
)
win.metaAttributesCache.set('ol-mathJax3Path', url)
})
cy.intercept(
'GET',
'/js/libs/mathjax3/es5/tex-svg-full.js*',
MATHJAX_STUB
).as('mathjax-load-request')
cy.intercept('GET', url, MATHJAX_STUB).as('mathjax-load-request')
}

View file

@ -284,17 +284,20 @@ module.exports = {
// https://www.npmjs.com/package/mathjax#user-content-hosting-your-own-copy-of-the-mathjax-components
{
from: 'es5/tex-svg-full.js',
to: 'js/libs/mathjax3/es5',
to: `js/libs/mathjax-3-${PackageVersions.version['mathjax-3']}/es5`,
toType: 'dir',
context: mathjax3Dir,
},
{
from: 'es5/input/tex/extensions/**/*.js',
to: 'js/libs/mathjax3',
to: `js/libs/mathjax-3-${PackageVersions.version['mathjax-3']}`,
toType: 'dir',
context: mathjax3Dir,
},
{
from: 'es5/ui/**/*',
to: 'js/libs/mathjax3',
to: `js/libs/mathjax-3-${PackageVersions.version['mathjax-3']}`,
toType: 'dir',
context: mathjax3Dir,
},
{ from: 'MathJax.js', to: 'js/libs/mathjax', context: mathjaxDir },