Skip to content

Commit

Permalink
Only when exporting an app should we remove the python files.
Browse files Browse the repository at this point in the history
This will cause a warning in the console. but it does not hurt anything
  • Loading branch information
schloerke committed Sep 12, 2023
1 parent 51949a8 commit 4d21018
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
12 changes: 7 additions & 5 deletions R/deps.R
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ serviceworker_dep <- function(sw_dir) {
# """
shinylive_common_dep_htmldep <- function() {
assets_path <- assets_dir()
base_files <- shinylive_common_files()
# In quarto ext, keep support for python engine
base_files <- shinylive_common_files(remove_python_support = FALSE)

scripts <- list()
stylesheets <- list()
Expand Down Expand Up @@ -198,16 +199,17 @@ shinylive_common_dep_htmldep <- function() {
# Return a list of files that are base dependencies; in other words, the files
# that are always included in a Shinylive deployment.
# """
shinylive_common_files <- function() {
shinylive_common_files <- function(remove_python_support = FALSE) {
assets_ensure()

assets_dir <- assets_dir()
# `dir()` is 10x faster than `fs::dir_ls()`
common_files <- dir(assets_dir, recursive = TRUE)

# TODO-barret-future: Remove these files for lighter deployments.
# common_files <- common_files[!grepl("^shinylive/pyodide/", common_files)]
# common_files <- common_files[!grepl("^shinylive/pyright/", common_files)]
if (remove_python_support) {
common_files <- common_files[!grepl("^shinylive/pyodide/", common_files)]
common_files <- common_files[!grepl("^shinylive/pyright/", common_files)]
}
common_files <- common_files[!grepl("^scripts/", common_files)]
common_files <- common_files[!grepl("^export_template/", common_files)]
common_files <- setdiff(common_files, "shinylive/examples.json")
Expand Down
3 changes: 2 additions & 1 deletion R/export.R
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ export <- function(
verbose_print(
"Copying base Shinylive files from ", assets_path, "/ to ", destdir, "/"
)
base_files <- shinylive_common_files()
# When exporting, we know it is only an R app. So remove python support
base_files <- shinylive_common_files(remove_python_support = TRUE)
if (verbose) {
p <- progress::progress_bar$new(
format = "[:bar] :percent",
Expand Down

0 comments on commit 4d21018

Please sign in to comment.