From 476ead9051753910588815a59c148f8b5634fe5d Mon Sep 17 00:00:00 2001 From: Dmitry Bushev Date: Tue, 10 Aug 2021 12:47:12 +0300 Subject: [PATCH 1/3] fix: project cli flag --- src/js/lib/content/src/index.ts | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/js/lib/content/src/index.ts b/src/js/lib/content/src/index.ts index 353cd7b775..b63e9f9d99 100644 --- a/src/js/lib/content/src/index.ts +++ b/src/js/lib/content/src/index.ts @@ -955,20 +955,25 @@ API.main = async function(inputConfig: any) { config.updateFromObject(inputConfig) config.updateFromObject(urlConfig) + const runEntryPoint = async () => { + if (ok(config.project)) { + await mainEntryPoint(config) + } else { + await templates.loadTemplatesView((name: string) => { + config.project = name + mainEntryPoint(config) + }) + } + } + if (await checkMinSupportedVersion(config)) { if (config.authentication_enabled && !Versions.isDevVersion()) { new FirebaseAuthentication(function(user: any) { config.email = user.email - templates.loadTemplatesView((name: string) => { - config.project = name - mainEntryPoint(config) - }) + runEntryPoint() }) } else { - await templates.loadTemplatesView((name: string) => { - config.project = name - mainEntryPoint(config) - }) + await runEntryPoint() } } else { // Display a message asking to update the application. From 5a6a32843471aba37d99266579de953626510df5 Mon Sep 17 00:00:00 2001 From: Dmitry Bushev Date: Tue, 10 Aug 2021 12:53:47 +0300 Subject: [PATCH 2/3] misc: [ci no changelog needed] From 793ea673bad94ef9957b447fbb2a92d99ae79abf Mon Sep 17 00:00:00 2001 From: Dmitry Bushev Date: Fri, 13 Aug 2021 17:49:02 +0300 Subject: [PATCH 3/3] refactor: closure into function --- src/js/lib/content/src/index.ts | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/js/lib/content/src/index.ts b/src/js/lib/content/src/index.ts index b63e9f9d99..998f40f994 100644 --- a/src/js/lib/content/src/index.ts +++ b/src/js/lib/content/src/index.ts @@ -946,6 +946,17 @@ async function mainEntryPoint(config: Config) { } } +async function runEntryPoint(config: Config) { + if (ok(config.project)) { + await mainEntryPoint(config) + } else { + await templates.loadTemplatesView((name: string) => { + config.project = name + mainEntryPoint(config) + }) + } +} + API.main = async function(inputConfig: any) { const urlParams = new URLSearchParams(window.location.search) // @ts-ignore @@ -955,25 +966,14 @@ API.main = async function(inputConfig: any) { config.updateFromObject(inputConfig) config.updateFromObject(urlConfig) - const runEntryPoint = async () => { - if (ok(config.project)) { - await mainEntryPoint(config) - } else { - await templates.loadTemplatesView((name: string) => { - config.project = name - mainEntryPoint(config) - }) - } - } - if (await checkMinSupportedVersion(config)) { if (config.authentication_enabled && !Versions.isDevVersion()) { new FirebaseAuthentication(function(user: any) { config.email = user.email - runEntryPoint() + runEntryPoint(config) }) } else { - await runEntryPoint() + await runEntryPoint(config) } } else { // Display a message asking to update the application.