posit-dev / r-shinylive

https://posit-dev.github.io/r-shinylive/
Other
147 stars 15 forks source link

feat: Choose asset version at export #91

Closed gadenbuie closed 1 month ago

gadenbuie commented 1 month ago

Adds a new assets_version argument to export() that then propagates throughout the export process. This makes it possible to use shinylive::export() with asset versions other than the one currently used by default in the package.

The primary use case was to allow me to use the 0.4.1 assets even though the package is currently tied to 0.3.0. I used this to be able to use the preview version of shinylive with the wasm package library before it was officially tied to the package.

With this change assets_version() reports the current default version used by the package. Users may either set assets_version when calling export() or they may use the SHINYLIVE_ASSETS_VERSION envvar to achieve the same thing. The envvar is necessary for CI environments where it's easy to set this variable but hard to provide a version to the right function call, which is hidden from the user inside a GitHub workflow.

Note that setting assets_version is enough, assets_ensure() will find the require assets version and download it as necessary.

We don't currently do minimum version checking; in the future we would still update the default assets version used by the package. If we ever have a breaking change where the r-shinylive package would be incompatible with older versions, we could include a version check in a central place, probably in assets_ensure().