-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCodebookGenerator_Deploy.qmd
More file actions
30 lines (24 loc) · 972 Bytes
/
CodebookGenerator_Deploy.qmd
File metadata and controls
30 lines (24 loc) · 972 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
---
title: "Render the codebook generator app using shiny live"
format: html
editor: visual
---
```{r}
library(shinylive)
library(here)
project_root <- here()
staging_dir <- file.path(tempdir(), "codebook_shinylive")
# Clean + recreate the staging directory
if (dir.exists(staging_dir)) unlink(staging_dir, recursive = TRUE, force = TRUE)
dir.create(staging_dir, recursive = TRUE)
# Copy only runtime files
file.copy(file.path(project_root, "app.R"), staging_dir, overwrite = TRUE)
dir.create(file.path(staging_dir, "www"), showWarnings = FALSE)
file.copy(list.files(file.path(project_root, "www"), full.names = TRUE),
file.path(staging_dir, "www"), recursive = TRUE, overwrite = TRUE)
# (Optional) include lightweight docs/metadata
file.copy(file.path(project_root, "README.md"), staging_dir, overwrite = TRUE)
# Export the staged mini-app
output_dir <- file.path(project_root, "WebApp")
shinylive::export(appdir = staging_dir, destdir = output_dir)
```