Closed aronatkins closed 3 months ago
Out of curiosity: I have only been loosely following the Connect-side changes for Quarto R scripts. I know we have kicked around the idea of an "R script" content type; is this substantially different for how we think that'd function?
This uses Quarto to run the script because that gives us very opinionated ways of capturing output, attaching resources, etc. This may not be enough for some folks, but is much less invasive than rewriting an R script into an R Markdown document, for example.
A rendered script
script.R
might look like:It may or may not have an accompanying
_quarto.yml
file. A simple version of the Quarto configuration might look like:script.R
is identified as quarto-static byrsconnect::writeManifest()
andrsconnect::deployApp()
.script.R
and_quarto.yml
is identified as quarto-static byrsconnect::writeManifest()
andrsconnect::deployApp()
.Other changes
This work also necessitated a change to how we bundle content. In particular, RStudio is able to run and deploy Shiny single-file applications which are contained in files not named
app.R
. For example, if we create a project containing the default Geyser app and save it tonotapp.R
rather thanapp.R
, RStudio can deploy that file. It is able to deploy the Shiny application becausenotapp.R
is renamed toapp.R
when the content is bundled.The action taken by RStudio is effectively:
This forces rsconnect to treat the content as a Shiny application and also forces the rename of
notapp.R
toapp.R
.Prior to this change, rsconnect would rewrite any
appPrimaryDoc=*.R
toapp.R
regardless of content type. Unfortunately,appPrimaryDoc
is computed internally and used by Quarto content. Because that primary asset was an R script, bundling renamed it. To avoid this, the rename is now specific to Shiny content.Test that RStudio can deploy a Shiny application in a
notapp.R
file. Download that deployed bundle and see that the application has been renamed toapp.R
.Other types of content (e.g., Plumber APIs, Quarto rendered scripts) do not have their R scripts renamed when deployed.