From 6e6336e0769e7192728dc449e2e6062beda9b717 Mon Sep 17 00:00:00 2001 From: Hadley Wickham Date: Thu, 16 May 2024 11:07:39 -0400 Subject: [PATCH] Deprecate BS3 (#2545) --- NEWS.md | 1 + R/check.R | 7 +++++++ tests/testthat/_snaps/check.md | 13 +++++++++++++ tests/testthat/test-check.R | 8 ++++++++ 4 files changed, 29 insertions(+) diff --git a/NEWS.md b/NEWS.md index 9bc0c8a1d..43dd3b98d 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,6 @@ # pkgdown (development version) +* Bootstrap 3 has been deprecated. It was superseded in December 2021, and now we're starting to more directly encourage folks to move away from it. * Improve HTML5 compliance (#2369): * No longer support IE9 or earlier * Strip trailing whitespace diff --git a/R/check.R b/R/check.R index ac4ceab03..69761135c 100644 --- a/R/check.R +++ b/R/check.R @@ -35,6 +35,13 @@ pkgdown_sitrep <- function(pkg = ".") { cli::cli_rule("Sitrep") pkg <- as_pkgdown(pkg) + if (pkg$bs_version == 3) { + cli::cli_inform(c( + x = "Bootstrap 3 is deprecated; please switch to Bootstrap 5.", + i = "Learn more at {.url https://www.tidyverse.org/blog/2021/12/pkgdown-2-0-0/#bootstrap-5}." + )) + } + error_to_sitrep("URLs", check_urls(pkg)) error_to_sitrep("Open graph metadata", data_open_graph(pkg)) error_to_sitrep("Articles metadata", data_articles_index(pkg)) diff --git a/tests/testthat/_snaps/check.md b/tests/testthat/_snaps/check.md index 08744c86d..52d533696 100644 --- a/tests/testthat/_snaps/check.md +++ b/tests/testthat/_snaps/check.md @@ -1,3 +1,16 @@ +# sitrep complains about BS3 + + Code + pkgdown_sitrep(pkg) + Message + -- Sitrep ---------------------------------------------------------------------- + x Bootstrap 3 is deprecated; please switch to Bootstrap 5. + i Learn more at . + v URLs ok. + v Open graph metadata ok. + v Articles metadata ok. + v Reference metadata ok. + # sitrep reports all problems Code diff --git a/tests/testthat/test-check.R b/tests/testthat/test-check.R index 4d451f1fa..7a09611d4 100644 --- a/tests/testthat/test-check.R +++ b/tests/testthat/test-check.R @@ -1,3 +1,11 @@ +test_that("sitrep complains about BS3", { + pkg <- local_pkgdown_site(test_path("assets/open-graph"), meta = " + template: + bootstrap: 3 + ") + expect_snapshot(pkgdown_sitrep(pkg)) +}) + test_that("sitrep reports all problems", { pkg <- local_pkgdown_site(test_path("assets/reference"), meta = " reference: