Best practices for version-controlled shiny modules

Don't get me wrong, @ginberg, it's an interesting package. But while they do have suggestions on shiny modules to use, I don't see any discussion of how to incorporate/maintain modules that are version-controlled in repos other than the current app.

Let's say I have a version-controlled app named shinyAppA. If there is a module I want to use (say shinyModuleB from a company repository of modules maintained for branding/consistency) that is maintained in a separate git repo, it seems that I can do one of a few things:

  1. Copy the file directly into my current app. I can choose to track it in the local-app's git, but that does nothing to facilitate merging in upstream changes to the module; for that, I'd need to copy the whole file into place again and commit any changes. Granted, this is not hard, just seems odd. I think this workflow is why we have things like git submodule and git subtree (each with pros/cons).
  2. Reference the module upstream repo with git submodule or git subtree. The version of the module I'm currently using in shinyAppA is locked (i.e., it is not auto-updated ... a good thing, I think) but it is easy enough to update. Its changes are not tracked in my local-app's git logs, which is also a good thing.
  3. If the module is written as an R package, then I don't need to copy the file over at all: I can just reference the companymodules::shinyModuleB() package/function within the app (perhaps with library(companymodules)), and when I deploy with rsconnect::deployApp(...), it will look to install that package of modules onto the RSC server.

I'm thinking that number 3 is the best way to go (assuming the modules are available within packages). Since I'm currently in the position of writing both the app and modules to use across a spectrum of company shiny reports/dashboards, then I can control the package-ness of things.

Does that make sense? Am I missing something in periscope that discusses this aspect of shiny-app maintenance? I didn't read everything in the package, but the vignettes did not include key words/references that I was looking for with this topic in mind.

1 Like