From 7785c7b59e48783a9e0a14af9f9559fd246f712d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Alby?= Date: Wed, 31 Jul 2019 17:34:46 +0200 Subject: [PATCH] Merge pull request #2029 from overleaf/ta-build-main-recurly-3 Load Recurly JS Separately GitOrigin-RevId: 8baa2be76fa9d8a47676bc0bd0a80f4c05cc1600 --- services/web/Gruntfile.js | 3 --- services/web/Makefile | 8 ++++---- services/web/app/src/infrastructure/ExpressLocals.js | 1 - services/web/app/views/layout.pug | 3 +-- services/web/app/views/subscriptions/dashboard.pug | 8 ++------ services/web/app/views/subscriptions/new.pug | 8 +------- services/web/public/src/main-recurly.js | 8 -------- services/web/public/src/main.js | 2 ++ 8 files changed, 10 insertions(+), 31 deletions(-) delete mode 100644 services/web/public/src/main-recurly.js diff --git a/services/web/Gruntfile.js b/services/web/Gruntfile.js index 43e97850d5..210c715e8d 100644 --- a/services/web/Gruntfile.js +++ b/services/web/Gruntfile.js @@ -56,9 +56,6 @@ module.exports = function(grunt) { }, { name: 'ace/worker-latex' - }, - { - name: 'main-recurly' } ] } diff --git a/services/web/Makefile b/services/web/Makefile index ae9eafeb70..2b6ea548be 100644 --- a/services/web/Makefile +++ b/services/web/Makefile @@ -101,16 +101,16 @@ minify_css: $(CSS_FILES) minify_es: npm -q run webpack:production -compile: $(DIST_FILES) css public/js/main.js public/js/main-recurly.js public/js/ide.js +compile: $(DIST_FILES) css public/js/main.js public/js/ide.js @$(MAKE) compile_modules compile_full: $(BABEL) public/src --out-dir public/js $(BABEL) test/unit_frontend/src --out-dir test/unit_frontend/js - rm -f public/js/ide.js public/js/main.js public/js/main-recurly.js # We need to generate ide.js, main.js, main-recurly.js manually later + rm -f public/js/ide.js public/js/main.js # We need to generate ide.js, main.js, manually later $(MAKE) css_full $(MAKE) compile_modules_full - $(MAKE) compile # ide.js, main.js, main-recurly.js, share.js, and anything missed + $(MAKE) compile # ide.js, main.js, share.js, and anything missed compile_css_full: $(MAKE) css_full @@ -150,7 +150,7 @@ $(MODULE_MAKEFILES): Makefile.module clean: clean_frontend clean_css clean_tests clean_frontend: - rm -rf public/js/{analytics,directives,es,filters,ide,main,main-recurly,modules,services,utils} + rm -rf public/js/{analytics,directives,es,filters,ide,main,modules,services,utils} rm -f public/js/*.{js,map} clean_css: diff --git a/services/web/app/src/infrastructure/ExpressLocals.js b/services/web/app/src/infrastructure/ExpressLocals.js index bf3b03fdf9..1f7d4ff8b4 100644 --- a/services/web/app/src/infrastructure/ExpressLocals.js +++ b/services/web/app/src/infrastructure/ExpressLocals.js @@ -61,7 +61,6 @@ const pathList = [ `${jsPath}libs/require.js`, `${jsPath}ide.js`, `${jsPath}main.js`, - `${jsPath}main-recurly.js`, `${jsPath}libraries.js`, '/stylesheets/style.css', '/stylesheets/light-style.css', diff --git a/services/web/app/views/layout.pug b/services/web/app/views/layout.pug index f4facba041..774c357077 100644 --- a/services/web/app/views/layout.pug +++ b/services/web/app/views/layout.pug @@ -125,8 +125,7 @@ html( "moment": "libs/#{lib('moment')}", "fineuploader": "libs/#{lib('fineuploader')}", "main": "#{buildJsPath('main.js', {hashedPath:settings.useMinifiedJs, removeExtension:true})}", - "libraries": "#{buildJsPath('libraries.js', {hashedPath:settings.useMinifiedJs, removeExtension:true})}", - "recurly": "https://js.recurly.com/v4/recurly" + "libraries": "#{buildJsPath('libraries.js', {hashedPath:settings.useMinifiedJs, removeExtension:true})}" }, "config":{ "moment":{ diff --git a/services/web/app/views/subscriptions/dashboard.pug b/services/web/app/views/subscriptions/dashboard.pug index aaff0ec6f2..1e83fcce20 100644 --- a/services/web/app/views/subscriptions/dashboard.pug +++ b/services/web/app/views/subscriptions/dashboard.pug @@ -2,12 +2,8 @@ extends ../layout include ./dashboard/_team_name_mixin -block requirejs-init - script( - data-main=buildJsPath("main-recurly.js", {hashedPath:false}), - baseurl=fullJsPath, - src=buildJsPath('libs/require.js', {hashedPath:true}) - ) +block scripts + script(src="https://js.recurly.com/v4/recurly.js") block content .content.content-alt(ng-cloak) diff --git a/services/web/app/views/subscriptions/new.pug b/services/web/app/views/subscriptions/new.pug index ef61eae8a2..8da34d4b40 100644 --- a/services/web/app/views/subscriptions/new.pug +++ b/services/web/app/views/subscriptions/new.pug @@ -1,13 +1,7 @@ extends ../layout -block requirejs-init - script( - data-main=buildJsPath("main-recurly.js", {hashedPath:false}), - baseurl=fullJsPath, - src=buildJsPath('libs/require.js', {hashedPath:true}) - ) - block scripts + script(src="https://js.recurly.com/v4/recurly.js") script(type='text/javascript'). window.countryCode = '#{countryCode}' window.plan_code = '#{plan_code}' diff --git a/services/web/public/src/main-recurly.js b/services/web/public/src/main-recurly.js deleted file mode 100644 index aee2519791..0000000000 --- a/services/web/public/src/main-recurly.js +++ /dev/null @@ -1,8 +0,0 @@ -// main bundle plus recurly (loaded externaly from CDN) and all files requiring -// Recurly JS -define([ - 'main', - 'recurly', - 'main/subscription-dashboard', - 'main/new-subscription' -], function() {}) diff --git a/services/web/public/src/main.js b/services/web/public/src/main.js index 01f0b27374..db3b46f220 100644 --- a/services/web/public/src/main.js +++ b/services/web/public/src/main.js @@ -22,6 +22,8 @@ define([ 'main/bonus', 'main/system-messages', 'main/translations', + 'main/subscription-dashboard', + 'main/new-subscription', 'main/annual-upgrade', 'main/announcements', 'main/register-users',