diff mbox series

[bug#42106,1/4] gnu: Add r-r2d3.

Message ID 20200628085745.15796-1-peterloleungyau@gmail.com
State New
Headers show
Series [bug#42106,1/4] gnu: Add r-r2d3. | expand

Checks

Context Check Description
cbaines/applying patch fail View Laminar job

Commit Message

Peter Lo June 28, 2020, 8:57 a.m. UTC
* gnu/packages/cran.scm (r-r2d3): New variable.
---
 gnu/packages/cran.scm | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

Comments

Ricardo Wurmus Sept. 11, 2020, 9:19 a.m. UTC | #1
Hi Peter,

> * gnu/packages/cran.scm (r-r2d3): New variable.

Unfortunately, I cannot merge this as is.  This package contains a bunch
of minified JavaScript files without the corresponding source code:

--8<---------------cut here---------------start------------->8---
r2d3/inst/www/d3/4.13.0/d3.min.js
r2d3/inst/www/d3/3.5.17/d3.min.js
r2d3/inst/www/d3/5.0.0/d3.min.js
r2d3/inst/htmlwidgets/lib/webcomponents/webcomponents.js
--8<---------------cut here---------------end--------------->8---

While we can easily replace the different d3 versions with non-minified
source code that we then minify in a build phase, we cannot do this for
webcomponents.js, which is compiled from TypeScript.  The source code is
here:

    https://github.com/webcomponents/polyfills/tree/master/packages/webcomponentsjs

Arun is currently working on packaging swc, a transpiler that supports
TypeScript, so with some luck we might then be able to transpile these
TypeScript source files to webcomponents.js.

Until then I cannot merge this, I’m afraid.
Peter Lo Sept. 12, 2020, 7:54 a.m. UTC | #2
Dear Ricardo,

Sorry that I was not aware of the problem regarding the javascript for
the R package, because I simply import it from CRAN. I will try to be
more careful in the future.

Regards,
Peter

On Fri, Sep 11, 2020 at 5:17 PM Ricardo Wurmus <rekado@elephly.net> wrote:
>
>
> Hi Peter,
>
> > * gnu/packages/cran.scm (r-r2d3): New variable.
>
> Unfortunately, I cannot merge this as is.  This package contains a bunch
> of minified JavaScript files without the corresponding source code:
>
> --8<---------------cut here---------------start------------->8---
> r2d3/inst/www/d3/4.13.0/d3.min.js
> r2d3/inst/www/d3/3.5.17/d3.min.js
> r2d3/inst/www/d3/5.0.0/d3.min.js
> r2d3/inst/htmlwidgets/lib/webcomponents/webcomponents.js
> --8<---------------cut here---------------end--------------->8---
>
> While we can easily replace the different d3 versions with non-minified
> source code that we then minify in a build phase, we cannot do this for
> webcomponents.js, which is compiled from TypeScript.  The source code is
> here:
>
>     https://github.com/webcomponents/polyfills/tree/master/packages/webcomponentsjs
>
> Arun is currently working on packaging swc, a transpiler that supports
> TypeScript, so with some luck we might then be able to transpile these
> TypeScript source files to webcomponents.js.
>
> Until then I cannot merge this, I’m afraid.
>
> --
> Ricardo
Ricardo Wurmus Aug. 30, 2021, 2:03 p.m. UTC | #3
Ricardo Wurmus <rekado@elephly.net> writes:

> Hi Peter,
>
>> * gnu/packages/cran.scm (r-r2d3): New variable.
>
> Unfortunately, I cannot merge this as is.  This package contains 
> a bunch
> of minified JavaScript files without the corresponding source 
> code:
>
> --8<---------------cut 
> here---------------start------------->8---
> r2d3/inst/www/d3/4.13.0/d3.min.js
> r2d3/inst/www/d3/3.5.17/d3.min.js
> r2d3/inst/www/d3/5.0.0/d3.min.js
> r2d3/inst/htmlwidgets/lib/webcomponents/webcomponents.js
> --8<---------------cut 
> here---------------end--------------->8---
>
> While we can easily replace the different d3 versions with 
> non-minified
> source code that we then minify in a build phase, we cannot do 
> this for
> webcomponents.js, which is compiled from TypeScript.  The source 
> code is
> here:
>
>     https://github.com/webcomponents/polyfills/tree/master/packages/webcomponentsjs

webcomponents.js looks very similar to this blob:

https://github.com/webcomponents/webcomponentsjs/blob/v2.0.1/webcomponents-bundle.js

> Arun is currently working on packaging swc, a transpiler that 
> supports
> TypeScript, so with some luck we might then be able to transpile 
> these
> TypeScript source files to webcomponents.js.

It’s a bit more complicated than that.  The source files import 
code from files in node_modules, which is supposed to be 
downloaded with npm.  If we can identify these actual source files 
we could include them explicitly.
diff mbox series

Patch

diff --git a/gnu/packages/cran.scm b/gnu/packages/cran.scm
index ab5e57c0e2..b92d3341b4 100644
--- a/gnu/packages/cran.scm
+++ b/gnu/packages/cran.scm
@@ -22325,3 +22325,33 @@  across a wide array of bioinformatic R packages.")
 and clustering large sequence datasets using fast alignment-free k-mer
 counting and recursive k-means partitioning.")
     (license license:gpl3)))
+
+(define-public r-r2d3
+  (package
+    (name "r-r2d3")
+    (version "0.2.3")
+    (source
+      (origin
+        (method url-fetch)
+        (uri (cran-uri "r2d3" version))
+        (sha256
+          (base32
+            "0v612mbzdjr8cq1ffall9hagbwxfv7fh963x8f0w5r84v1m3y2bl"))))
+    (properties `((upstream-name . "r2d3")))
+    (build-system r-build-system)
+    (propagated-inputs
+      `(("r-htmltools" ,r-htmltools)
+        ("r-htmlwidgets" ,r-htmlwidgets)
+        ("r-jsonlite" ,r-jsonlite)
+        ("r-rstudioapi" ,r-rstudioapi)))
+    (native-inputs `(("r-knitr" ,r-knitr)))
+    (home-page "https://github.com/rstudio/r2d3")
+    (synopsis "Interface to 'D3' Visualizations")
+    (description
+      "Suite of tools for using @code{D3}, a library for producing dynamic,
+interactive data visualizations.  Supports translating objects into
+@code{D3} friendly data structures, rendering @code{D3} scripts,
+publishing @code{D3} visualizations, incorporating @code{D3} in R
+Markdown, creating interactive @code{D3} applications with Shiny, and
+distributing @code{D3} based @code{htmlwidgets} in R packages.")
+    (license license:bsd-3)))