Skip to content

Commit c1f1b07

Browse files
committed
Try runiverse if no wasm package
1 parent b1af4db commit c1f1b07

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

.github/workflows/pkgdown.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,48 @@ jobs:
8585
}, envir = ns)
8686
})
8787
88+
# ── Fall back to r-universe for missing WASM binaries ──
89+
# repo.r-wasm.org can lag days/weeks behind CRAN for new
90+
# releases. r-universe builds WASM per-commit, so we
91+
# re-install from there to make shinylive look at the
92+
# r-universe WASM endpoint instead.
93+
# This means the r-universe (dev) version is bundled, not
94+
# the CRAN release — acceptable as a temporary measure.
95+
local({
96+
r_ver <- paste(R.version$major,
97+
sub("\\..*", "", R.version$minor), sep = ".")
98+
wasm_db <- tryCatch(
99+
available.packages(repos = paste0(
100+
"https://repo.r-wasm.org/bin/emscripten/contrib/", r_ver
101+
)),
102+
error = function(e) {
103+
message(" Could not reach repo.r-wasm.org")
104+
matrix(nrow = 0, ncol = 0,
105+
dimnames = list(NULL, character()))
106+
}
107+
)
108+
# Packages to check (extend as needed)
109+
pkgs <- "TreeTools"
110+
for (pkg in pkgs) {
111+
inst_ver <- as.character(packageVersion(pkg))
112+
wasm_ver <- if (pkg %in% rownames(wasm_db))
113+
wasm_db[pkg, "Version"] else NA_character_
114+
if (is.na(wasm_ver) ||
115+
package_version(wasm_ver) < package_version(inst_ver)) {
116+
message(pkg, " ", inst_ver,
117+
" WASM not on repo.r-wasm.org (have: ", wasm_ver,
118+
"); installing from r-universe")
119+
install.packages(pkg, repos = c(
120+
"https://ms609.r-universe.dev",
121+
getOption("repos")
122+
))
123+
} else {
124+
message(pkg, " ", wasm_ver, " WASM available on ",
125+
"repo.r-wasm.org; using CRAN version")
126+
}
127+
}
128+
})
129+
88130
# ── Locate app ──
89131
pkg_name <- read.dcf("DESCRIPTION")[, "Package"]
90132
app_dir <- system.file("treespace", package = pkg_name)

0 commit comments

Comments
 (0)