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 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 # the dev is suitable for running tests
FROM deps as dev 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( res.locals.mathJax3Path = `/js/libs/mathjax-3-${PackageVersions.version['mathjax-3']}/es5/tex-svg-full.js`
{
v: PackageVersions.version['mathjax-3'],
}
)}`
res.locals.lib = PackageVersions.lib res.locals.lib = PackageVersions.lib

View file

@ -23,15 +23,10 @@ window.MathJax = {
` `
export const interceptMathJax = () => { 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 => { cy.window().then(win => {
win.metaAttributesCache.set( win.metaAttributesCache.set('ol-mathJax3Path', url)
'ol-mathJax3Path',
'/js/libs/mathjax3/es5/tex-svg-full.js'
)
}) })
cy.intercept( cy.intercept('GET', url, MATHJAX_STUB).as('mathjax-load-request')
'GET',
'/js/libs/mathjax3/es5/tex-svg-full.js*',
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 // https://www.npmjs.com/package/mathjax#user-content-hosting-your-own-copy-of-the-mathjax-components
{ {
from: 'es5/tex-svg-full.js', 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, context: mathjax3Dir,
}, },
{ {
from: 'es5/input/tex/extensions/**/*.js', from: 'es5/input/tex/extensions/**/*.js',
to: 'js/libs/mathjax3', to: `js/libs/mathjax-3-${PackageVersions.version['mathjax-3']}`,
toType: 'dir',
context: mathjax3Dir, context: mathjax3Dir,
}, },
{ {
from: 'es5/ui/**/*', from: 'es5/ui/**/*',
to: 'js/libs/mathjax3', to: `js/libs/mathjax-3-${PackageVersions.version['mathjax-3']}`,
toType: 'dir',
context: mathjax3Dir, context: mathjax3Dir,
}, },
{ from: 'MathJax.js', to: 'js/libs/mathjax', context: mathjaxDir }, { from: 'MathJax.js', to: 'js/libs/mathjax', context: mathjaxDir },