fix: Use bootstrap version from template package if not defined locally #2443
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #2440
Supercedes #2441
cc @maelle
Bootstrap versions can come from two places:
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 localpkg
config. Then we separately callget_boostrap_version()
for the template. This function throws if bothtemplate.bootstrap
andtemplate.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 helperlocal_pkgdown_template_pkg()
to easily spin up a newtemplatepackage
test package.