Files
shiny/tools/updatejQuery.R

41 lines
1.1 KiB
R

version <- "3.6.0"
jq_cdn_download <- function(version) {
Map(
src = c(".min.js", ".min.map", ".js"),
f = function(src) {
download.file(
file.path("https://code.jquery.com", paste0("jquery-", version, src)),
file.path("inst", "www", "shared", paste0("jquery", src))
)
}
)
}
jq_cdn_download(version)
download.file(
"https://raw.githubusercontent.com/jquery/jquery/master/AUTHORS.txt",
"inst/www/shared/jquery-AUTHORS.txt"
)
writeLines(
c(
"# Generated by tools/updatejQuery.R; do not edit by hand",
sprintf('version_jquery <- "%s"', version)
),
rprojroot::find_package_root_file("R", "version_jquery.R")
)
# Update TypeScript installation
withr::with_dir(
rprojroot::find_package_root_file("srcts"),
{
exit_code <- system(paste0("yarn add --dev jquery@", version))
if (exit_code != 0) stop("yarn could not install jquery")
exit_code <- system(paste0("yarn add --dev @types/jquery@patch:@types/jquery@", version, "#./patch/types-jquery.patch"))
if (exit_code != 0) stop("yarn could not install @types/jquery")
}
)