8000 feat: create plotly.js bundle map programmatically by salim-b · Pull Request #2336 · plotly/plotly.R · GitHub
[go: up one dir, main page]

Skip to content

feat: create plotly.js bundle map programmatically #2336

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Prev Previous commit
Next Next commit
refactor: avoid unnecessary download
  • Loading branch information
salim-b committed Sep 4, 2024
commit 09f1459ed8e7936e212c12212029f5a65035a4aa
11 changes: 2 additions & 9 deletions tools/update_plotlyjs.R
Original file line number Diff line number Diff line change
Expand Up @@ -64,16 +64,9 @@ withr::with_dir(tmpdir, {
)
# update plot schema and (partial) bundles
Schema <- jsonlite::fromJSON(Sys.glob("dist/plot-schema.json"))
tmp_file <- tempfile(pattern = "plotly_constants_", fileext = ".js")
utils::download.file(
url = paste0("https://raw.githubusercontent.com/plotly/plotly.js/", basename(zip), "/tasks/util/constants.js"),
destfile = tmp_file,
quiet = TRUE,
mode = "wb"
)
bundleTraceMap <-
paste0(readLines(tmp_file), collapse = "\n") |>
stringr::str_extract(pattern = "(?<=var partialBundleTraces = )\\{[^}]+\\}") |>
paste0(readLines("tasks/util/constants.js"), collapse = "\n") |>
stringr::str_extract(pattern = "(?<=\\b(const|var) partialBundleTraces = )\\{[^}]+\\}") |>
yaml::read_yaml(text = _)

withr::with_dir(
Expand Down
0