maintenance_page
Description
A default html page for maintenance mode
Usage
maintenance_page()maintenance_page()
Details
see the vignette vignette("f_extending_golem", package = "golem") for details.
Value
an html_document
| Title: | A Framework for Robust Shiny Applications |
|---|---|
| Description: | An opinionated framework for building a production-ready 'Shiny' application. This package contains a series of tools for building a robust 'Shiny' application from start to finish. |
| Authors: | Colin Fay [cre, aut] (ORCID: <https://orcid.org/0000-0001-7343-1846>), Vincent Guyader [aut] (ORCID: <https://orcid.org/0000-0003-0671-9270>, previous maintainer), Sébastien Rochette [aut] (ORCID: <https://orcid.org/0000-0002-1565-9313>), Cervan Girard [aut] (ORCID: <https://orcid.org/0000-0002-4816-4624>), Novica Nakov [ctb], David Granjon [ctb], Arthur Bréant [ctb], Antoine Languillaume [ctb], Ilya Zarubin [ctb], ThinkR [cph] |
| Maintainer: | Colin Fay <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.6.0.9000 |
| Built: | 2026-05-19 16:57:51 UTC |
| Source: | https://github.com/ThinkR-open/golem |
activate_js is used to insert directly some JavaScript functions in your golem.
By default bundle_ressources() load these function automatically for you.
activate_js() invoke_js(fun, ..., session = shiny::getDefaultReactiveDomain())activate_js() invoke_js(fun, ..., session = shiny::getDefaultReactiveDomain())
fun |
JS function to be invoked. |
... |
JSON-like messages to be sent to the triggered JS function |
session |
The shiny session within which to call
|
These JavaScript functions can be called from
the server with invoke_js. invoke_js can also be used
to launch any JS function created inside a Shiny JavaScript handler.
Used for side-effects.
if (interactive()) { library(shiny) ui <- fluidPage( golem::activate_js(), # already loaded in your golem by `bundle_resources()` fluidRow( actionButton(inputId = "hidebutton1", label = "hide button1"), actionButton(inputId = "showbutton1", label = "show button1"), actionButton(inputId = "button1", label = "button1") ), fluidRow( actionButton(inputId = "hideclassA", label = "hide class A"), actionButton(inputId = "showclassA", label = "show class A"), actionButton(inputId = "buttonA1", label = "button A1", class = "A"), actionButton(inputId = "buttonA2", label = "button A2", class = "A"), actionButton(inputId = "buttonA3", label = "button A3", class = "A") ), fluidRow( actionButton(inputId = "clickhide", label = "click on 'hide button1' and 'hide class A'"), actionButton(inputId = "clickshow", label = "click on 'show button1' and 'show class A'") ), fluidRow( actionButton(inputId = "disableA", label = "disable class A"), actionButton(inputId = "reableA", label = "reable class A") ), fluidRow( actionButton(inputId = "alertbutton", label = "alert button"), actionButton(inputId = "promptbutton", label = "prompt button"), actionButton(inputId = "confirmbutton", label = "confirm button") ) ) server <- function(input, output, session) { observeEvent(input$hidebutton1, { golem::invoke_js("hideid", "button1") }) observeEvent(input$showbutton1, { golem::invoke_js("showid", "button1") }) observeEvent(input$hideclassA, { golem::invoke_js("hideclass", "A") }) observeEvent(input$showclassA, { golem::invoke_js("showclass", "A") }) observeEvent(input$clickhide, { golem::invoke_js("clickon", "#hidebutton1") golem::invoke_js("clickon", "#hideclassA") }) observeEvent(input$clickshow, { golem::invoke_js("clickon", "#showbutton1") golem::invoke_js("clickon", "#showclassA") }) observeEvent(input$disableA, { golem::invoke_js("disable", ".A") }) observeEvent(input$reableA, { golem::invoke_js("reable", ".A") }) observeEvent(input$alertbutton, { golem::invoke_js("alert", "ALERT!!") }) observeEvent(input$promptbutton, { golem::invoke_js("prompt", list(message = "what's your name?", id = "name")) }) observeEvent(input$name, { message(paste("input$name", input$name)) }) observeEvent(input$confirmbutton, { golem::invoke_js("confirm", list(message = "Are you sure?", id = "sure")) }) observeEvent(input$sure, { message(paste("input$sure", input$sure)) }) } shinyApp(ui, server) }if (interactive()) { library(shiny) ui <- fluidPage( golem::activate_js(), # already loaded in your golem by `bundle_resources()` fluidRow( actionButton(inputId = "hidebutton1", label = "hide button1"), actionButton(inputId = "showbutton1", label = "show button1"), actionButton(inputId = "button1", label = "button1") ), fluidRow( actionButton(inputId = "hideclassA", label = "hide class A"), actionButton(inputId = "showclassA", label = "show class A"), actionButton(inputId = "buttonA1", label = "button A1", class = "A"), actionButton(inputId = "buttonA2", label = "button A2", class = "A"), actionButton(inputId = "buttonA3", label = "button A3", class = "A") ), fluidRow( actionButton(inputId = "clickhide", label = "click on 'hide button1' and 'hide class A'"), actionButton(inputId = "clickshow", label = "click on 'show button1' and 'show class A'") ), fluidRow( actionButton(inputId = "disableA", label = "disable class A"), actionButton(inputId = "reableA", label = "reable class A") ), fluidRow( actionButton(inputId = "alertbutton", label = "alert button"), actionButton(inputId = "promptbutton", label = "prompt button"), actionButton(inputId = "confirmbutton", label = "confirm button") ) ) server <- function(input, output, session) { observeEvent(input$hidebutton1, { golem::invoke_js("hideid", "button1") }) observeEvent(input$showbutton1, { golem::invoke_js("showid", "button1") }) observeEvent(input$hideclassA, { golem::invoke_js("hideclass", "A") }) observeEvent(input$showclassA, { golem::invoke_js("showclass", "A") }) observeEvent(input$clickhide, { golem::invoke_js("clickon", "#hidebutton1") golem::invoke_js("clickon", "#hideclassA") }) observeEvent(input$clickshow, { golem::invoke_js("clickon", "#showbutton1") golem::invoke_js("clickon", "#showclassA") }) observeEvent(input$disableA, { golem::invoke_js("disable", ".A") }) observeEvent(input$reableA, { golem::invoke_js("reable", ".A") }) observeEvent(input$alertbutton, { golem::invoke_js("alert", "ALERT!!") }) observeEvent(input$promptbutton, { golem::invoke_js("prompt", list(message = "what's your name?", id = "name")) }) observeEvent(input$name, { message(paste("input$name", input$name)) }) observeEvent(input$confirmbutton, { golem::invoke_js("confirm", list(message = "Are you sure?", id = "sure")) }) observeEvent(input$sure, { message(paste("input$sure", input$sure)) }) } shinyApp(ui, server) }
Build a container containing your Shiny App. add_dockerfile() and
add_dockerfile_with_renv() and add_dockerfile_with_renv() creates
a generic Dockerfile, while add_dockerfile_shinyproxy(),
add_dockerfile_with_renv_shinyproxy() , add_dockerfile_with_renv_shinyproxy() and
add_dockerfile_heroku() creates platform specific Dockerfile.
add_dockerfile( path = "DESCRIPTION", output = "Dockerfile", golem_wd = get_golem_wd(), from = paste0("rocker/verse:", R.Version()$major, ".", R.Version()$minor), as = NULL, port = 80, host = "0.0.0.0", sysreqs = TRUE, repos = c(CRAN = "https://cran.rstudio.com/"), expand = FALSE, open = TRUE, update_tar_gz = TRUE, build_golem_from_source = TRUE, extra_sysreqs = NULL, pkg ) add_dockerfile_shinyproxy( path = "DESCRIPTION", output = "Dockerfile", golem_wd = get_golem_wd(), from = paste0("rocker/verse:", R.Version()$major, ".", R.Version()$minor), as = NULL, sysreqs = TRUE, repos = c(CRAN = "https://cran.rstudio.com/"), expand = FALSE, open = TRUE, update_tar_gz = TRUE, build_golem_from_source = TRUE, extra_sysreqs = NULL, pkg ) add_dockerfile_heroku( path = "DESCRIPTION", output = "Dockerfile", golem_wd = get_golem_wd(), from = paste0("rocker/verse:", R.Version()$major, ".", R.Version()$minor), as = NULL, sysreqs = TRUE, repos = c(CRAN = "https://cran.rstudio.com/"), expand = FALSE, open = TRUE, update_tar_gz = TRUE, build_golem_from_source = TRUE, extra_sysreqs = NULL, pkg ) add_dockerfile_with_renv( golem_wd = get_golem_wd(), lockfile = NULL, output_dir = fs::path(tempdir(), "deploy"), distro = "focal", from = "rocker/verse", as = "builder", sysreqs = TRUE, port = 80, host = "0.0.0.0", repos = c(CRAN = "https://cran.rstudio.com/"), expand = FALSE, open = TRUE, document = TRUE, extra_sysreqs = NULL, update_tar_gz = TRUE, dockerfile_cmd = NULL, user = "rstudio", single_file = TRUE, set_golem.app.prod = TRUE, ..., source_folder ) add_dockerfile_with_renv_shinyproxy( golem_wd = get_golem_wd(), lockfile = NULL, output_dir = fs::path(tempdir(), "deploy"), distro = "focal", from = "rocker/verse", as = NULL, sysreqs = TRUE, repos = c(CRAN = "https://cran.rstudio.com/"), expand = FALSE, extra_sysreqs = NULL, open = TRUE, document = TRUE, update_tar_gz = TRUE, user = "rstudio", single_file = TRUE, set_golem.app.prod = TRUE, ..., source_folder ) add_dockerfile_with_renv_heroku( golem_wd = get_golem_wd(), lockfile = NULL, output_dir = fs::path(tempdir(), "deploy"), distro = "focal", from = "rocker/verse", as = NULL, sysreqs = TRUE, repos = c(CRAN = "https://cran.rstudio.com/"), expand = FALSE, extra_sysreqs = NULL, open = TRUE, document = TRUE, user = "rstudio", update_tar_gz = TRUE, single_file = TRUE, set_golem.app.prod = TRUE, ..., source_folder )add_dockerfile( path = "DESCRIPTION", output = "Dockerfile", golem_wd = get_golem_wd(), from = paste0("rocker/verse:", R.Version()$major, ".", R.Version()$minor), as = NULL, port = 80, host = "0.0.0.0", sysreqs = TRUE, repos = c(CRAN = "https://cran.rstudio.com/"), expand = FALSE, open = TRUE, update_tar_gz = TRUE, build_golem_from_source = TRUE, extra_sysreqs = NULL, pkg ) add_dockerfile_shinyproxy( path = "DESCRIPTION", output = "Dockerfile", golem_wd = get_golem_wd(), from = paste0("rocker/verse:", R.Version()$major, ".", R.Version()$minor), as = NULL, sysreqs = TRUE, repos = c(CRAN = "https://cran.rstudio.com/"), expand = FALSE, open = TRUE, update_tar_gz = TRUE, build_golem_from_source = TRUE, extra_sysreqs = NULL, pkg ) add_dockerfile_heroku( path = "DESCRIPTION", output = "Dockerfile", golem_wd = get_golem_wd(), from = paste0("rocker/verse:", R.Version()$major, ".", R.Version()$minor), as = NULL, sysreqs = TRUE, repos = c(CRAN = "https://cran.rstudio.com/"), expand = FALSE, open = TRUE, update_tar_gz = TRUE, build_golem_from_source = TRUE, extra_sysreqs = NULL, pkg ) add_dockerfile_with_renv( golem_wd = get_golem_wd(), lockfile = NULL, output_dir = fs::path(tempdir(), "deploy"), distro = "focal", from = "rocker/verse", as = "builder", sysreqs = TRUE, port = 80, host = "0.0.0.0", repos = c(CRAN = "https://cran.rstudio.com/"), expand = FALSE, open = TRUE, document = TRUE, extra_sysreqs = NULL, update_tar_gz = TRUE, dockerfile_cmd = NULL, user = "rstudio", single_file = TRUE, set_golem.app.prod = TRUE, ..., source_folder ) add_dockerfile_with_renv_shinyproxy( golem_wd = get_golem_wd(), lockfile = NULL, output_dir = fs::path(tempdir(), "deploy"), distro = "focal", from = "rocker/verse", as = NULL, sysreqs = TRUE, repos = c(CRAN = "https://cran.rstudio.com/"), expand = FALSE, extra_sysreqs = NULL, open = TRUE, document = TRUE, update_tar_gz = TRUE, user = "rstudio", single_file = TRUE, set_golem.app.prod = TRUE, ..., source_folder ) add_dockerfile_with_renv_heroku( golem_wd = get_golem_wd(), lockfile = NULL, output_dir = fs::path(tempdir(), "deploy"), distro = "focal", from = "rocker/verse", as = NULL, sysreqs = TRUE, repos = c(CRAN = "https://cran.rstudio.com/"), expand = FALSE, extra_sysreqs = NULL, open = TRUE, document = TRUE, user = "rstudio", update_tar_gz = TRUE, single_file = TRUE, set_golem.app.prod = TRUE, ..., source_folder )
path |
path to the DESCRIPTION file to use as an input. |
output |
name of the Dockerfile output. |
golem_wd |
path to the Package/golem source folder to deploy.
default is retrieved via |
from |
The FROM of the Dockerfile. Default is FROM rocker/verse without renv.lock file passed `R.Version()$major`.`R.Version()$minor` is used as tag |
as |
The AS of the Dockerfile. Default it NULL. |
port |
The |
host |
The |
sysreqs |
boolean. If TRUE, RUN statements to install packages system requirements will be included in the Dockerfile. |
repos |
character. The URL(s) of the repositories to use for |
expand |
boolean. If |
open |
boolean. Should the Dockerfile/README/README be open after creation? Default is |
update_tar_gz |
boolean. If |
build_golem_from_source |
boolean. If |
extra_sysreqs |
character vector. Extra debian system requirements. |
pkg |
Deprecated, please use golem_wd instead |
lockfile |
path to the renv.lock file to use. default is |
output_dir |
folder to export everything deployment related. |
distro |
One of "focal", "bionic", "xenial", "centos7", or "centos8". See available distributions at https://hub.docker.com/r/rstudio/r-base/. |
document |
boolean. If TRUE (by default), DESCRIPTION file is updated using |
dockerfile_cmd |
What is the CMD to add to the Dockerfile. If NULL, the default,
the CMD will be |
user |
Name of the user to specify in the Dockerfile with the USER instruction. Default is |
single_file |
boolean.
If |
set_golem.app.prod |
boolean If |
... |
Other arguments to pass to |
source_folder |
deprecated, use golem_wd instead |
The {dockerfiler} object, invisibly.
add_dockerfile(), add_dockerfile_shinyproxy(), and
add_dockerfile_heroku() are now soft deprecated; use the corresponding
add_dockerfile_with_renv_*() functions instead.
# Add a standard Dockerfile if (interactive() & requireNamespace("dockerfiler")) { add_dockerfile() } # Crete a 'deploy' folder containing everything needed to deploy # the golem using docker based on {renv} if (interactive() & requireNamespace("dockerfiler")) { add_dockerfile_with_renv( # lockfile = "renv.lock", # uncomment to use existing renv.lock file output_dir = "deploy" ) } # Add a Dockerfile for ShinyProxy if (interactive() & requireNamespace("dockerfiler")) { add_dockerfile_shinyproxy() } # Crete a 'deploy' folder containing everything needed to deploy # the golem with ShinyProxy using docker based on {renv} if (interactive() & requireNamespace("dockerfiler")) { add_dockerfile_with_renv( # lockfile = "renv.lock",# uncomment to use existing renv.lock file output_dir = "deploy" ) } # Add a Dockerfile for Heroku if (interactive() & requireNamespace("dockerfiler")) { add_dockerfile_heroku() }# Add a standard Dockerfile if (interactive() & requireNamespace("dockerfiler")) { add_dockerfile() } # Crete a 'deploy' folder containing everything needed to deploy # the golem using docker based on {renv} if (interactive() & requireNamespace("dockerfiler")) { add_dockerfile_with_renv( # lockfile = "renv.lock", # uncomment to use existing renv.lock file output_dir = "deploy" ) } # Add a Dockerfile for ShinyProxy if (interactive() & requireNamespace("dockerfiler")) { add_dockerfile_shinyproxy() } # Crete a 'deploy' folder containing everything needed to deploy # the golem with ShinyProxy using docker based on {renv} if (interactive() & requireNamespace("dockerfiler")) { add_dockerfile_with_renv( # lockfile = "renv.lock",# uncomment to use existing renv.lock file output_dir = "deploy" ) } # Add a Dockerfile for Heroku if (interactive() & requireNamespace("dockerfiler")) { add_dockerfile_heroku() }
These functions add files in the R/ folder
that starts either with fct_ (short for function)
or with utils_.
add_fct( name, module = NULL, golem_wd = get_golem_wd(), open = TRUE, dir_create = TRUE, with_test = FALSE, template = fct_template, ..., pkg ) add_utils( name, module = NULL, golem_wd = get_golem_wd(), open = TRUE, dir_create = TRUE, with_test = FALSE, pkg ) add_r6( name, module = NULL, golem_wd = get_golem_wd(), open = TRUE, dir_create = TRUE, with_test = FALSE, pkg )add_fct( name, module = NULL, golem_wd = get_golem_wd(), open = TRUE, dir_create = TRUE, with_test = FALSE, template = fct_template, ..., pkg ) add_utils( name, module = NULL, golem_wd = get_golem_wd(), open = TRUE, dir_create = TRUE, with_test = FALSE, pkg ) add_r6( name, module = NULL, golem_wd = get_golem_wd(), open = TRUE, dir_create = TRUE, with_test = FALSE, pkg )
name |
The name of the file |
module |
If not NULL, the file will be module specific
in the naming (you don't need to add the leading |
golem_wd |
Path to the root of the package. Default is |
open |
Should the created file be opened? |
dir_create |
Creates the directory if it doesn't exist, default is |
with_test |
should the module be created with tests? |
template |
Function writing the default contents of a function file. Defaults to the built-in function template. Ignored for module-specific files. |
... |
Arguments passed to the |
pkg |
Deprecated, please use golem_wd instead |
The path to the file, invisibly.
Creates a minimal GitHub Actions workflow for deploying a {golem} app to
Posit Connect via {rsconnect}. If needed, this function also creates a
root app.R and .rscignore by calling add_positconnect_file(). The
generated Posit Connect entrypoint uses {pkgload}, so {pkgload} is added
to DESCRIPTION.
add_github_action(golem_wd = get_golem_wd(), open = TRUE)add_github_action(golem_wd = get_golem_wd(), open = TRUE)
golem_wd |
Path to the root of the package. Default is |
open |
Should the created file be opened? |
The path to the created workflow, invisibly.
Creates a minimal GitLab CI file for deploying a {golem} app to Posit
Connect via {rsconnect}. If needed, this function also creates a root
app.R and .rscignore by calling add_positconnect_file(). The
generated Posit Connect entrypoint uses {pkgload}, so {pkgload} is added
to DESCRIPTION.
add_gitlab_ci(golem_wd = get_golem_wd(), open = TRUE)add_gitlab_ci(golem_wd = get_golem_wd(), open = TRUE)
golem_wd |
Path to the root of the package. Default is |
open |
Should the created file be opened? |
The path to the created GitLab CI file, invisibly.
These functions create files inside the inst/app folder.
add_js_file( name, golem_wd = get_golem_wd(), dir = "inst/app/www", open = TRUE, dir_create, with_doc_ready = TRUE, template = golem::js_template, ..., pkg ) add_js_handler( name, golem_wd = get_golem_wd(), dir = "inst/app/www", open = TRUE, dir_create, template = golem::js_handler_template, ..., pkg ) add_js_input_binding( name, golem_wd = get_golem_wd(), dir = "inst/app/www", open = TRUE, dir_create, initialize = FALSE, dev = FALSE, events = list(name = c("change", "input"), rate_policy = c(FALSE, FALSE)), pkg ) add_js_output_binding( name, golem_wd = get_golem_wd(), dir = "inst/app/www", open = TRUE, dir_create, pkg ) add_css_file( name, golem_wd = get_golem_wd(), dir = "inst/app/www", open = TRUE, dir_create, template = golem::css_template, ..., pkg ) add_sass_file( name, golem_wd = get_golem_wd(), dir = "inst/app/www", open = TRUE, dir_create, template = golem::sass_template, ..., pkg ) add_empty_file( name, golem_wd = get_golem_wd(), dir = "inst/app/www", open = TRUE, dir_create, template = golem::empty_template, ..., pkg ) add_html_template( name = "template.html", golem_wd = get_golem_wd(), dir = "inst/app/www", open = TRUE, dir_create, pkg ) add_partial_html_template( name = "partial_template.html", golem_wd = get_golem_wd(), dir = "inst/app/www", open = TRUE, dir_create, pkg ) add_ui_server_files( golem_wd = get_golem_wd(), dir = "inst/app", dir_create, pkg )add_js_file( name, golem_wd = get_golem_wd(), dir = "inst/app/www", open = TRUE, dir_create, with_doc_ready = TRUE, template = golem::js_template, ..., pkg ) add_js_handler( name, golem_wd = get_golem_wd(), dir = "inst/app/www", open = TRUE, dir_create, template = golem::js_handler_template, ..., pkg ) add_js_input_binding( name, golem_wd = get_golem_wd(), dir = "inst/app/www", open = TRUE, dir_create, initialize = FALSE, dev = FALSE, events = list(name = c("change", "input"), rate_policy = c(FALSE, FALSE)), pkg ) add_js_output_binding( name, golem_wd = get_golem_wd(), dir = "inst/app/www", open = TRUE, dir_create, pkg ) add_css_file( name, golem_wd = get_golem_wd(), dir = "inst/app/www", open = TRUE, dir_create, template = golem::css_template, ..., pkg ) add_sass_file( name, golem_wd = get_golem_wd(), dir = "inst/app/www", open = TRUE, dir_create, template = golem::sass_template, ..., pkg ) add_empty_file( name, golem_wd = get_golem_wd(), dir = "inst/app/www", open = TRUE, dir_create, template = golem::empty_template, ..., pkg ) add_html_template( name = "template.html", golem_wd = get_golem_wd(), dir = "inst/app/www", open = TRUE, dir_create, pkg ) add_partial_html_template( name = "partial_template.html", golem_wd = get_golem_wd(), dir = "inst/app/www", open = TRUE, dir_create, pkg ) add_ui_server_files( golem_wd = get_golem_wd(), dir = "inst/app", dir_create, pkg )
name |
The name of the module. |
golem_wd |
Path to the root of the package. Default is |
dir |
Path to the dir where the file while be created. |
open |
Should the created file be opened? |
dir_create |
Deprecated. Will be removed in future versions and throws an error for now. |
with_doc_ready |
For JS file - Should the default file include |
template |
Function writing in the created file. You may overwrite this with your own template function. |
... |
Arguments to be passed to the |
pkg |
Deprecated, please use golem_wd instead |
initialize |
For JS file - Whether to add the initialize method. Default to FALSE. Some JavaScript API require to initialize components before using them. |
dev |
Whether to insert console.log calls in the most important methods of the binding. This is only to help building the input binding. Default is FALSE. |
events |
List of events to generate event listeners in the subscribe method.
For instance, |
The path to the file, invisibly.
add_ui_server_files will be deprecated in future version of {golem}
js_template, js_handler_template, and css_template
This function creates a module inside the R/ folder, based
on a specific module structure. This function can be used outside
of a {golem} project.
add_module( name, golem_wd = get_golem_wd(), open = TRUE, dir_create = TRUE, fct = NULL, utils = NULL, r6 = NULL, js = NULL, js_handler = NULL, export = FALSE, module_template = golem::module_template, with_test = FALSE, ..., pkg )add_module( name, golem_wd = get_golem_wd(), open = TRUE, dir_create = TRUE, fct = NULL, utils = NULL, r6 = NULL, js = NULL, js_handler = NULL, export = FALSE, module_template = golem::module_template, with_test = FALSE, ..., pkg )
name |
The name of the module. |
golem_wd |
Path to the root of the package. Default is |
open |
Should the created file be opened? |
dir_create |
Creates the directory if it doesn't exist, default is |
fct |
If specified, creates a |
utils |
If specified, creates a |
r6 |
If specified, creates a |
js, js_handler
|
If specified, creates a module related JavaScript file. |
export |
Should the module be exported? Default is |
module_template |
Function that serves as a module template. |
with_test |
should the module be created with tests? |
... |
Arguments to be passed to the |
pkg |
Deprecated, please use golem_wd instead |
The path to the file, invisibly.
This function will prefix the name argument with mod_.
app.R at the root of your package to deploy on RStudio ConnectAdditionally, adds a .rscignore at the root of the {golem} project if the
rsconnect package version is >= 0.8.25.
add_positconnect_file(golem_wd = get_golem_wd(), open = TRUE, pkg) add_shinyappsio_file(golem_wd = get_golem_wd(), open = TRUE, pkg) add_shinyserver_file(golem_wd = get_golem_wd(), open = TRUE, pkg) add_rscignore_file(golem_wd = get_golem_wd(), open = TRUE, pkg)add_positconnect_file(golem_wd = get_golem_wd(), open = TRUE, pkg) add_shinyappsio_file(golem_wd = get_golem_wd(), open = TRUE, pkg) add_shinyserver_file(golem_wd = get_golem_wd(), open = TRUE, pkg) add_rscignore_file(golem_wd = get_golem_wd(), open = TRUE, pkg)
golem_wd |
Path to the root of the package. Default is |
open |
Should the created file be opened? |
pkg |
Deprecated, please use golem_wd instead |
Side-effect functions for file creation returning the path to the file, invisibly.
.rscignore
.here
CODE_OF_CONDUCT.md
LICENSE{.md}
LICENCE{.md}
NEWS{.md}
README{.md,.Rmd,.HTML}
dev
man
tests
vignettes
In previous versions, this function was called add_rconnect_file.
# Add a file for Connect if (interactive()) { add_positconnect_file() } # Add a file for Shiny Server if (interactive()) { add_shinyserver_file() } # Add a file for Shinyapps.io if (interactive()) { add_shinyappsio_file() }# Add a file for Connect if (interactive()) { add_positconnect_file() } # Add a file for Shiny Server if (interactive()) { add_shinyserver_file() } # Add a file for Shinyapps.io if (interactive()) { add_shinyappsio_file() }
Add resource path
add_resource_path(prefix, directoryPath, warn_empty = FALSE)add_resource_path(prefix, directoryPath, warn_empty = FALSE)
prefix |
The URL prefix (without slashes). Valid characters are a-z, A-Z, 0-9, hyphen, period, and underscore. For example, a value of 'foo' means that any request paths that begin with '/foo' will be mapped to the given directory. |
directoryPath |
The directory that contains the static resources to be served. |
warn_empty |
Boolean. Default is |
Used for side effects.
{golem} addinsinsert_ns() takes a selected character vector and wrap it in ns()
The series of go_to_*() addins help you go to
common files used in developing a {golem} application.
insert_ns() go_to_start(golem_wd = golem::get_golem_wd(), wd) go_to_dev(golem_wd = golem::get_golem_wd(), wd) go_to_deploy(golem_wd = golem::get_golem_wd(), wd) go_to_run_dev(golem_wd = golem::get_golem_wd(), wd) go_to_app_ui(golem_wd = golem::get_golem_wd(), wd) go_to_app_server(golem_wd = golem::get_golem_wd(), wd) go_to_run_app(golem_wd = golem::get_golem_wd(), wd)insert_ns() go_to_start(golem_wd = golem::get_golem_wd(), wd) go_to_dev(golem_wd = golem::get_golem_wd(), wd) go_to_deploy(golem_wd = golem::get_golem_wd(), wd) go_to_run_dev(golem_wd = golem::get_golem_wd(), wd) go_to_app_ui(golem_wd = golem::get_golem_wd(), wd) go_to_app_server(golem_wd = golem::get_golem_wd(), wd) go_to_run_app(golem_wd = golem::get_golem_wd(), wd)
golem_wd |
The working directory of the |
wd |
Deprecated. Use |
Amend golem config file
amend_golem_config( key, value, config = "default", golem_wd = golem::pkg_path(), talkative = TRUE, pkg )amend_golem_config( key, value, config = "default", golem_wd = golem::pkg_path(), talkative = TRUE, pkg )
key |
key of the value to add in |
value |
Name of value ( |
config |
Name of configuration to read from. Defaults to
the value of the |
golem_wd |
Path to the root of the package. Default is |
talkative |
Should the messages be printed to the console? |
pkg |
Deprecated, please use golem_wd instead |
Used for side effects.
Is the app in dev mode or prod mode?
app_prod() app_dev()app_prod() app_dev()
TRUE or FALSE depending on the status of getOption( "golem.app.prod")
See https://rtask.thinkr.fr/a-little-trick-for-debugging-shiny/ for more context.
browser_button()browser_button()
Used for side effects. Prints the code to the console.
browser_button() is now soft deprecated and will be removed in a
future version of {golem}.
This function is a wrapper around htmltools::htmlDependency that
automatically bundles the CSS and JavaScript files in inst/app/www
and which are created by golem::add_css_file() , golem::add_js_file()
and golem::add_js_handler().
bundle_resources( path, app_title, name = "golem_resources", version = "0.0.1", meta = NULL, head = NULL, attachment = NULL, package = NULL, all_files = TRUE, app_builder = "golem", with_sparkles = FALSE, activate_js = TRUE )bundle_resources( path, app_title, name = "golem_resources", version = "0.0.1", meta = NULL, head = NULL, attachment = NULL, package = NULL, all_files = TRUE, app_builder = "golem", with_sparkles = FALSE, activate_js = TRUE )
path |
The path to the folder where the external files are located. |
app_title |
The title of the app, to be used as an application title. |
name |
Library name |
version |
Library version |
meta |
Named list of meta tags to insert into document head |
head |
Arbitrary lines of HTML to insert into the document head |
attachment |
Attachment(s) to include within the document head. See Details. |
package |
An R package name to indicate where to find the |
all_files |
Whether all files under the |
app_builder |
The name of the app builder to add as a meta tag. Turn to NULL if you don't want this meta tag to be included. |
with_sparkles |
C'est quand que tu vas mettre des paillettes dans ma vie Kevin? |
activate_js |
Boolean to enable or disable the injection of JavaScript via activate_js(). |
This function also preload activate_js() which allows to
use preconfigured JavaScript functions via invoke_js().
an htmlDependency
This functions will be run only if golem::app_dev()
returns TRUE.
cat_dev(...) print_dev(...) message_dev(...) warning_dev(...) browser_dev(...)cat_dev(...) print_dev(...) message_dev(...) warning_dev(...) browser_dev(...)
... |
R objects (see ‘Details’ for the types of objects allowed). |
A modified function.
{golem}
Create a package for a Shiny App using {golem}
create_golem( path, check_name = TRUE, open = TRUE, overwrite = FALSE, package_name = basename(normalizePath(path, mustWork = FALSE)), without_comments = FALSE, project_hook = golem::project_hook, with_git = FALSE, with_agents = FALSE, with_agents_options = NULL, ... )create_golem( path, check_name = TRUE, open = TRUE, overwrite = FALSE, package_name = basename(normalizePath(path, mustWork = FALSE)), without_comments = FALSE, project_hook = golem::project_hook, with_git = FALSE, with_agents = FALSE, with_agents_options = NULL, ... )
path |
Name of the folder to create the package in. This will also be used as the package name. |
check_name |
Should we check that the package name is correct according to CRAN requirements. |
open |
Boolean. Open the created project? |
overwrite |
Boolean. Should the already existing project be deleted and replaced? |
package_name |
Package name to use. By default, |
without_comments |
Boolean. Start project without |
project_hook |
A function executed as a hook after project
creation. Can be used to change the default |
with_git |
Boolean. Initialize git repository |
with_agents |
Boolean. If |
with_agents_options |
named list of options passed to |
... |
Arguments passed to the |
The path, invisibly.
For compatibility issue, this function turns options(shiny.autoload.r)
to FALSE. See https://github.com/ThinkR-open/golem/issues/468 for more background.
Detach all attached package
detach_all_attached()detach_all_attached()
TRUE, invisibly.
Disabling Shiny Autoload of R Scripts
disable_autoload(golem_wd = get_golem_wd(), pkg)disable_autoload(golem_wd = get_golem_wd(), pkg)
golem_wd |
Path to the root of the package. Default is |
pkg |
Deprecated, please use golem_wd instead |
The path to the file, invisibly.
if (interactive()) { disable_autoload() }if (interactive()) { disable_autoload() }
This function calls rstudioapi::documentSaveAll(),
roxygen2::roxygenise() and pkgload::load_all().
document_and_reload( golem_wd = get_golem_wd(), roclets = NULL, load_code = NULL, clean = FALSE, export_all = FALSE, helpers = FALSE, attach_testthat = FALSE, ..., pkg )document_and_reload( golem_wd = get_golem_wd(), roclets = NULL, load_code = NULL, clean = FALSE, export_all = FALSE, helpers = FALSE, attach_testthat = FALSE, ..., pkg )
golem_wd |
Path to the root of the package. Default is |
roclets |
Character vector of roclet names to use with package.
The default, |
load_code |
A function used to load all the R code in the package
directory. The default, |
clean |
If |
export_all |
If |
helpers |
if |
attach_testthat |
If |
... |
Other arguments passed to |
pkg |
Deprecated, please use golem_wd instead |
Used for side-effects
These functions are designed to be used inside the tests in your Shiny app package.
expect_shinytag(object) expect_shinytaglist(object) expect_html_equal(ui, html, ...) expect_running(sleep, R_path = NULL)expect_shinytag(object) expect_shinytaglist(object) expect_html_equal(ui, html, ...) expect_running(sleep, R_path = NULL)
object |
the object to test |
ui |
output of an UI function |
html |
deprecated |
... |
arguments passed to |
sleep |
number of seconds |
R_path |
path to R. If NULL, the function will try to guess where R is. |
A testthat result.
Function templates can be used to extend the add_fct() creation
mechanism with your own template, so that you can be even more
productive when building your {shiny} app.
Function template functions do not aim at being called as is by
users, but to be passed as an argument to the add_fct() function.
fct_template(name, path, export = FALSE, ...)fct_template(name, path, export = FALSE, ...)
name |
The name of the generated function. |
path |
The path to the R script where the function will be written.
Note that this path will not be set by the user but via
|
export |
Whether the generated function should be exported. |
... |
Extra arguments, ignored by the default template. |
A template function can take the following arguments to be passed
from add_fct():
name: the name of the function
path: the path to the file in R/
export: a TRUE/FALSE value
If you want your function to ignore these parameters, set ... as
the last argument of your function, then these will be ignored. See
the examples section of this help.
Used for side effect
if (interactive()) { my_tmpl <- function(name, path, ...) { # Define a template that writes to the function file write(name, path) } golem::add_fct(name = "custom", template = my_tmpl) }if (interactive()) { my_tmpl <- function(name, path, ...) { # Define a template that writes to the function file write(name, path) } golem::add_fct(name = "custom", template = my_tmpl) }
DESCRIPTION fileGenerates a standard DESCRIPTION file as used in R packages. Also sets
a series of global options inside golem-config.yml that will be reused
inside {golem} (see set_options and set_golem_options() for details).
fill_desc( pkg_name, pkg_title, pkg_description, authors = person(given = NULL, family = NULL, email = NULL, role = NULL, comment = NULL), repo_url = NULL, pkg_version = "0.0.0.9000", pkg = get_golem_wd(), author_first_name = NULL, author_last_name = NULL, author_email = NULL, author_orcid = NULL, set_options = TRUE )fill_desc( pkg_name, pkg_title, pkg_description, authors = person(given = NULL, family = NULL, email = NULL, role = NULL, comment = NULL), repo_url = NULL, pkg_version = "0.0.0.9000", pkg = get_golem_wd(), author_first_name = NULL, author_last_name = NULL, author_email = NULL, author_orcid = NULL, set_options = TRUE )
pkg_name |
The name of the package |
pkg_title |
The title of the package |
pkg_description |
Description of the package |
authors |
a character string (or vector) of class person
(see |
repo_url |
URL (if needed) |
pkg_version |
The version of the package. Default is 0.0.0.9000 |
pkg |
Path to look for the DESCRIPTION. Default is |
author_first_name |
Deprecated: use |
author_last_name |
Deprecated: use |
author_email |
Deprecated: use |
author_orcid |
Deprecated: use |
set_options |
logical; the default |
The {desc} object, invisibly.
{golem} config-fileThis function tries to find the current config file, being either inst/golem-config.yml or the GOLEM_CONFIG_PATH env var
get_current_config(path = getwd())get_current_config(path = getwd())
path |
character string giving the path to start looking for the config;
the usual value is the |
In most cases this function simply returns the path to the default
golem-config file located under "inst/golem-config.yml". That config comes
in yml-format, see the Engineering Production-Grade Shiny Apps
for further details on its format and how to set options therein.
Advanced app developers may benefit from having an additional user config-file. This is achieved with setting the GOLEM_CONFIG_PATH env var.
character string giving the path to the {golem} config-file
This function is to be used inside the
server and UI from your app, in order to call the
parameters passed to run_app().
get_golem_options(which = NULL)get_golem_options(which = NULL)
which |
NULL (default), or the name of an option |
The value of the option.
# Define and use golem_options if (interactive()) { # 1. Pass parameters directly to `run_app` run_app( title = "My Golem App", content = "something" ) # 2. Get the values # 2.1 from the UI side h1(get_golem_options("title")) # 2.2 from the server-side output$param <- renderPrint({ paste("param content = ", get_golem_options("content")) }) output$param_full <- renderPrint({ get_golem_options() # list of all golem options as a list. }) # 3. If needed, to set default value, edit `run_app` like this : run_app <- function( title = "this", content = "that", ... ) { with_golem_options( app = shinyApp( ui = app_ui, server = app_server ), golem_opts = list( title = title, content = content, ... ) ) } }# Define and use golem_options if (interactive()) { # 1. Pass parameters directly to `run_app` run_app( title = "My Golem App", content = "something" ) # 2. Get the values # 2.1 from the UI side h1(get_golem_options("title")) # 2.2 from the server-side output$param <- renderPrint({ paste("param content = ", get_golem_options("content")) }) output$param_full <- renderPrint({ get_golem_options() # list of all golem options as a list. }) # 3. If needed, to set default value, edit `run_app` like this : run_app <- function( title = "this", content = "that", ... ) { with_golem_options( app = shinyApp( ui = app_ui, server = app_server ), golem_opts = list( title = title, content = content, ... ) ) } }
{golem} optionsSet and get a series of options to be used with {golem}.
These options are found inside the golem-config.yml file, found in most cases
inside the inst folder.
get_golem_wd(use_parent = TRUE, golem_wd = golem::pkg_path(), pkg) get_golem_name( config = Sys.getenv("GOLEM_CONFIG_ACTIVE", Sys.getenv("R_CONFIG_ACTIVE", "default")), use_parent = TRUE, golem_wd = golem::pkg_path(), pkg ) get_golem_version( config = Sys.getenv("GOLEM_CONFIG_ACTIVE", Sys.getenv("R_CONFIG_ACTIVE", "default")), use_parent = TRUE, golem_wd = golem::pkg_path(), pkg ) set_golem_wd( new_golem_wd = golem::pkg_path(), current_golem_wd = golem::pkg_path(), talkative = TRUE, golem_wd, pkg ) set_golem_name( name = golem::pkg_name(), golem_wd = golem::pkg_path(), talkative = TRUE, old_name = golem::pkg_name(), pkg ) set_golem_version( version = golem::pkg_version(), golem_wd = golem::pkg_path(), talkative = TRUE, pkg ) set_golem_options( golem_name = golem::pkg_name(), golem_version = golem::pkg_version(), golem_wd = golem::pkg_path(), app_prod = FALSE, talkative = TRUE, config_file = golem::get_current_config(golem_wd) )get_golem_wd(use_parent = TRUE, golem_wd = golem::pkg_path(), pkg) get_golem_name( config = Sys.getenv("GOLEM_CONFIG_ACTIVE", Sys.getenv("R_CONFIG_ACTIVE", "default")), use_parent = TRUE, golem_wd = golem::pkg_path(), pkg ) get_golem_version( config = Sys.getenv("GOLEM_CONFIG_ACTIVE", Sys.getenv("R_CONFIG_ACTIVE", "default")), use_parent = TRUE, golem_wd = golem::pkg_path(), pkg ) set_golem_wd( new_golem_wd = golem::pkg_path(), current_golem_wd = golem::pkg_path(), talkative = TRUE, golem_wd, pkg ) set_golem_name( name = golem::pkg_name(), golem_wd = golem::pkg_path(), talkative = TRUE, old_name = golem::pkg_name(), pkg ) set_golem_version( version = golem::pkg_version(), golem_wd = golem::pkg_path(), talkative = TRUE, pkg ) set_golem_options( golem_name = golem::pkg_name(), golem_version = golem::pkg_version(), golem_wd = golem::pkg_path(), app_prod = FALSE, talkative = TRUE, config_file = golem::get_current_config(golem_wd) )
use_parent |
|
golem_wd |
Working directory of the current golem package. |
pkg |
The path to set the golem working directory.
Note that it will be passed to |
config |
Name of configuration to read from. Defaults to
the value of the |
new_golem_wd, current_golem_wd
|
New & current directory,
to be used in |
talkative |
Should the messages be printed to the console? |
name |
The name of the app |
old_name |
The old name of the app, used when changing the name |
version |
The version of the app |
golem_name |
Name of the current golem. |
golem_version |
Version of the current golem. |
app_prod |
Is the |
config_file |
path to the |
Used for side-effects for the setters, and values from the config in the getters.
set_golem_options() sets all the options, with the defaults from the functions below.
set_golem_wd() defaults to golem::golem_wd(), which is the package root when starting a golem.
set_golem_name() defaults golem::pkg_name()
set_golem_version() defaults golem::pkg_version()
Reads the information from golem-config.yml
get_golem_wd()
get_golem_name()
get_golem_version()
Read more about building big shiny apps at https://engineering-shiny.org/.
Maintainer: Colin Fay [email protected] (ORCID)
Authors:
Vincent Guyader [email protected] (ORCID) (previous maintainer)
Sébastien Rochette [email protected] (ORCID)
Cervan Girard [email protected] (ORCID)
Other contributors:
Novica Nakov [email protected] [contributor]
David Granjon [email protected] [contributor]
Arthur Bréant [email protected] [contributor]
Antoine Languillaume [email protected] [contributor]
Ilya Zarubin [email protected] [contributor]
ThinkR [copyright holder]
Useful links:
Report bugs at https://github.com/ThinkR-open/golem/issues
Welcome Page
golem_welcome_page()golem_welcome_page()
A welcome page for your {golem} app
{golem} dev dependenciesThis function will run rlang::check_installed() on:
usethis
pkgload
dockerfiler
devtools
roxygen2
attachment
rstudioapi
fs
desc
pkgbuild
processx
rsconnect
testthat
rstudioapi
install_dev_deps(dev_deps, force_install = FALSE, ...)install_dev_deps(dev_deps, force_install = FALSE, ...)
dev_deps |
optional character vector of packages to install |
force_install |
If force_install is TRUE, then the user is not interactively asked to install them. |
... |
further arguments passed to the install function. |
Used for side-effects
if (interactive()) { install_dev_deps() }if (interactive()) { install_dev_deps() }
Trying to guess if path is a golem-based app.
is_golem(path = getwd())is_golem(path = getwd())
path |
Path to the directory to check. Defaults to the current working directory. |
A boolean, TRUE if the directory is a golem-based app, FALSE else.
is_golem()is_golem()
Note that this will return TRUE only if the application
has been launched with with_golem_options()
is_running()is_running()
TRUE if the running app is a {golem} based app,
FALSE otherwise.
is_running()is_running()
These functions do not aim at being called as is by
users, but to be passed as an argument to the add_js_handler()
function.
js_handler_template(path, name = "fun", code = " ") js_template(path, code = " ") css_template(path, code = " ") sass_template(path, code = " ") empty_template(path, code = " ")js_handler_template(path, name = "fun", code = " ") js_template(path, code = " ") css_template(path, code = " ") sass_template(path, code = " ") empty_template(path, code = " ")
path |
The path to the JS script where this template will be written. |
name |
Shiny's custom handler name. |
code |
JavaScript code to be written in the function. |
Used for side effect
A default html page for maintenance mode
maintenance_page()maintenance_page()
see the vignette vignette("f_extending_golem", package = "golem") for details.
an html_document
The function returned will be run only if golem::app_dev()
returns TRUE.
make_dev(fun)make_dev(fun)
fun |
A function |
Used for side-effects
Module template can be used to extend golem module creation
mechanism with your own template, so that you can be even more
productive when building your {shiny} app.
Module template functions do not aim at being called as is by
users, but to be passed as an argument to the add_module()
function.
module_template(name, path, export, ph_ui = " ", ph_server = " ", ...)module_template(name, path, export, ph_ui = " ", ph_server = " ", ...)
name |
The name of the module. |
path |
The path to the R script where the module will be written.
Note that this path will not be set by the user but via
|
export |
Should the module be exported? Default is |
ph_ui, ph_server
|
Texts to insert inside the modules UI and server. For advanced use. |
... |
Arguments to be passed to the |
Module template functions are a way to define your own template
function for module. A template function that can take the following
arguments to be passed from add_module():
name: the name of the module
path: the path to the file in R/
export: a TRUE/FALSE set by the export param of add_module()
If you want your function to ignore these parameters, set ... as the
last argument of your function, then these will be ignored. See the examples
section of this help.
Used for side effect
if (interactive()) { my_tmpl <- function(name, path, ...) { # Define a template that write to the # module file write(name, path) } golem::add_module(name = "custom", module_template = my_tmpl) my_other_tmpl <- function(name, path, ...) { # Copy and paste a file from somewhere file.copy(..., path) } golem::add_module(name = "custom", module_template = my_other_tmpl) }if (interactive()) { my_tmpl <- function(name, path, ...) { # Define a template that write to the # module file write(name, path) } golem::add_module(name = "custom", module_template = my_tmpl) my_other_tmpl <- function(name, path, ...) { # Copy and paste a file from somewhere file.copy(..., path) } golem::add_module(name = "custom", module_template = my_other_tmpl) }
These are functions to help you navigate inside your project while developing
pkg_name(golem_wd = get_golem_wd(), path) pkg_version(golem_wd = get_golem_wd(), path) pkg_path(golem_wd = getwd())pkg_name(golem_wd = get_golem_wd(), path) pkg_version(golem_wd = get_golem_wd(), path) pkg_path(golem_wd = getwd())
golem_wd |
Path to use to read the DESCRIPTION |
path |
Deprecated, use golem_wd instead |
The value of the entry in the DESCRIPTION file
Project hooks allow to define a function run just after {golem}
project creation.
project_hook(path, package_name, ...)project_hook(path, package_name, ...)
path |
Name of the folder to create the package in. This will also be used as the package name. |
package_name |
Package name to use. By default, |
... |
Arguments passed from |
Used for side effects
if (interactive()) { my_proj <- function(...) { unlink("dev/", TRUE, TRUE) } create_golem("ici", project_template = my_proj) }if (interactive()) { my_proj <- function(...) { unlink("dev/", TRUE, TRUE) } create_golem("ici", project_template = my_proj) }
dev/run_dev.R fileThe default file="dev/run_dev.R" launches your {golem} app with a bunch
of useful options. The file content can be customized and file-name and
path changed as long as the argument combination of file and pkg are
supplied correctly: the file-path is a relative path to a {golem}-package
root pkg. An error is thrown if pkg/file cannot be found.
run_dev( file = "dev/run_dev.R", golem_wd = get_golem_wd(), save_all = TRUE, install_required_packages = TRUE, pkg )run_dev( file = "dev/run_dev.R", golem_wd = get_golem_wd(), save_all = TRUE, install_required_packages = TRUE, pkg )
file |
String with (relative) file path to a |
golem_wd |
Path to the root of the package. Default is |
save_all |
Boolean; if |
install_required_packages |
Boolean; if |
pkg |
Deprecated, please use golem_wd instead |
The function run_dev() is typically used to launch a shiny app by sourcing
the content of an appropriate run_dev-file. Carefully read the content of
dev/run_dev.R when creating your custom run_dev-file. It has already
many useful settings including a switch between production/development,
reloading the package in a clean R environment before running the app etc.
pure side-effect function; returns invisibly
This function is used check for any 'browser()“ or commented #TODO / #TOFIX / #BUG in the code
sanity_check(golem_wd = get_golem_wd(), pkg)sanity_check(golem_wd = get_golem_wd(), pkg)
golem_wd |
Path to the root of the package. Default is |
pkg |
Deprecated, please use golem_wd instead |
A DataFrame if any of the words has been found.
Implement Agent Skills in a golem Project
use_agent_implement( source = c("ask", "local", "remote"), agent_specs = c("ask", "claude", "agents", "both"), skills = NULL, main_md_files = c("ask", "yes", "no"), overwrite = c("ask", "overwrite", "skip", "abort"), golem_wd = get_golem_wd(), interactive = rlang_is_interactive() )use_agent_implement( source = c("ask", "local", "remote"), agent_specs = c("ask", "claude", "agents", "both"), skills = NULL, main_md_files = c("ask", "yes", "no"), overwrite = c("ask", "overwrite", "skip", "abort"), golem_wd = get_golem_wd(), interactive = rlang_is_interactive() )
source |
Where to install agent skills from. Use |
agent_specs |
Which agent specifications to install. Use |
skills |
Skills to install. Use |
main_md_files |
Whether to also add |
overwrite |
How to handle existing files. Use |
golem_wd |
Path to the golem project where files should be copied. |
interactive |
Whether |
A list of selected options and copied paths, invisibly.
use_skills(), use_agent_skills(), use_claude_skills(),
use_skill()
Add Agent Skills to a golem Project
use_agent_skills( source = c("ask", "local", "remote"), skills = NULL, main_md_files = c("ask", "yes", "no"), overwrite = c("ask", "overwrite", "skip", "abort"), golem_wd = get_golem_wd(), interactive = rlang_is_interactive() )use_agent_skills( source = c("ask", "local", "remote"), skills = NULL, main_md_files = c("ask", "yes", "no"), overwrite = c("ask", "overwrite", "skip", "abort"), golem_wd = get_golem_wd(), interactive = rlang_is_interactive() )
source |
Where to install agent skills from. Use |
skills |
Skills to install. Use |
main_md_files |
Whether to also add |
overwrite |
How to handle existing files. Use |
golem_wd |
Path to the golem project where files should be copied. |
interactive |
Whether |
A list of selected options and copied paths, invisibly.
use_skills(), use_agent_implement(), use_claude_skills(),
use_skill()
Add Claude Skills to a golem Project
use_claude_skills( source = c("ask", "local", "remote"), skills = NULL, main_md_files = c("ask", "yes", "no"), overwrite = c("ask", "overwrite", "skip", "abort"), golem_wd = get_golem_wd(), interactive = rlang_is_interactive() )use_claude_skills( source = c("ask", "local", "remote"), skills = NULL, main_md_files = c("ask", "yes", "no"), overwrite = c("ask", "overwrite", "skip", "abort"), golem_wd = get_golem_wd(), interactive = rlang_is_interactive() )
source |
Where to install agent skills from. Use |
skills |
Skills to install. Use |
main_md_files |
Whether to also add |
overwrite |
How to handle existing files. Use |
golem_wd |
Path to the golem project where files should be copied. |
interactive |
Whether |
A list of selected options and copied paths, invisibly.
use_skills(), use_agent_implement(), use_agent_skills(),
use_skill()
These functions download files from external sources and put them inside the inst/app/www directory.
The use_internal_ functions will copy internal files, while use_external_ will try to download them
from a remote location.
use_external_js_file( url, name = NULL, golem_wd = get_golem_wd(), dir = "inst/app/www", open = FALSE, dir_create, pkg, replace = FALSE ) use_external_css_file( url, name = NULL, golem_wd = get_golem_wd(), dir = "inst/app/www", open = FALSE, dir_create, pkg, replace = FALSE ) use_external_html_template( url, name = "template.html", golem_wd = get_golem_wd(), dir = "inst/app/www", open = FALSE, dir_create, extract = c("ask", "yes", "no"), delete_zip = c("ask", "yes", "no"), replace = FALSE ) use_external_file( url, name = NULL, golem_wd = get_golem_wd(), dir = "inst/app/www", open = FALSE, dir_create, pkg, replace = FALSE ) use_bundled_html( url, name = NULL, golem_wd = get_golem_wd(), dir = "inst/app/www", open = FALSE, extract = c("ask", "yes", "no"), delete_zip = c("ask", "yes", "no"), replace = FALSE ) use_internal_js_file( path, name = NULL, golem_wd = get_golem_wd(), dir = "inst/app/www", open = FALSE, dir_create, pkg ) use_internal_css_file( path, name = NULL, golem_wd = get_golem_wd(), dir = "inst/app/www", open = FALSE, dir_create, pkg ) use_internal_html_template( path, name = "template.html", golem_wd = get_golem_wd(), dir = "inst/app/www", open = FALSE, dir_create, pkg ) use_internal_file( path, name = NULL, golem_wd = get_golem_wd(), dir = "inst/app/www", open = FALSE, dir_create, pkg )use_external_js_file( url, name = NULL, golem_wd = get_golem_wd(), dir = "inst/app/www", open = FALSE, dir_create, pkg, replace = FALSE ) use_external_css_file( url, name = NULL, golem_wd = get_golem_wd(), dir = "inst/app/www", open = FALSE, dir_create, pkg, replace = FALSE ) use_external_html_template( url, name = "template.html", golem_wd = get_golem_wd(), dir = "inst/app/www", open = FALSE, dir_create, extract = c("ask", "yes", "no"), delete_zip = c("ask", "yes", "no"), replace = FALSE ) use_external_file( url, name = NULL, golem_wd = get_golem_wd(), dir = "inst/app/www", open = FALSE, dir_create, pkg, replace = FALSE ) use_bundled_html( url, name = NULL, golem_wd = get_golem_wd(), dir = "inst/app/www", open = FALSE, extract = c("ask", "yes", "no"), delete_zip = c("ask", "yes", "no"), replace = FALSE ) use_internal_js_file( path, name = NULL, golem_wd = get_golem_wd(), dir = "inst/app/www", open = FALSE, dir_create, pkg ) use_internal_css_file( path, name = NULL, golem_wd = get_golem_wd(), dir = "inst/app/www", open = FALSE, dir_create, pkg ) use_internal_html_template( path, name = "template.html", golem_wd = get_golem_wd(), dir = "inst/app/www", open = FALSE, dir_create, pkg ) use_internal_file( path, name = NULL, golem_wd = get_golem_wd(), dir = "inst/app/www", open = FALSE, dir_create, pkg )
url |
String representation of URL for the file to be downloaded |
name |
The name of the module. |
golem_wd |
Path to the root of the package. Default is |
dir |
Path to the dir where the file while be created. |
open |
Should the created file be opened? |
dir_create |
Creates the directory if it doesn't exist, default is |
pkg |
Deprecated, please use golem_wd instead |
replace |
Boolean. If |
extract |
Whether to extract a downloaded HTML zip bundle. Use |
delete_zip |
Whether to delete the raw HTML zip after extraction. Use |
path |
String representation of the local path for the file to be implemented (use_file only) |
The path to the file, invisibly.
See ?htmltools::htmlTemplate and https://shiny.rstudio.com/articles/templates.html
for more information about htmlTemplate.
This function adds the favicon from ico to your shiny app.
use_favicon(path, golem_wd = get_golem_wd(), method = "curl", pkg) remove_favicon(path = "inst/app/www/favicon.ico") favicon( ico = "favicon", rel = "shortcut icon", resources_path = "www", ext = "ico" )use_favicon(path, golem_wd = get_golem_wd(), method = "curl", pkg) remove_favicon(path = "inst/app/www/favicon.ico") favicon( ico = "favicon", rel = "shortcut icon", resources_path = "www", ext = "ico" )
path |
Path to your favicon file (.ico or .png) |
golem_wd |
Path to the root of the package. Default is |
method |
Method to be used for downloading files, 'curl' is default see |
pkg |
Deprecated, please use golem_wd instead |
ico |
path to favicon file |
rel |
rel |
resources_path |
prefix of the resource path of the app |
ext |
the extension of the favicon |
Used for side-effects.
An HTML tag.
if (interactive()) { use_favicon() use_favicon(path = "path/to/your/favicon.ico") }if (interactive()) { use_favicon() use_favicon(path = "path/to/your/favicon.ico") }
Add a test file for in module, with the new testServer structure.
use_module_test(name, golem_wd = get_golem_wd(), open = TRUE, pkg)use_module_test(name, golem_wd = get_golem_wd(), open = TRUE, pkg)
name |
The name of the module. |
golem_wd |
Path to the root of the package. Default is |
open |
Should the created file be opened? |
pkg |
Deprecated, please use golem_wd instead |
Used for side effect. Returns the path invisibly.
Generate a README.Rmd
use_readme_rmd( open = rlang::is_interactive(), pkg_name = golem::get_golem_name(), overwrite = FALSE, golem_wd = golem::get_golem_wd(), pkg )use_readme_rmd( open = rlang::is_interactive(), pkg_name = golem::get_golem_name(), overwrite = FALSE, golem_wd = golem::get_golem_wd(), pkg )
open |
Open the newly created file for editing? Happens in RStudio, if
applicable, or via |
pkg_name |
The name of the package |
overwrite |
an optional |
golem_wd |
Path to the root of the package. Default is |
pkg |
Deprecated, please use golem_wd instead |
pure side-effect function that generates template README.Rmd
Add recommended elements
use_recommended_tests( golem_wd = get_golem_wd(), spellcheck = TRUE, vignettes = TRUE, lang = "en-US", error = FALSE, pkg )use_recommended_tests( golem_wd = get_golem_wd(), spellcheck = TRUE, vignettes = TRUE, lang = "en-US", error = FALSE, pkg )
golem_wd |
Path to the root of the package. Default is |
spellcheck |
Whether or not to use a spellcheck test. |
vignettes |
Logical, |
lang |
Preferred spelling language. Usually either |
error |
Logical, indicating whether the unit test should fail if
spelling errors are found. Defaults to |
pkg |
Deprecated, please use golem_wd instead |
Used for side-effects.
Add a Single Skill to Installed Agent Specifications
use_skill( name, source = NULL, overwrite = c("ask", "overwrite", "skip", "abort"), golem_wd = get_golem_wd(), interactive = rlang_is_interactive() )use_skill( name, source = NULL, overwrite = c("ask", "overwrite", "skip", "abort"), golem_wd = get_golem_wd(), interactive = rlang_is_interactive() )
name |
Skill name to install. |
source |
Where to install agent skills from. If |
overwrite |
How to handle existing files. Use |
golem_wd |
Path to the golem project where files should be copied. |
interactive |
Whether |
A list of selected options and copied paths, invisibly.
use_skills(), use_agent_implement(), use_agent_skills(),
use_claude_skills()
Add Skills to a golem Project
use_skills( source = c("ask", "local", "remote"), agent_specs = c("ask", "claude", "agents", "both"), skills = NULL, main_md_files = c("ask", "yes", "no"), overwrite = c("ask", "overwrite", "skip", "abort"), golem_wd = get_golem_wd(), interactive = rlang_is_interactive() )use_skills( source = c("ask", "local", "remote"), agent_specs = c("ask", "claude", "agents", "both"), skills = NULL, main_md_files = c("ask", "yes", "no"), overwrite = c("ask", "overwrite", "skip", "abort"), golem_wd = get_golem_wd(), interactive = rlang_is_interactive() )
source |
Where to install agent skills from. Use |
agent_specs |
Which agent specifications to install. Use |
skills |
Skills to install. Use |
main_md_files |
Whether to also add |
overwrite |
How to handle existing files. Use |
golem_wd |
Path to the golem project where files should be copied. |
interactive |
Whether |
A list of selected options and copied paths, invisibly.
use_skills() is the main entry point — pick the agent target via
agent_specs ("claude", "agents", or "both").
use_agent_skills() and use_claude_skills() are convenience wrappers
for use_skills(agent_specs = "agents") and
use_skills(agent_specs = "claude").
use_skill() adds a single skill to an already-installed agent target,
without touching CLAUDE.md / AGENTS.md.
use_agent_implement(), use_agent_skills(),
use_claude_skills(), use_skill()
Copies the golem_utils_ui.R to the R folder.
Copies the golem_utils_server.R to the R folder.
use_utils_ui(golem_wd = get_golem_wd(), with_test = FALSE, pkg) use_utils_test_ui(golem_wd = get_golem_wd(), pkg) use_utils_server(golem_wd = get_golem_wd(), with_test = FALSE, pkg) use_utils_test_ui(golem_wd = get_golem_wd(), pkg) use_utils_test_server(golem_wd = get_golem_wd(), pkg)use_utils_ui(golem_wd = get_golem_wd(), with_test = FALSE, pkg) use_utils_test_ui(golem_wd = get_golem_wd(), pkg) use_utils_server(golem_wd = get_golem_wd(), with_test = FALSE, pkg) use_utils_test_ui(golem_wd = get_golem_wd(), pkg) use_utils_test_server(golem_wd = get_golem_wd(), pkg)
golem_wd |
Path to the root of the package. Default is |
with_test |
should the module be created with tests? |
pkg |
Deprecated, please use golem_wd instead |
Used for side-effects.
You'll probably never have to write this function as it is included in the golem template created on launch.
with_golem_options( app, golem_opts, maintenance_page = golem::maintenance_page, print = FALSE )with_golem_options( app, golem_opts, maintenance_page = golem::maintenance_page, print = FALSE )
app |
the app object. |
golem_opts |
A list of options to be added to the app |
maintenance_page |
an html_document or a shiny tag list. Default is golem template. |
print |
Whether or not to print the app. Default is to |
a shiny.appObj object