Files
shiny/tools/updateStrftime.R
2025-08-04 16:07:39 -04:00

34 lines
716 B
R
Executable File

#!/usr/bin/env Rscript
# This script downloads strftime-min.js from its GitHub repository,
# https://github.com/samsonjs/strftime
# This script can be sourced from RStudio, or run with Rscript.
version <- "0.9.2"
ref <- paste0("v", version)
destdir <- rprojroot::find_package_root_file(
"inst",
"www",
"shared",
"strftime"
)
download.file(
paste0(
"https://raw.githubusercontent.com/samsonjs/strftime/",
ref,
"/strftime-min.js"
),
destfile = file.path(destdir, "strftime-min.js")
)
writeLines(
c(
"# Generated by tools/updateStrftime.R; do not edit by hand",
sprintf('version_strftime <- "%s"', version)
),
rprojroot::find_package_root_file("R", "version_strftime.R")
)