Skip to content

Legacy code #26

Description

@rpodcast

Assorted functions that we are removing from the eCTD bundle are below. Most of these were associated with building a pre-compiled version of the web-assembly bundle, which has been removed due to feedback from our FDA reviewers.

app_dir_exists <- function(dir = "_site") {
  fs::dir_exists(dir) && length(fs::dir_ls(dir) > 0)
}

create_ectd_bundle <- function(archive_name = "r4app.zip") {
  archive::archive_write_files(
    archive = fs::path("ectd_bundle", archive_name),
    files = c(
      fs::dir_ls("app", recurse = TRUE),
      fs::dir_ls("app_bundle", recurse = TRUE),
      "renv/.gitignore",
      "renv/activate.R",
      "renv/settings.json",
      "utils.R",
      "renv.lock",
      "submissions-pilot4-webr.Rproj",
      ".Rprofile"
    ),
    format = "zip"
  )
  invisible(TRUE)
}

create_app_bundle <- function(archive_name = "shinyapp.zip", dir_build = "_site") {
  if (!app_dir_exists(dir_build)) {
    build_app()
  }
  archive::archive_write_files(
    archive = fs::path("app_bundle", archive_name),
    files = c(
      fs::dir_ls("_site", recurse = TRUE)
    ),
    format = "zip"
  )
  invisible(TRUE)
}

extract_app_bundle <- function(archive_name = "shinyapp.zip", dir_build = "_site", overwrite = TRUE) {
  if (isTRUE(overwrite) && fs::dir_exists(dir_build)) {
    fs::dir_delete(dir_build)
  }
  archive::archive_extract(
    archive = fs::path("app_bundle", archive_name),
    dir = "."
  )
  invisible(TRUE)
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions