Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 74a4f4f

Browse files
committedSep 4, 2024
refactor: throw error if plotly.js bundle extraction fails
1 parent b96d782 commit 74a4f4f

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed
 

‎tools/update_plotlyjs.R

+6-2
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,12 @@ withr::with_dir(tmpdir, {
6666
Schema <- jsonlite::fromJSON("dist/plot-schema.json")
6767
bundleTraceMap <-
6868
paste0(readLines("tasks/util/constants.js"), collapse = "\n") |>
69-
stringr::str_extract(pattern = "(?<=\\b(const|var) partialBundleTraces = )\\{[^}]+\\}") |>
70-
yaml::read_yaml(text = _)
69+
stringr::str_extract(pattern = "(?<=\\b(const|var) partialBundleTraces = )\\{[^}]+\\}")
70+
71+
if (is.na(bundleTraceMap)) {
72+
stop("No `partialBundleTraces` variable definition found in Plotly source file `tasks/util/constants.js`. Does the regex pattern need an update?")
73+
}
74+
bundleTraceMap <- yaml::read_yaml(text = bundleTraceMap)
7175

7276
withr::with_dir(
7377
pkg_dir, usethis::use_data(

0 commit comments

Comments
 (0)
Please sign in to comment.