pkgdown icon indicating copy to clipboard operation
pkgdown copied to clipboard

Invalid "use pkgdown::clean_site()" advice

Open Bisaloo opened this issue 1 year ago • 1 comments

When docs/ is not empty and not created by pkgdown, an error message will be returned:

https://github.com/r-lib/pkgdown/blob/c7c4865d9ebd492010c99db13a3e377cd1d9ed34/R/clean.R#L30-L41

But when running pkgdown::clean_site(), the same message is returned because clean_site() itself calls check_dest_is_pkgdown():

https://github.com/r-lib/pkgdown/blob/c7c4865d9ebd492010c99db13a3e377cd1d9ed34/R/clean.R#L19-L21

I can create a reprex package for this issue if helpful.

Bisaloo avatar Jul 06 '24 15:07 Bisaloo

Hmmm, I think it's the advice that's wrong here — clean_site() is specifically for cleaning up sites (as the name suggests 😄) not deleting directories that aren't sites.

hadley avatar Jul 06 '24 20:07 hadley

@Bisaloo what advice do you think pkgdown should provide in this case?

jayhesselberth avatar Nov 29 '24 20:11 jayhesselberth

Actually, in testing this, the advice is to "make sure it contains no important information and use pkgdown::clean_site() to delete its contents." So this would imply that clean_site() should delete anything in the directory, regardless of whether it was built by pkgdown or not.

jayhesselberth avatar Nov 29 '24 20:11 jayhesselberth

We could just add clean_site(force = TRUE) to skip the check that the directory was built by pkgdown.

jayhesselberth avatar Nov 29 '24 20:11 jayhesselberth