devtools icon indicating copy to clipboard operation
devtools copied to clipboard

`show_news()` only checks `{pkg}/NEWS`

Open arcresu opened this issue 2 years ago • 1 comments

The show_news() function is hard-coded to check only for NEWS in a package directory:

https://github.com/r-lib/devtools/blob/7cc2bdf74cbae90233fa6c84f221631d1876598d/R/show-news.R#L10

However (from the docs of utils::news()):

[...] it is attempted to read its news in structured form from files ‘inst/NEWS.Rd’, ‘NEWS.md’ (since R version 3.6.0, needs packages commonmark and xml2 to be available), ‘NEWS’ or ‘inst/NEWS’ (in that order).

This means that if a NEWS.md file exists, for example, there's a confusing error:

> show_news()
Error in `show_news()`:
! No NEWS found
Run `rlang::last_error()` to see where the error occurred.

It would be nice if show_news() could use the same search path as utils::news() does.

arcresu avatar Feb 23 '23 02:02 arcresu

If you'd like to make a PR, you could adapt related logic from build_readme():

https://github.com/r-lib/devtools/blob/45354cfadfa8340e8fad8d1ff8010d81883e0523/R/build-readme.R#L53-L67

jennybc avatar Nov 02 '23 23:11 jennybc