summary refs log tree commit diff
path: root/gnu/packages/cran.scm
diff options
context:
space:
mode:
authorRicardo Wurmus <rekado@elephly.net>2021-02-18 17:47:55 +0100
committerRicardo Wurmus <rekado@elephly.net>2021-02-18 17:52:05 +0100
commit8dac2e0d1e2486f68ef8348c415a962035fc9f41 (patch)
treed34721594c5388d5dfdb9e5294a2f7ac329abc65 /gnu/packages/cran.scm
parent359e9053521bfab34b5861925398fc5f329d4ca3 (diff)
downloadguix-8dac2e0d1e2486f68ef8348c415a962035fc9f41.tar.gz
gnu: Add r-jquerylib.
* gnu/packages/cran.scm (r-jquerylib): New variable.
Diffstat (limited to 'gnu/packages/cran.scm')
-rw-r--r--gnu/packages/cran.scm59
1 files changed, 59 insertions, 0 deletions
diff --git a/gnu/packages/cran.scm b/gnu/packages/cran.scm
index e025ded315..0daf67eabc 100644
--- a/gnu/packages/cran.scm
+++ b/gnu/packages/cran.scm
@@ -1344,6 +1344,65 @@ are used.  Fastmap avoids this memory leak issue by implementing the map using
 data structures in C++.")
     (license license:expat)))
 
+;; This package includes minified JavaScript files.  When upgrading please
+;; check that there are no new minified JavaScript files.
+(define-public r-jquerylib
+  (package
+    (name "r-jquerylib")
+    (version "0.1.3")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (cran-uri "jquerylib" version))
+       (sha256
+        (base32
+         "1s0d6mws13hwkx07jqmry7vp30a05b2p9w7ir68bmkhasidwkzdq"))
+       (snippet
+        '(for-each delete-file
+                   '("inst/lib/jquery-1.12.4.min.js"
+                     "inst/lib/jquery-2.2.4.min.js"
+                     "inst/lib/jquery-3.5.1.min.js")))))
+    (properties `((upstream-name . "jquerylib")))
+    (build-system r-build-system)
+    (arguments
+     `(#:modules ((guix build utils)
+                  (guix build r-build-system)
+                  (srfi srfi-1))
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'process-javascript
+           (lambda* (#:key inputs #:allow-other-keys)
+             (with-directory-excursion "inst/lib/"
+               (call-with-values
+                   (lambda ()
+                     (unzip2
+                      `(("jquery-1.12.4.js"
+                         "jquery-1.12.4.min.js")
+                        ("jquery-2.2.4.js"
+                         "jquery-2.2.4.min.js")
+                        ("jquery-3.5.1.js"
+                         "jquery-3.5.1.min.js"))))
+                 (lambda (sources targets)
+                   (for-each (lambda (source target)
+                               (format #t "Processing ~a --> ~a~%"
+                                       source target)
+                               (invoke "esbuild" source "--minify"
+                                       (string-append "--outfile=" target)))
+                             sources targets)))))))))
+    (propagated-inputs
+     `(("r-htmltools" ,r-htmltools)))
+    (native-inputs
+     `(("esbuild" ,esbuild)))
+    (home-page "https://cran.r-project.org/package=jquerylib")
+    (synopsis "Obtain jQuery as an HTML dependency object")
+    (description
+     "Obtain any major version of jQuery and use it in any webpage generated
+by htmltools (e.g. shiny, htmlwidgets, and rmarkdown).  Most R users don't
+need to use this package directly, but other R packages (e.g. shiny,
+rmarkdown, etc.) depend on this package to avoid bundling redundant copies of
+jQuery.")
+    (license license:expat)))
+
 (define-public r-shiny
   (package
     (name "r-shiny")