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
Create plotly.js bundle map programmatically #2336
base: master
Are you sure you want to change the base?
Conversation
Creates the proper `bundleTraceMap` list as internal data object directly from the upstream JS file when updating plotly.js. This commit adds an updated `bundleTraceMap` for the currently used plotly.js v2.11.1 to `R/sysdata.rda`.
Note that the failing tests are unrelated to this PR, AFAICT. |
@@ -23,7 +23,7 @@ Description: Create interactive web graphics from 'ggplot2' graphs and/or a cust | |||
URL: https://plotly-r.com, https://github.com/plotly/plotly.R, https://plotly.com/r/ | |||
BugReports: https://github.com/plotly/plotly.R/issues | |||
Depends: | |||
R (>= 3.2.0), | |||
R (>= 3.5), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a requirement for R's latest serialization format (v3), cf. this line. We could stay on the v2 format if it's really important to support R < 3.5.
tools/update_plotlyjs.R
Outdated
yay::gh_text_file(path = "tasks/util/constants.js", | ||
owner = "plotly", | ||
name = "plotly.js", | ||
rev = basename(zip)) |> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I'd prefer {gh}
for this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yay::gh_text_file()
uses gh::gh_gql()
under the hood. Unfortunately, the maintainers are not up for inclusion of higher-level GraphQL functions, I've asked.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addendum: I've just realized that it's easy to fetch a file from a certain Git tag directly via GitHub URLs. For v2.11.1, the URL is:
https://raw.githubusercontent.com/plotly/plotly.js/v2.11.1/tasks/util/constants.js
So, no need for my yay package here. I'll update the PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've updated the PR accordingly and also added package namespace identifiers where missing to make non-base-R dependencies more visible.
This makes non-base-R dependencies clearly apparent
Creates the proper
bundleTraceMap
list as internal package data object directly from the upstream JS file when plotly.js is updated.The data is sourced from the file
tasks/util/constants.js
of the matching plotly.js Git tag viayay::gh_text_file()
, which I wrote. The package is not (yet) available on CRAN and thus must be installed viaremotes::install_gitlab("rpkg.dev/yay")
for the time being. I think this shouldn't be an issue sincetools/update_plotlyjs.R
is run manually during development and is not intended to be run by users.This commit adds an updated
bundleTraceMap
for the currently used plotly.js v2.11.1 toR/sysdata.rda
, which now also includes plotly.js'strict
bundle, so nowplotly::partial_bundle(type = "strict")
works as intended.