Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Use bootstrap version from template package if not defined locally #2443

Merged

Conversation

gadenbuie
Copy link
Contributor

Fixes #2440
Supercedes #2441
cc @maelle

Bootstrap versions can come from two places:

  1. The local pkgdown config of the package being documented
  2. The pkgdown config of a template package used by the package being documented

Unfortunately, they're interconnected: A local pkgdown config may set a Bootstrap version that then changes the template used by the template package. OR a template package may provide the Bootstrap version, not sepcificied in the local config. I missed this nuance in #2395.

This PR updates the Bootstrap version check to first call get_boostrap_version() on the local pkg config. Then we separately call get_boostrap_version() for the template. This function throws if both template.bootstrap and template.bslib.version are used in the same config. The separate calls let us adjust the instructions for fixing the problem depending on whether the invalid config is local or part of the template package. Local Bootstrap versions override template versions, providing an easy escape hatch if the template package has an invalid config.

I wanted to ensure that _pkgdown.yml config files follow the same structure regardless of whether they appear in a local package or in a template package. I've added tests around all of the behavior described above. I also added a new test helper local_pkgdown_template_pkg() to easily spin up a new templatepackage test package.

@gadenbuie gadenbuie changed the title fix: Use to bootstrap version from template package if not defined locally fix: Use bootstrap version from template package if not defined locally Apr 15, 2024
…_version()`

The "how to fix this" instructions can make use of both pieces of information
@hadley hadley merged commit d139e03 into r-lib:main Apr 15, 2024
12 of 13 checks passed
@hadley
Copy link
Member

hadley commented Apr 15, 2024

Thanks!

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.

pkgdown now demands to set BS version in config when using a template package
2 participants