Skip to content
Open
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
1 change: 1 addition & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ Imports:
remotes (>= 2.5.0),
rlang (>= 1.1.6),
roxygen2 (>= 7.3.3),
rprojroot,
rversions (>= 2.1.2),
sessioninfo (>= 1.2.3),
stats,
Expand Down
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# devtools (development version)

* `check()` now runs `pkgdown::check_pkgdown()` optionally (@olivroy, #2449)

# devtools 2.4.6

* Functions that use httr now explicitly check that it is installed
Expand Down
24 changes: 24 additions & 0 deletions R/check.R
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
#' roxygen2 version matches the version declared in the `DESCRIPTION`
#' file. Use `TRUE` or `FALSE` to override the default.
#' @param build_args Additional arguments passed to `R CMD build`
#' @param pkgdown Should run [pkgdown::check_pkgdown()]?
#' @param ... Additional arguments passed on to [pkgbuild::build()].
#' @param vignettes If `FALSE`, do not build or check vignettes, equivalent to
#' using `args = '--ignore-vignettes'` and `build_args = '--no-build-vignettes'`.
Expand All @@ -61,6 +62,7 @@ check <- function(pkg = ".",
run_dont_test = FALSE,
args = "--timings",
env_vars = c(NOT_CRAN = "true"),
pkgdown = NULL,
quiet = FALSE,
check_dir = NULL,
cleanup = deprecated(),
Expand Down Expand Up @@ -90,6 +92,17 @@ check <- function(pkg = ".",
cli::cat_line()
}
}
pkgdown <- pkgdown %||% has_pkgdown(pkg$path)

if (pkgdown) {
if (!quiet) {
cat_rule("Checking pkgdown", col = "cyan", line = 2)
}
pkgdown::check_pkgdown(pkg = pkg$path)
if (!quiet) {
cli::cat_line()
}
}

if (!quiet) {
cat_rule("Building", col = "cyan", line = 2)
Expand Down Expand Up @@ -151,6 +164,17 @@ can_document <- function(pkg) {
}
}

has_pkgdown <- function(path) {
tryCatch(
!is.null(
rprojroot::find_root_file(
criterion = rprojroot::is_pkgdown_project,
path = path)
),
error = function(e) FALSE
)
}

#' @export
#' @rdname check
#' @param path Path to built package.
Expand Down
3 changes: 3 additions & 0 deletions man/check.Rd

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