Load package imports in generated shinylive app entrypoint#6
Load package imports in generated shinylive app entrypoint#6
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4912711123
ℹ️ 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".
| parse_description_field(desc[1, "Depends"]), | ||
| parse_description_field(desc[1, "Imports"]) |
There was a problem hiding this comment.
Guard missing DESCRIPTION dependency fields
Handle absent Depends/Imports columns before indexing desc, because read.dcf() omits columns that are not present and desc[1, "Depends"] (or "Imports") then throws subscript out of bounds. In that case export_shinylive_bundle() fails before generating app.R, so repos that drop one of these fields (which is valid in DESCRIPTION) cannot be exported even though parse_description_field() already supports empty inputs.
Useful? React with 👍 / 👎.
Motivation
app.Rentrypoint sourcedR/*.Rand calledLightLogWeb()without attaching package imports listed inDESCRIPTION, causing runtime errors in a clean Shinylive environment for unqualified calls likepage_navbar()andaddResourcePath().Description
parse_description_field()to parse and clean package names fromDESCRIPTIONfields.package_dependencies_for_entrypoint()to extractDependsandImportsfromDESCRIPTIONand filter outRand the package itself.build_shinylive_entrypoint()and updatedexport_shinylive_bundle()so the generatedapp.Rfirst attaches dependencies withlibrary(..., character.only = TRUE), then sourcesR/*.R, and finally runsLightLogWeb().tests/testthat/test-export-shinylive-script.Rto cover DESCRIPTION parsing, dependency extraction/filtering, and that the generated entrypoint includes dependency loading.Testing
tests/testthat/test-export-shinylive-script.Rthat exerciseparse_description_field(),package_dependencies_for_entrypoint(), andbuild_shinylive_entrypoint()and verify expected output.Rscript/ package test execution is unavailable, so the new tests were not run here.Codex Task