Skip to content

Make LightLogWeb shinylive-compatible and add export script#4

Open
JZauner wants to merge 2 commits intomainfrom
codex/update-package-for-shinylive-compatibility
Open

Make LightLogWeb shinylive-compatible and add export script#4
JZauner wants to merge 2 commits intomainfrom
codex/update-package-for-shinylive-compatibility

Conversation

@JZauner
Copy link
Contributor

@JZauner JZauner commented Feb 5, 2026

Motivation

  • Ensure the Shiny app can be bundled and run in Shinylive/browser environments by fixing resource path resolution and uploaded-file handling.
  • Provide a reproducible export workflow to produce a standalone Shinylive bundle in live/ for deployment or testing.

Description

  • Added resolve_www_path() in R/shinylive_paths.R to locate app/www either from an installed package or from local/export fallback locations and updated LightLogWeb() to use it via addResourcePath("extr", resolve_www_path()).
  • Hardened rename_files() in R/rename_files.R to attempt file.rename() and fall back to file.copy() with cleanup and an informative error if preparation fails, to support virtual/browser filesystems used by Shinylive.
  • Added scripts/export-shinylive.R, an executable R script that assembles package R/ sources and static assets into a temporary app folder, writes a minimal app.R entrypoint that sources the package code, and calls shinylive::export() to produce the live/ bundle.
  • Added package testing support by adding testthat (>= 3.0.0) to Suggests and Config/testthat/edition: 3, and introduced tests in tests/testthat/test-shinylive-paths.R and tests/testthat/test-rename-files.R plus tests/testthat.R.

Testing

  • Added automated tests: tests/testthat/test-shinylive-paths.R and tests/testthat/test-rename-files.R (no tests were executed in this environment).
  • Attempted to run Rscript -e 'if(requireNamespace("shinylive", quietly=TRUE)) print(args(shinylive::export)) else cat("no shinylive\n")' which failed because Rscript is not available in this environment, so package tests were not run here.
  • File-level verification: repository changes were committed successfully (git status --short clean after commit).

Codex Task

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines 44 to 46
"r_files <- list.files('R', pattern = '\\.[Rr]$', full.names = TRUE)",
"invisible(lapply(r_files, source, local = globalenv()))",
"LightLogWeb()"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant