-
Notifications
You must be signed in to change notification settings - Fork 633
/
Copy pathplotlyjs.R
37 lines (31 loc) · 1.1 KB
/
plotlyjs.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
library(httr)
# download latest GitHub release
# for a particular version: `zip <- "https://github.com/plotly/plotly.js/archive/v1.33.1.zip"`
x <- GET('https://api.github.com/repos/plotly/plotly.js/releases/latest')
zip <- content(x)$zipball_url
tmp <- tempfile(fileext = ".zip")
download.file(zip, tmp)
unzip(tmp)
# update the plotly.js bundle
file.copy(
Sys.glob("*plotly.js*/dist/plotly.min.js"),
"inst/htmlwidgets/lib/plotlyjs/plotly-latest.min.js",
overwrite = TRUE
)
# update the plotly.js LICENSE
file.copy(
Sys.glob("*plotly.js*/LICENSE"),
"inst/htmlwidgets/lib/plotlyjs/LICENSE",
overwrite = TRUE
)
# update the plot schema
Schema <- jsonlite::fromJSON(Sys.glob("*plotly.js*/dist/plot-schema.json"))
devtools::use_data(Schema, overwrite = T, internal = T)
# clean-up and bump HTML dependency version
unlink("*plotly.js*", recursive = T)
message("Manually update plotly.R with this version")
# download latest build from master
#download.file(
# "https://raw.githubusercontent.com/plotly/plotly.js/master/dist/plotly.min.js",
# destfile = "inst/htmlwidgets/lib/plotlyjs/plotly-latest.min.js"
#)