-
Notifications
You must be signed in to change notification settings - Fork 763
Deprecate build_vignettes() and clean_vignettes()
#2648
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
Changes from 1 commit
a4e531b
28bcc59
1d936b2
94b51d8
0eb0b6e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,14 +1,11 @@ | ||
| #' Build package vignettes. | ||
| #' Build package vignettes | ||
| #' | ||
| #' Builds package vignettes using the same algorithm that `R CMD build` | ||
| #' does. This means including non-Sweave vignettes, using makefiles (if | ||
| #' present), and copying over extra files. The files are copied in the 'doc' | ||
| #' directory and an vignette index is created in 'Meta/vignette.rds', as they | ||
| #' would be in a built package. 'doc' and 'Meta' are added to | ||
| #' `.Rbuildignore`, so will not be included in the built package. These | ||
| #' files can be checked into version control, so they can be viewed with | ||
| #' `browseVignettes()` and `vignette()` if the package has been | ||
| #' loaded with `load_all()` without needing to re-build them locally. | ||
| #' @description | ||
| #' `r lifecycle::badge("deprecated")` | ||
| #' | ||
| #' `build_vignettes()` is deprecated because we no longer recommend that you | ||
| #' build and check in vignettes. Instead, use `pkgdown::build_article()` to | ||
|
hadley marked this conversation as resolved.
Outdated
|
||
| #' render articles locally for preview and polishing. | ||
| #' | ||
| #' @template devtools | ||
| #' @param quiet If `TRUE`, suppresses most output. Set to `FALSE` | ||
|
|
@@ -22,11 +19,8 @@ | |
| #' @inheritParams tools::buildVignettes | ||
| #' @inheritParams remotes::install_deps | ||
| #' @importFrom stats update | ||
| #' @keywords programming | ||
| #' @seealso [clean_vignettes()] to remove the pdfs in | ||
| #' \file{doc} created from vignettes | ||
| #' @keywords internal | ||
| #' @export | ||
| #' @seealso [clean_vignettes()] to remove build tex/pdf files. | ||
| build_vignettes <- function( | ||
| pkg = ".", | ||
| dependencies = "VignetteBuilder", | ||
|
|
@@ -36,12 +30,13 @@ build_vignettes <- function( | |
| install = TRUE, | ||
| keep_md = TRUE | ||
| ) { | ||
| lifecycle::deprecate_warn("2.5.0", "build_vignettes()") | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we want to point folks towards
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's not a one-for-one replacement, so I'd prefer to leave that for the docs. |
||
| pkg <- as.package(pkg) | ||
| save_all() | ||
|
|
||
| vigns <- tools::pkgVignettes(dir = pkg$path) | ||
| if (length(vigns$docs) == 0) { | ||
| return() | ||
| return(invisible()) | ||
| } | ||
|
|
||
| deps <- remotes::dev_package_deps(pkg$path, dependencies) | ||
|
|
@@ -86,18 +81,22 @@ create_vignette_index <- function(pkg, vigns) { | |
| saveRDS(vignette_index, vignette_index_path, version = 2L) | ||
| } | ||
|
|
||
| #' Clean built vignettes. | ||
| #' Clean built vignettes | ||
| #' | ||
| #' @description | ||
| #' `r lifecycle::badge("deprecated")` | ||
| #' | ||
| #' This uses a fairly rudimentary algorithm where any files in \file{doc} | ||
| #' with a name that exists in \file{vignettes} are removed. | ||
| #' `clean_vignettes()` is deprecated because [build_vignettes()] is deprecated. | ||
| #' | ||
| #' @template devtools | ||
| #' @keywords internal | ||
| #' @export | ||
| clean_vignettes <- function(pkg = ".") { | ||
| lifecycle::deprecate_warn("2.5.0", "clean_vignettes()") | ||
| pkg <- as.package(pkg) | ||
| vigns <- tools::pkgVignettes(dir = pkg$path) | ||
| if (path_file(vigns$dir) != "vignettes") { | ||
| return() | ||
| if (length(vigns$docs) == 0 || path_file(vigns$dir) != "vignettes") { | ||
| return(invisible()) | ||
| } | ||
|
|
||
| cli::cli_inform(c( | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| # build_vignettes() and clean_vignettes() are deprecated | ||
|
|
||
| Code | ||
| build_vignettes(pkg) | ||
| Condition | ||
| Warning: | ||
| `build_vignettes()` was deprecated in devtools 2.5.0. | ||
| Code | ||
| clean_vignettes(pkg) | ||
| Condition | ||
| Warning: | ||
| `clean_vignettes()` was deprecated in devtools 2.5.0. | ||
|
|
Uh oh!
There was an error while loading. Please reload this page.