Skip to content
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

rdev 1.8.2 #170

Merged
merged 10 commits into from
Nov 25, 2023
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
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: rdev
Title: R Development Tools
Version: 1.8.1
Version: 1.8.2
Authors@R:
person("John", "Benninghoff", , "[email protected]", role = c("aut", "cre"),
comment = c(ORCID = "0000-0002-6230-4742"))
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export(use_codecov)
export(use_lintr)
export(use_package_r)
export(use_rdev_package)
export(use_rdev_pkgdown)
export(use_rprofile)
export(use_spelling)
export(use_todo)
Expand Down
6 changes: 6 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# rdev 1.8.2

* Added rendering fixes to `use_analysis_package()` (update: re-run `use_analysis_package()` and update notebooks from Analysis Notebook template)

* Added function `use_rdev_pkgdown()`: add pkgdown with rdev customizations

# rdev 1.8.1

* Added support for [Visual Studio Code](https://code.visualstudio.com) to `setup-r`
Expand Down
40 changes: 39 additions & 1 deletion R/setup.R
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,10 @@ use_rdev_package <- function(quiet = TRUE) {
#' When run, `use_analysis_package()`:
#' 1. Creates analysis package directories
#' 1. Adds exclusions to .gitignore and .Rbuildignore
#' 1. Adds `extra.css` to `analysis/assets` and `pkgdown` (when `use_quarto` is `FALSE`) to fix
#' rendering of GitHub-style
# nolint next: line_length_linter.
#' [task lists](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/about-task-lists)
#' 1. Adds `.nojekyll`, `_quarto.yml` and `index.qmd` from templates OR creates `_base.yml` in
#' `pkgdown` from the first `URL` in `DESCRIPTION`
#' 1. Installs the `README.Rmd` template for analysis packages, and the `dplyr`
Expand Down Expand Up @@ -532,6 +536,8 @@ use_analysis_package <- function(use_quarto = TRUE, prompt = FALSE) {
usethis::use_build_ignore(analysis_rbuildignore, escape = FALSE)
sort_rbuildignore()

usethis::use_template("extra.css", save_as = "analysis/assets/extra.css", package = "rdev")

urls <- desc::desc_get_urls()
github_repo <- get_github_repo()
if (use_quarto) {
Expand All @@ -548,8 +554,12 @@ use_analysis_package <- function(use_quarto = TRUE, prompt = FALSE) {
usethis::use_template("index.qmd", package = "rdev", data = fields)
} else {
if (length(urls) >= 1 && !fs::file_exists("pkgdown/_base.yml")) {
yaml::write_yaml(list(url = urls[1], template = list(bootstrap = 5L)), "pkgdown/_base.yml")
yaml::write_yaml(
list(url = urls[1], template = list(bootstrap = 5L, bslib = list(preset = "bootstrap"))),
"pkgdown/_base.yml"
)
}
usethis::use_template("extra.css", save_as = "pkgdown/extra.css", package = "rdev")
}

# always overwrite README.Rmd
Expand Down Expand Up @@ -581,3 +591,31 @@ use_analysis_package <- function(use_quarto = TRUE, prompt = FALSE) {
)
return(invisible(ret))
}

#' Use rdev pkgdown
#'
#' Add pkgdown with rdev customizations. Implemented as a wrapper for [usethis::use_pkgdown()].
#'
#' In addition to running [usethis::use_pkgdown()], `use_rdev_pkgdown` adds `extra.css` to
#' `pkgdown` to fix rendering of GitHub-style
# nolint next: line_length_linter.
#' [task lists](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/about-task-lists),
#' and disables the [bslib::bs_theme()] `"shiny"` preset.
#'
#' @inheritParams usethis::use_pkgdown
#'
#' @export
use_rdev_pkgdown <- function(config_file = "_pkgdown.yml", destdir = "docs") {
usethis::use_pkgdown(config_file = config_file, destdir = destdir)
fs::dir_create("pkgdown")
usethis::use_template("extra.css", save_as = "pkgdown/extra.css", package = "rdev")
pkg <- yaml::read_yaml(config_file)
pkg$template$bslib$preset <- "bootstrap"
# workaround for RStudio race condition
if (rlang::is_interactive()) {
writeLines(paste0("\nupdating ", config_file, "..."), sep = "")
Sys.sleep(1)
writeLines("done!")
}
yaml::write_yaml(pkg, config_file)
}
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -224,10 +224,10 @@ ci()
#> * creating vignettes ... OK
#> * checking for LF line-endings in source and make files and shell scripts
#> * checking for empty or unneeded directories
#> * building ‘rdev_1.8.1.tar.gz’
#> * building ‘rdev_1.8.2.tar.gz’
#>
#> ── R CMD check ─────────────────────────────────────────────────────────────────
#> * using log directory ‘/private/var/folders/vn/cw5f9gws42v9m8mdsds_zbl00000gp/T/RtmpK1M3iQ/filedb8a12319cdc/rdev.Rcheck’
#> * using log directory ‘/private/var/folders/vn/cw5f9gws42v9m8mdsds_zbl00000gp/T/RtmpdCTAO3/file51204113e3f/rdev.Rcheck’
#> * using R version 4.3.2 (2023-10-31)
#> * using platform: aarch64-apple-darwin20 (64-bit)
#> * R was compiled by
Expand All @@ -237,7 +237,7 @@ ci()
#> * using session charset: UTF-8
#> * using option ‘--no-manual’
#> * checking for file ‘rdev/DESCRIPTION’ ... OK
#> * this is package ‘rdev’ version ‘1.8.1
#> * this is package ‘rdev’ version ‘1.8.2
#> * package encoding: UTF-8
#> * checking package namespace information ... OK
#> * checking package dependencies ... OK
Expand Down Expand Up @@ -297,8 +297,8 @@ ci()
#> * DONE
#>
#> Status: OK
#> ── R CMD check results ───────────────────────────────────────── rdev 1.8.1 ────
#> Duration: 29.7s
#> ── R CMD check results ───────────────────────────────────────── rdev 1.8.2 ────
#> Duration: 32.4s
#>
#> 0 errors ✔ | 0 warnings ✔ | 0 notes ✔
```
114 changes: 57 additions & 57 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,56 +2,56 @@

## Content

- [x] &nbsp;Add README.Rmd
- [x] &nbsp;Update `DESCRIPTION` and use description data in `README.Rmd`
- [x] &nbsp;Add ORCID
- [x] Add README.Rmd
- [x] Update `DESCRIPTION` and use description data in `README.Rmd`
- [x] Add ORCID

## Package

- [x] &nbsp;Write a utility function to sort `.Rbuildignore`
- [x] &nbsp;Implement [pkgdown](https://pkgdown.r-lib.org)
- [x] &nbsp;Add links / update [Rd formatting](https://roxygen2.r-lib.org/articles/rd-formatting.html) for all function documentation.
- [x] &nbsp;Add dummy imports to silence R CMD check note per [tidyverse](https://github.com/tidyverse/tidyverse/blob/master/R/tidyverse.R)
- [x] &nbsp;Migrate `build_analysis_site()` to rdev
- [x] &nbsp;Switch from development version of `styler` (1.3.2.9000) when a new release becomes available
- [x] &nbsp;~~Validate that `lint_all` works as expected within `ci`~~
- [x] &nbsp;Add 'create package' workflow example to README, remove TODO section "Analysis package creation process"
- [x] &nbsp;Move `_pkgdown.yml` to repository root to make projects discoverable by the [pgkdown](https://pkgdown.r-lib.org) GitHub [query](https://github.com/search?q=filename%3Apkgdown.yml+path%3A%2F&type=Code)
- [x] &nbsp;Update `README.Rmd` template to dynamically generate list of notebooks in `analysis`
- [x] &nbsp;Automate release process
- [x] &nbsp;Automate creation of feature branches, including 'Bump version' using `desc::desc_bump_version("dev")`
- [x] &nbsp;Add check to `stage_release()` to look for missing topics in `_pkgdown.yml` reference section
- [x] &nbsp;Update `use_rdev_package()`
- [x] &nbsp;Handle `.Rmd` files that already have an `html_document` section
- [x] &nbsp;Move `rmd_metadata()` from README-analysis.Rmd to rdev package
- [x] &nbsp;Add tests per comments in `R/` after reading package book, documentation
- [x] &nbsp;Update Roxygen comments after reading package book, documentation, review and merge duplicate Roxygen docs
- [x] &nbsp;Write a manual regression test script (notes with R commands) ~~as a vignette~~ to validate 'Creating Packages' ~~and 'GitHub Releases'~~
- [x] &nbsp;Add messages, warnings to `build_analysis_site()` to report on progress
- [x] &nbsp;Add function to spell check notebooks
- [x] &nbsp;Automate branch protection
- [x] &nbsp;Address issue <https://github.com/r-lib/usethis/issues/1568>, which has been closed
- [x] &nbsp;Add dplyr when running `use_analysis_package()`
- [x] &nbsp;~~Consider switching `getOption("pkgType")` from `source` to `both` per R [options](https://stat.ethz.ch/R-manual/R-devel/library/base/html/options.html)~~ per the [R macOS FAQ](https://cran.r-project.org/bin/macosx/RMacOSX-FAQ.html#What-is-the-difference-between-the-CRAN-build-and-a-vanilla-build_003f), "Only the CRAN build is guaranteed to be compatible with the package binaries on CRAN (or Bioconductor)."
- [x] &nbsp;Support creating repos in organizations
- [x] &nbsp;~~Consider incorporating the GitHub description into `DESCRIPTION`~~
- [x] &nbsp;Create a wrapper for `spelling` that includes notebooks in package spell checking, WORDLIST
- [x] &nbsp;Add a `spell_check_test_notebooks()` function for CI spellchecks on notebooks
- [x] &nbsp;Convert manual tests (`Setup.Rmd`) into an R Script that can be run from within the package created with `create_github_repo()`
- [x] &nbsp;Add a function to add missing (notebook) dependencies to DESCRIPTION, see `renv::dependencies()` and `desc::desc_get_deps()`
- [x] &nbsp;Add `check_renv()` to `ci()` and stop if `renv::status()` is not up to date
- [x] &nbsp;Replace proof-docs with [urlchecker](https://urlchecker.r-lib.org), support checking GitHub Pages `docs` directory using `url_db_from_HTML_files` ~~(ask if a PR for this would be accepted)~~
- [x] &nbsp;Move scripts from `tools` to `inst/bin` or similar, per [Stack Overflow](https://stackoverflow.com/questions/26104709/is-there-any-special-functionality-in-r-package-exec-or-tools-directories) and [R Packages](https://r-pkgs.org/inst.html#inst-other-langs)
- [x] &nbsp;Switch from development versions of `styler` (1.3.2.9000) and `lintr` (2.0.1.9000) when a new release becomes available - both were needed to address bugs in the current release versions, 1.3.2 and 2.0.1.
- [x] &nbsp;Add trailing slash to GitHub Pages URL
- [x] &nbsp;Update `lint_all()` to lint all types, including `.Rpres`
- [x] &nbsp;~~Add custom CSS files to [`_site.yml`](https://rmarkdown.rstudio.com/docs/reference/render_site.html) and analysis notebook templates to control font size, as described in this [article](https://medium.com/@HadrienD/how-to-customize-font-size-in-r-markdown-documents-f5adff36e2cc), or possibly using [`bs_theme()`](https://rstudio.github.io/bslib/articles/theming.html), since pkgdown customizes the default using [`build_bslib()`](https://github.com/r-lib/pkgdown/blob/main/R/theme.R)~~ (issue exists in unsupported Safari 14 but not Safari 15)
- [ ] &nbsp;Follow up on `bslib` [breaking change](https://rstudio.github.io/bslib/news/index.html#bslib-060) defaulting to `preset="shiny"`
- [ ] &nbsp;Investigate `&nbsp;` workaround for TODO lists
- [ ] &nbsp;Replace `dev = TRUE` logic if <https://github.com/rstudio/renv/issues/1695> is accepted
- [ ] &nbsp;Update errors and messages after reading Advanced R [Conditions](https://adv-r.hadley.nz/conditions.html) and re-reading the Tidyverse [Style Guide](https://style.tidyverse.org/index.html)
- [ ] &nbsp;Establish default [knitr options](https://yihui.org/knitr/options/), including `knitr::opts_chunk$set(fig.align = "center"")`, add to analysis template, also review [settings](https://github.com/hadley/adv-r/blob/master/common.R) for *Advanced R*
- [ ] &nbsp;Reduce the number of Imports, per R CMD check:
- [x] Write a utility function to sort `.Rbuildignore`
- [x] Implement [pkgdown](https://pkgdown.r-lib.org)
- [x] Add links / update [Rd formatting](https://roxygen2.r-lib.org/articles/rd-formatting.html) for all function documentation.
- [x] Add dummy imports to silence R CMD check note per [tidyverse](https://github.com/tidyverse/tidyverse/blob/master/R/tidyverse.R)
- [x] Migrate `build_analysis_site()` to rdev
- [x] Switch from development version of `styler` (1.3.2.9000) when a new release becomes available
- [x] ~~Validate that `lint_all` works as expected within `ci`~~
- [x] Add 'create package' workflow example to README, remove TODO section "Analysis package creation process"
- [x] Move `_pkgdown.yml` to repository root to make projects discoverable by the [pgkdown](https://pkgdown.r-lib.org) GitHub [query](https://github.com/search?q=filename%3Apkgdown.yml+path%3A%2F&type=Code)
- [x] Update `README.Rmd` template to dynamically generate list of notebooks in `analysis`
- [x] Automate release process
- [x] Automate creation of feature branches, including 'Bump version' using `desc::desc_bump_version("dev")`
- [x] Add check to `stage_release()` to look for missing topics in `_pkgdown.yml` reference section
- [x] Update `use_rdev_package()`
- [x] Handle `.Rmd` files that already have an `html_document` section
- [x] Move `rmd_metadata()` from README-analysis.Rmd to rdev package
- [x] Add tests per comments in `R/` after reading package book, documentation
- [x] Update Roxygen comments after reading package book, documentation, review and merge duplicate Roxygen docs
- [x] Write a manual regression test script (notes with R commands) ~~as a vignette~~ to validate 'Creating Packages' ~~and 'GitHub Releases'~~
- [x] Add messages, warnings to `build_analysis_site()` to report on progress
- [x] Add function to spell check notebooks
- [x] Automate branch protection
- [x] Address issue <https://github.com/r-lib/usethis/issues/1568>, which has been closed
- [x] Add dplyr when running `use_analysis_package()`
- [x] ~~Consider switching `getOption("pkgType")` from `source` to `both` per R [options](https://stat.ethz.ch/R-manual/R-devel/library/base/html/options.html)~~ per the [R macOS FAQ](https://cran.r-project.org/bin/macosx/RMacOSX-FAQ.html#What-is-the-difference-between-the-CRAN-build-and-a-vanilla-build_003f), "Only the CRAN build is guaranteed to be compatible with the package binaries on CRAN (or Bioconductor)."
- [x] Support creating repos in organizations
- [x] ~~Consider incorporating the GitHub description into `DESCRIPTION`~~
- [x] Create a wrapper for `spelling` that includes notebooks in package spell checking, WORDLIST
- [x] Add a `spell_check_test_notebooks()` function for CI spellchecks on notebooks
- [x] Convert manual tests (`Setup.Rmd`) into an R Script that can be run from within the package created with `create_github_repo()`
- [x] Add a function to add missing (notebook) dependencies to DESCRIPTION, see `renv::dependencies()` and `desc::desc_get_deps()`
- [x] Add `check_renv()` to `ci()` and stop if `renv::status()` is not up to date
- [x] Replace proof-docs with [urlchecker](https://urlchecker.r-lib.org), support checking GitHub Pages `docs` directory using `url_db_from_HTML_files` ~~(ask if a PR for this would be accepted)~~
- [x] Move scripts from `tools` to `inst/bin` or similar, per [Stack Overflow](https://stackoverflow.com/questions/26104709/is-there-any-special-functionality-in-r-package-exec-or-tools-directories) and [R Packages](https://r-pkgs.org/inst.html#inst-other-langs)
- [x] Switch from development versions of `styler` (1.3.2.9000) and `lintr` (2.0.1.9000) when a new release becomes available - both were needed to address bugs in the current release versions, 1.3.2 and 2.0.1.
- [x] Add trailing slash to GitHub Pages URL
- [x] Update `lint_all()` to lint all types, including `.Rpres`
- [x] ~~Add custom CSS files to [`_site.yml`](https://rmarkdown.rstudio.com/docs/reference/render_site.html) and analysis notebook templates to control font size, as described in this [article](https://medium.com/@HadrienD/how-to-customize-font-size-in-r-markdown-documents-f5adff36e2cc), or possibly using [`bs_theme()`](https://rstudio.github.io/bslib/articles/theming.html), since pkgdown customizes the default using [`build_bslib()`](https://github.com/r-lib/pkgdown/blob/main/R/theme.R)~~ (issue exists in unsupported Safari 14 but not Safari 15)
- [ ] Remove `preset: bootstrap` if <https://github.com/r-lib/pkgdown/issues/2376> is accepted
- [ ] Remove `pkgdown/extra.css` if <https://github.com/r-lib/pkgdown/issues/2377> is accepted
- [ ] Replace `dev = TRUE` logic if <https://github.com/rstudio/renv/issues/1695> is accepted
- [ ] Update errors and messages after reading Advanced R [Conditions](https://adv-r.hadley.nz/conditions.html) and re-reading the Tidyverse [Style Guide](https://style.tidyverse.org/index.html)
- [ ] Establish default [knitr options](https://yihui.org/knitr/options/), including `knitr::opts_chunk$set(fig.align = "center"")`, add to analysis template, also review [settings](https://github.com/hadley/adv-r/blob/master/common.R) for *Advanced R*
- [ ] Reduce the number of Imports, per R CMD check:

```
> checking package dependencies ... NOTE
Expand All @@ -63,13 +63,13 @@

## GitHub

- [x] &nbsp;Set up [GitHub Actions](https://usethis.r-lib.org/reference/github_actions.html)
- [x] &nbsp;Use [standard](https://github.com/r-lib/actions/blob/master/examples/check-standard.yaml) `R CMD check`
- [x] &nbsp;Use [lintr](https://github.com/r-lib/actions/blob/master/examples/lint.yaml)
- [x] &nbsp;Faster CI checks
- [x] &nbsp;~~Switch to [full](https://github.com/r-lib/actions/blob/master/examples/check-full.yaml) `R CMD check` ?~~
- [x] &nbsp;Update GitHub Actions from r-lib [examples](https://github.com/r-lib/actions/tree/master/examples)
- [x] &nbsp;Run [test coverage](https://github.com/r-lib/actions/blob/master/examples/test-coverage.yaml)
- [x] &nbsp;~~Skip CI checks for changes in only the `docs/` directory~~
- [x] &nbsp;~~Add GitHub Action for html/link checking using something like [htmlproofer](https://github.com/gjtorikian/html-proofer)~~
- [x] &nbsp;~~Autobuild `docs/` like [pkgdown](https://github.com/r-lib/actions/blob/master/examples/pkgdown.yaml) ?~~
- [x] Set up [GitHub Actions](https://usethis.r-lib.org/reference/github_actions.html)
- [x] Use [standard](https://github.com/r-lib/actions/blob/master/examples/check-standard.yaml) `R CMD check`
- [x] Use [lintr](https://github.com/r-lib/actions/blob/master/examples/lint.yaml)
- [x] Faster CI checks
- [x] ~~Switch to [full](https://github.com/r-lib/actions/blob/master/examples/check-full.yaml) `R CMD check` ?~~
- [x] Update GitHub Actions from r-lib [examples](https://github.com/r-lib/actions/tree/master/examples)
- [x] Run [test coverage](https://github.com/r-lib/actions/blob/master/examples/test-coverage.yaml)
- [x] ~~Skip CI checks for changes in only the `docs/` directory~~
- [x] ~~Add GitHub Action for html/link checking using something like [htmlproofer](https://github.com/gjtorikian/html-proofer)~~
- [x] ~~Autobuild `docs/` like [pkgdown](https://github.com/r-lib/actions/blob/master/examples/pkgdown.yaml) ?~~
1 change: 1 addition & 0 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ reference:
- use_lintr
- use_package_r
- use_rdev_package
- use_rdev_pkgdown
- use_rprofile
- use_spelling
- use_todo
Expand Down
Loading