Skip to content

Commit 09f1459

Browse files
committed
refactor: avoid unnecessary download
1 parent 21c2f0e commit 09f1459

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

tools/update_plotlyjs.R

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -64,16 +64,9 @@ withr::with_dir(tmpdir, {
6464
)
6565
# update plot schema and (partial) bundles
6666
Schema <- jsonlite::fromJSON(Sys.glob("dist/plot-schema.json"))
67-
tmp_file <- tempfile(pattern = "plotly_constants_", fileext = ".js")
68-
utils::download.file(
69-
url = paste0("https://raw.githubusercontent.com/plotly/plotly.js/", basename(zip), "/tasks/util/constants.js"),
70-
destfile = tmp_file,
71-
quiet = TRUE,
72-
mode = "wb"
73-
)
7467
bundleTraceMap <-
75-
paste0(readLines(tmp_file), collapse = "\n") |>
76-
stringr::str_extract(pattern = "(?<=var partialBundleTraces = )\\{[^}]+\\}") |>
68+
paste0(readLines("tasks/util/constants.js"), collapse = "\n") |>
69+
stringr::str_extract(pattern = "(?<=\\b(const|var) partialBundleTraces = )\\{[^}]+\\}") |>
7770
yaml::read_yaml(text = _)
7871

7972
withr::with_dir(

0 commit comments

Comments
 (0)