
Update safe-to-overwrite files in an existing shinyplanr deployment project
Source:R/create_template.R
update_shinyplanr_template.RdRefreshes the files in a deployment project that are safe to overwrite without losing any user customisations. Call this after upgrading the shinyplanr package to pick up changes to the install script, app entry point, deployment script, and any new content template files.
Arguments
- project_dir
Character. Path to the deployment project root (the directory containing
app.Rand thesetup/folder). Defaults to the current working directory.- country
Character. The country/region name used when the project was created. Used to re-stamp
deploy.Rwith the correctappName. IfNULL(default), the function attempts to infer it from the existingdeploy.Rfile; if that fails it uses"MyRegion"and emits a warning.- oceandatr
Logical. Whether the project uses oceandatr. Passed to
1_setup_enviro.Rto include the oceandatr/spatialgridr install lines. Defaults toTRUE.
What is updated
setup/1_setup_enviro.RAlways overwritten. Contains the package install list, which changes when shinyplanr adds or removes dependencies. Any extra packages you need should be in
setup/packages_extra.R(never overwritten).app.RAlways overwritten. This is a 3-line thin wrapper that calls
load_config()andrun_app(). It should never need user edits.deploy.RAlways overwritten. Contains deployment instructions and the
rsconnect::deployApp()call. TheappNameis re-stamped fromcountry.setup/content/*.mdNew template files only. Existing files are never overwritten, preserving your edited text content.
What is NEVER updated
setup/2_setup_data.RYour spatial data pipeline.
setup/3_setup_app.RYour app configuration (options, Dict path, logos, module switches, CRS, etc.). If a shinyplanr upgrade changes the config schema,
load_config()will print a changelog describing exactly what to add manually.setup/Dict_Feature.csvYour feature dictionary.
setup/packages_extra.RYour additional package installs.
setup/logos/Your logo image files.
setup/content/*.md(existing)Your edited text content.
config/shinyplanr_config.rdsRegenerated by
3_setup_app.R, not by this function.