From d1f3499e5aafbb6281f46acf72674eef4534fba7 Mon Sep 17 00:00:00 2001 From: Kamil Zyla Date: Tue, 30 Jan 2024 10:28:08 +0100 Subject: [PATCH] refactor: Write out legacy entrypoint cases --- R/app.R | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/R/app.R b/R/app.R index 74b232d8..df2e3821 100644 --- a/R/app.R +++ b/R/app.R @@ -161,20 +161,28 @@ app <- function() { entrypoint <- read_config()$legacy_entrypoint if (identical(entrypoint, "app_dir")) { - return(shiny::shinyAppDir("app")) - } - - if (identical(entrypoint, "source")) { + shiny::shinyAppDir("app") + } else if (identical(entrypoint, "source")) { main <- new.env() source(fs::path("app", "main.R"), local = main) - } else { + shiny::shinyApp( + ui = with_head_tags(main$ui), + server = main$server + ) + } else if (identical(entrypoint, "box_top_level")) { main <- load_main_module() - if (!identical(entrypoint, "box_top_level")) { - main <- as_top_level(main) - } + shiny::shinyApp( + ui = with_head_tags(main$ui), + server = main$server + ) + } else if (is.null(entrypoint)) { + main <- load_main_module() + main <- as_top_level(main) + shiny::shinyApp( + ui = with_head_tags(main$ui), + server = main$server + ) + } else { + stop() } - shiny::shinyApp( - ui = with_head_tags(main$ui), - server = main$server - ) }