diff --git a/DESCRIPTION b/DESCRIPTION index 3e61801c3..0bf623955 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -34,6 +34,7 @@ Imports: glue (>= 1.3.0), jsonlite, lifecycle (>= 1.0.0), + pak, purrr, rappdirs, rlang (>= 1.1.0), diff --git a/R/create.R b/R/create.R index effe51061..4a6cd9024 100644 --- a/R/create.R +++ b/R/create.R @@ -186,7 +186,8 @@ create_quarto_project <- function( #' In the fork-and-clone case, `create_from_github()` also does additional #' remote and branch setup, leaving you in the perfect position to make a pull #' request with [pr_init()], one of several [functions for working with pull -#' requests][pull-requests]. +#' requests][pull-requests]. Finally, it installs the dependencies of the +#' package, so you're set up to immediately start working on it. #' #' `create_from_github()` works best when your GitHub credentials are #' discoverable. See below for more about authentication. @@ -237,6 +238,8 @@ create_quarto_project <- function( #' pre-existing `.Rproj` file. Defaults to `FALSE` otherwise (but note that #' the cloned repo may already be an RStudio Project, i.e. may already have a #' `.Rproj` file). +#' @param install_dependencies Install package dependencies? Defaults to `TRUE`, +#' so that you can immediately work with the package. #' @inheritParams use_github #' #' @export @@ -255,6 +258,7 @@ create_from_github <- function( destdir = NULL, fork = NA, rstudio = NULL, + install_dependencies = TRUE, open = rlang::is_interactive(), protocol = git_protocol(), host = NULL @@ -388,7 +392,12 @@ create_from_github <- function( ) } - rstudio <- rstudio %||% rstudio_available() + if (install_dependencies) { + ui_bullets(c("v" = "Installing missing dependencies.")) + pak::local_install_dev_deps(repo_path, upgrade = FALSE) + } + + rstudio <- rstudio %||% (rstudio_available() && !is_positron()) rstudio <- rstudio && !is_rstudio_project() if (rstudio) { use_rstudio(reformat = FALSE) diff --git a/man/create_from_github.Rd b/man/create_from_github.Rd index bcf9cfff0..757d9bea4 100644 --- a/man/create_from_github.Rd +++ b/man/create_from_github.Rd @@ -9,6 +9,7 @@ create_from_github( destdir = NULL, fork = NA, rstudio = NULL, + install_dependencies = TRUE, open = rlang::is_interactive(), protocol = git_protocol(), host = NULL @@ -48,6 +49,9 @@ pre-existing \code{.Rproj} file. Defaults to \code{FALSE} otherwise (but note th the cloned repo may already be an RStudio Project, i.e. may already have a \code{.Rproj} file).} +\item{install_dependencies}{Install package dependencies? Defaults to \code{TRUE}, +so that you can immediately work with the package.} + \item{open}{If \code{TRUE}, \link[=proj_activate]{activates} the new project: \itemize{ \item If using RStudio or Positron, the new project is opened in a new session, @@ -76,7 +80,8 @@ either cloning or \href{https://docs.github.com/en/get-started/quickstart/fork-a-repo}{fork-and-cloning}. In the fork-and-clone case, \code{create_from_github()} also does additional remote and branch setup, leaving you in the perfect position to make a pull -request with \code{\link[=pr_init]{pr_init()}}, one of several \link[=pull-requests]{functions for working with pull requests}. +request with \code{\link[=pr_init]{pr_init()}}, one of several \link[=pull-requests]{functions for working with pull requests}. Finally, it installs the dependencies of the +package, so you're set up to immediately start working on it. \code{create_from_github()} works best when your GitHub credentials are discoverable. See below for more about authentication.