Skip to content

Instantly share code, notes, and snippets.

Created June 12, 2023 03:41
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Create R package release checklists without requiring project or version control context
#' Create a release checklist without requiring context
#' @param package Package name.
#' @param version Release version number.
#' @param on_cran Is the package already on CRAN? Default is `TRUE`.
#' @param has_news Does the package use ``? Default is `TRUE`.
#' @param has_readme Does the package use `README.Rmd`? Default is `FALSE`.
#' @param has_lifecycle Does the package use lifecycle? Default is `FALSE`.
#' @return Release checklist in Markdown format (invisibly).
#' @examples
#' use_release_checklist("pkgname", version = "0.2.0")
#' use_release_checklist("pkgname", version = "0.1.0", on_cran = FALSE)
use_release_checklist <- function(
on_cran = TRUE,
has_news = TRUE,
has_readme = FALSE,
has_lifecycle = FALSE) {
checklist <- getFromNamespace("release_checklist", "usethis")
dir <- tempfile()
on.exit(unlink(dir, recursive = TRUE), add = TRUE)
withr::with_dir(dir, {
write(paste("Package:", package), "DESCRIPTION")
if (has_news) file.create("")
if (has_lifecycle) write("Imports: lifecycle", "DESCRIPTION", append = TRUE)
if (has_readme) file.create("README.Rmd")
mkd <- usethis::with_project(
dir, checklist(version = version, on_cran = on_cran),
quiet = TRUE
cat(mkd, sep = "\n")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment