Make LightLogWeb shinylive-compatible and add export script#4
Make LightLogWeb shinylive-compatible and add export script#4
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0609a9278f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
scripts/export-shinylive.R
Outdated
| "r_files <- list.files('R', pattern = '\\.[Rr]$', full.names = TRUE)", | ||
| "invisible(lapply(r_files, source, local = globalenv()))", | ||
| "LightLogWeb()" |
There was a problem hiding this comment.
Load package dependencies in generated app.R
The generated entrypoint only sources R/*.R and calls LightLogWeb(), but it never loads the packages that those sourced functions rely on via NAMESPACE imports (for example, LightLogWeb() in R/LightLogWeb-app.R calls addResourcePath(), page_navbar(), and shinyApp() without namespace qualifiers). In the clean Shinylive runtime this causes runtime errors like missing page_navbar/addResourcePath, so the exported bundle from this script can fail to start even though export itself succeeds.
Useful? React with 👍 / 👎.
Motivation
live/for deployment or testing.Description
resolve_www_path()inR/shinylive_paths.Rto locateapp/wwweither from an installed package or from local/export fallback locations and updatedLightLogWeb()to use it viaaddResourcePath("extr", resolve_www_path()).rename_files()inR/rename_files.Rto attemptfile.rename()and fall back tofile.copy()with cleanup and an informative error if preparation fails, to support virtual/browser filesystems used by Shinylive.scripts/export-shinylive.R, an executable R script that assembles packageR/sources and static assets into a temporary app folder, writes a minimalapp.Rentrypoint that sources the package code, and callsshinylive::export()to produce thelive/bundle.testthat (>= 3.0.0)toSuggestsandConfig/testthat/edition: 3, and introduced tests intests/testthat/test-shinylive-paths.Randtests/testthat/test-rename-files.Rplustests/testthat.R.Testing
tests/testthat/test-shinylive-paths.Randtests/testthat/test-rename-files.R(no tests were executed in this environment).Rscript -e 'if(requireNamespace("shinylive", quietly=TRUE)) print(args(shinylive::export)) else cat("no shinylive\n")'which failed becauseRscriptis not available in this environment, so package tests were not run here.git status --shortclean after commit).Codex Task