shinyrPkgs
provides an example of deploying an app-package website with pkgdown
.
Install
Install the development version of shinyrPkgs
using pak
:
install.packages('pak')
pak::pak("mjfrigaard/shinyrPkgs")
Launch
pkgdown
setup
Install pkgdown
:
pak::pak('pkgdown')
Set up GitHub Actions:
usethis::use_pkgdown_github_pages()
Change the branches for the triggering event in .github/workflows/pkgdown.yml
to only trigger on the 17_pkgdown
branch:
Build site:
pkgdown::build_site_github_pages()
Add, commit, and push:
Deployed site
View the deployed site here: https://mjfrigaard.github.io/shinyrPkgs/
More information can be found on the Actions tab of the GitHub repo.
Tests
The tests/testthat/
folder contains unit, module, and system tests. The results from devtools::test()
should return the following (after adding the snapshots):
devtools::test()
ℹ Testing shinyrPkgs Loading required package: shiny ✔ | F W S OK | Context ✔ | 2 | app-feature-01 [14.9s] ⠏ | 0 | mod_scatter_display INFO [2024-05-30 06:46:02] [ START display = selected_vars initial values] INFO [2024-05-30 06:46:02] [ END display = selected_vars initial values] INFO [2024-05-30 06:46:02] [ START display = scatterplot[['alt']] = 'Plot object'] ⠙ | 2 | mod_scatter_display INFO [2024-05-30 06:46:03] [ END display = scatterplot[['alt']] = 'Plot object'] INFO [2024-05-30 06:46:03] [ START display = inputs() creates ggplot2 object] INFO [2024-05-30 06:46:03] [ END display = inputs() creates ggplot2 object] ✔ | 3 | mod_scatter_display ⠏ | 0 | mod_var_input INFO [2024-05-30 06:46:03] [ START var_inputs = initial returned()] INFO [2024-05-30 06:46:03] [ END var_inputs = initial returned()] INFO [2024-05-30 06:46:03] [ START var_inputs = updated returned()] INFO [2024-05-30 06:46:03] [ END var_inputs = updated returned()] ✔ | 2 | mod_var_input ⠏ | 0 | scatter_plot INFO [2024-05-30 06:46:03] [ START fixture = tidy_ggp2_movies.rds] INFO [2024-05-30 06:46:03] [ START fixture = tidy_ggp2_movies.rds] INFO [2024-05-30 06:46:03] [ START data = movies.rda] INFO [2024-05-30 06:46:03] [ END data = movies.rda] ✔ | 2 | scatter_plot ✔ | 1 | shinytest2 [8.4s] ══ Results ══════════════════════════════════════════════════════════════════ Duration: 24.1 s [ FAIL 0 | WARN 0 | SKIP 0 | PASS 10 ]
Movie review data application
shinyrPkgs
provides the code examples in for the Shiny App-Packages book and the Developing & Testing Your Shiny Application workshop provided at R in Pharma (2023). The original code and data for the Shiny app comes from the Building Web Applications with Shiny course.