Skip to content

Add more project criteria #2139

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
* `use_package(min_version = FALSE)` is treated the same as when `min_version`
is not specified (#2117, @salim-b).

* usethis's criteria for recognizing a project have expanded to include (#2133):
- a `.vscode/` directory, which Positron or VS Code might create
- a `_quarto.yml` file, typical of a Quarto project
- an `renv.lock` file, which renv creates

# usethis 3.1.0

* `use_vignette()` and `use_article()` support Quarto. The `name` of the new
Expand Down
26 changes: 19 additions & 7 deletions R/proj.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,25 @@ proj_set_ <- function(path) {
#' Most `use_*()` functions act on the **active project**. If it is
#' unset, usethis uses [rprojroot](https://rprojroot.r-lib.org) to
#' find the project root of the current working directory. It establishes the
#' project root by looking for a `.here` file, an RStudio Project, a package
#' `DESCRIPTION`, Git infrastructure, a `remake.yml` file, or a `.projectile`
#' file. It then stores the active project for use for the remainder of the
#' project root by looking for signs such as:
#' * a `.here` file
#' * an RStudio Project, i.e. a `.Rproj` file
#' * an R package, i.e. a `DESCRIPTION` file
#' * a Git repository
#' * a Positron or VS Code workspace, i.e. a `.vscode/` directory
#' * a Quarto project, i.e. a `_quarto.yml` file
#' * an renv project, i.e. a `renv.lock` file
#'
#' usethis then stores the active project for use for the remainder of the
#' session.
#'
#' In general, end user scripts should not contain direct calls to
#' `usethis::proj_*()` utility functions. They are internal functions that are
#' exported for occasional interactive use or use in packages that extend
#' usethis. End user code should call functions in
#' [rprojroot](https://rprojroot.r-lib.org) or its simpler companion,
#' [here](https://here.r-lib.org), to programmatically detect a project and
#' build paths within it.
#' usethis. End user code should call `here::here()` or other functions from
#' the [here](https://here.r-lib.org) or
#' [rprojroot](https://rprojroot.r-lib.org) packages to programmatically
#' detect a project and build paths within it.
#'
#' If you are puzzled why a path (usually the current working directory) does
#' *not* appear to be inside project, it can be helpful to call
Expand Down Expand Up @@ -190,6 +197,11 @@ proj_crit <- function() {
rprojroot::is_rstudio_project |
rprojroot::is_r_package |
rprojroot::is_git_root |
# use rprojroot::is_vscode_project at some point in the future
# https://github.com/r-lib/rprojroot/pull/157
rprojroot::has_dir(".vscode") |
rprojroot::is_quarto_project |
rprojroot::is_renv_project |
rprojroot::is_remake_project |
rprojroot::is_projectile_project
}
Expand Down
4 changes: 2 additions & 2 deletions inst/WORDLIST
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ LinkingTo
METACRAN
Makefile
ORCID
OpenVSX
PATs
PBC
PRs
Expand Down Expand Up @@ -133,7 +132,6 @@ labelled
labelling
learnr
libgit
libyajl
lifecycle
ly
macbook
Expand Down Expand Up @@ -164,6 +162,7 @@ readme
rebase
reconfigures
redirections
renv
repo
repo's
repos
Expand Down Expand Up @@ -207,6 +206,7 @@ useR
usethis's
ver
vm
wc
withr
xyz
xz
Expand Down
23 changes: 16 additions & 7 deletions man/proj_utils.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/use_air.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading