Closed nathaneastwood closed 1 year ago
Same issues here. However, I don't want to publish my tutorial with rsconnect. Is there any way to fix?
One "hack" is, in your pkgdown.yaml
, replace the block pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)
with the followings. This will prevent pkgdown
from building tutorials
- name: Build site
run: |
# pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)
ns <- asNamespace("pkgdown")
env <- new.env(parent = ns)
for(nm in names(ns)) {
if(is.function(ns[[nm]]) && !inherits(ns[[nm]], "memoised")) {
f <- ns[[nm]]
environment(f) <- env
env[[nm]] <- f
}
}
env$build_tutorials <- function(...){}
env$find_tutorials <- function(...){ return(character()) }
env$build_site(new_process = FALSE, install = FALSE, pkg = ".")
shell: Rscript {0}
@nathaneastwood a workaround would be to explicitly list the tutorials in the pkgdown config
I don't have any tutorials.
oh! even worse then, sorry.
find_tutorials()
is only run if inst/tutorials
or vignettes/tutorials
exists, so I'd suggest not using those directory names.
find_tutorials()
is only run ifinst/tutorials
orvignettes/tutorials
exists, so I'd suggest not using those directory names.
Gotcha. However, when I tried so, RStudio cannot find the tutorials nested within the package.
I guess learnr:::available_tutorials_for_package
only checks inst/tutorials
.
tutorials_dir <- system.file("tutorials", package = package)
if (!file.exists(tutorials_dir)) {
return(an_error(
"No tutorials found for package: \"", package, "\""
))
}
Maybe learnr
could add paths (such as inst/tutorials_offline
) to its search path as well? Tutorials added to this path will not be detected by pkgdown:::find_tutorials()
?
Alternatively, is it possible to skip building tutorials when rsconnect
is missing, or the authors choose not to publish their tutorials?
Alternatively, is it possible to skip building tutorials when rsconnect is missing, or the authors choose not to publish their tutorials?
This seems sensible to me. I discovered that a colleague of mine had actually added a folder named tutorials
to the inst
folder which is likely why my CICD pipeline was failing. I have had to rename this folder to avoid this issue which is fine, but I feel I shouldn't be restricted to certain folder names by a package.
@nathaneastwood pkgdown works by convention so it's a fundamental property of the package that certain folder names are out of bounds.
Approximately a week ago, my CICD pipeline to build the pkgdown site for an internal package started to fail with the following error:
As far as I can tell, there have been no relevant updates to
pkgdown
itself or torlang::check_installed()
, however there are updates inrlang
and specific mentions tocheck_installed()
in theNEWS.md
file forrlang
. Given thatrsconnect
is listed inSuggests
, I wouldn't expect this error to appear. For now, I have altered my pipeline toinstall.packages("pkgdown", dependencies = TRUE)
which will ensurersconnect
is installed which "fixes" my problem.