r-lib / devtools

Tools to make an R developer's life easier
https://devtools.r-lib.org
Other
2.37k stars 755 forks source link

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

Open arcresu opened 1 year ago

arcresu commented 1 year ago

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.

jennybc commented 8 months ago

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