
Update DataTables JS/CSS libraries (developer tool)
Source:R/dt2_check_updates.R
dt2_update_libs.RdChecks for updates (respecting version constraints), patches version
numbers in the source files, and optionally runs
tools/get-dt2-libs.sh to download the new files.
Arguments
- pkg_dir
Path to the DT2 source root (the directory containing
DESCRIPTION). Defaults to the current working directory.- download
Logical. If
TRUE, runs the shell script after patching version numbers. DefaultTRUE.- dry_run
Logical. If
TRUE, shows what would change without modifying any files. DefaultFALSE.
Details
This function only works from the package source tree (i.e. during development). It will refuse to run from an installed package.
The workflow is:
Query npm for the latest compatible version of every library.
Patch
tools/get-dt2-libs.sh(version variables).Patch
R/dt2_extensions.R(extension registry).Patch
R/dt2_check_updates.R(core lib versions).Patch
R/dt2_deps.R(DataTables core version).Run
bash tools/get-dt2-libs.shto download the files.
Version constraints prevent incompatible upgrades:
jQuery is pinned to 3.x (DataTables 2 requires jQuery 3).
pdfmake is pinned to 0.2.x (0.3.x has breaking changes and is not available on cdnjs).
Bootstrap is pinned to 5.x.
Libraries marked as "PINNED" are skipped. Only "UPDATE"
items are applied.
Examples
if (FALSE) { # \dontrun{
# Developer-only tool: requires the DT2 package source tree
# (DESCRIPTION, tools/get-dt2-libs.sh, R/dt2_extensions.R, ...).
# It cannot run from an installed package, so it is not executable
# in CRAN check or from a regular user session.
# from the DT2 source root:
dt2_update_libs()
# preview changes without modifying anything:
dt2_update_libs(dry_run = TRUE)
} # }