Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@jennybc
Copy link
Member

@jennybc jennybc commented Nov 8, 2022

Motivated by experiments made while updating R Packages

Basically I found it confusing that knitr was added to DESCRIPTION early on and then ... later ... rmarkdown was added.

I can't think of any reason why we had it this way and looking through git blame didn't shed any light either.

This seems more obvious and obviously correct to me.


BEFORE

> use_vignette("my-vignette")
✔ Adding 'knitr' to Suggests field in DESCRIPTIONSetting VignetteBuilder field in DESCRIPTION to 'knitr'Adding 'inst/doc' to '.gitignore'Creating 'vignettes/'Adding '*.html', '*.R' to 'vignettes/.gitignore'Adding 'rmarkdown' to Suggests field in DESCRIPTIONWriting 'vignettes/my-vignette.Rmd'Modify 'vignettes/my-vignette.Rmd'

AFTER

> use_vignette("my-vignette")
✔ Adding 'knitr' to Suggests field in DESCRIPTIONAdding 'rmarkdown' to Suggests field in DESCRIPTIONSetting VignetteBuilder field in DESCRIPTION to 'knitr'Adding 'inst/doc' to '.gitignore'Creating 'vignettes/'Adding '*.html', '*.R' to 'vignettes/.gitignore'Writing 'vignettes/my-vignette.Rmd'Modify 'vignettes/my-vignette.Rmd'

check_vignette_name(name)

use_dependency("knitr", "Suggests")
use_dependency("rmarkdown", "Suggests")
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hoisted this up out of a helper.

if (!"rmarkdown" %in% deps$package) {
ui_done("
Adding {ui_value('rmarkdown')} to {ui_field('Config/Needs/website')}")
use_description_list("Config/Needs/website", "rmarkdown")
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we're doing this here in use_article() specifically, we know enough to avoid adding markdown as an actual dependency in the case of an "articles only" package. I.e. then you only need it in Config/Needs/website.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems worthy of a news bullet.

use_git_ignore(c("*.html", "*.R"), directory = "vignettes")
use_dependency("rmarkdown", "Suggests")

if (!is.null(subdir)) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Drive-by change. I just prefer if (TRUE) instead of if (!TRUE).

use_directory(path("vignettes", subdir))
}
use_git_ignore(c("*.html", "*.R"), directory = "vignettes")
use_dependency("rmarkdown", "Suggests")
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't think of any reason why we did this here specifically 🤔

@jennybc jennybc requested a review from hadley November 8, 2022 20:41
@jennybc jennybc merged commit b9acf67 into main Nov 8, 2022
@jennybc jennybc deleted the refactor-use-vignette branch November 8, 2022 22:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants