me
/
guix
Archived
1
0
Fork 0

gnu: r-bookdown: Update to 0.37.

* gnu/packages/cran.scm (r-bookdown): Update to 0.37.
[arguments]: Use minify-build-system to process JavaScript.

Change-Id: I53ff5ef1527976e40e7caf8b34f77af7eb3e833f
Ricardo Wurmus 2023-12-15 10:09:26 +01:00
parent b55d0a4abf
commit 8881398803
No known key found for this signature in database
GPG Key ID: 197A5888235FACAC
1 changed files with 18 additions and 22 deletions

View File

@ -23308,13 +23308,13 @@ SELECT or UPDATE queries to an end-point.")
(define-public r-bookdown
(package
(name "r-bookdown")
(version "0.36")
(version "0.37")
(source (origin
(method url-fetch)
(uri (cran-uri "bookdown" version))
(sha256
(base32
"0c4pj5sg4cnz2b2kpxgr0wk1n1pf7wkn1npm76aghy4yxj29cj4y"))
"18j8ylaq5wnw1c0lif9a002kbymv04pd0i43ahmqkskkv1b13hdk"))
;; TODO: there is one more file to replace:
;; inst/resources/gitbook/js/app.min.js
(snippet
@ -23330,32 +23330,28 @@ SELECT or UPDATE queries to an end-point.")
(build-system r-build-system)
(arguments
(list
#:modules '((guix build utils)
(guix build r-build-system)
(srfi srfi-1))
#:modules '((guix build r-build-system)
(guix build minify-build-system)
(guix build utils)
(ice-9 match))
#:imported-modules `(,@%r-build-system-modules
(guix build minify-build-system))
#:phases
#~(modify-phases %standard-phases
#~(modify-phases (@ (guix build r-build-system) %standard-phases)
(add-after 'unpack 'process-javascript
(lambda* (#:key inputs #:allow-other-keys)
(with-directory-excursion "inst/resources"
(invoke "tar" "-xf" (assoc-ref inputs "js-mathquill")
"-C" "/tmp" "--strip-components=2")
(call-with-values
(lambda ()
(unzip2
`((,(search-input-file inputs "/dist/clipboard.js")
"gitbook/js/clipboard.min.js")
(,(search-input-file inputs "/lunr.js")
"gitbook/js/lunr.js")
("/tmp/mathquill.js"
"mathquill/mathquill.min.js"))))
(lambda (sources targets)
(for-each (lambda (source target)
(format #true "Processing ~a --> ~a~%"
source target)
(invoke "esbuild" source "--minify"
(string-append "--outfile=" target)))
sources targets)))))))))
(for-each (match-lambda
((source . target)
(minify source #:target target)))
`((,(search-input-file inputs "/dist/clipboard.js")
. "gitbook/js/clipboard.min.js")
(,(search-input-file inputs "/lunr.js")
. "gitbook/js/lunr.js")
("/tmp/mathquill.js"
. "mathquill/mathquill.min.js")))))))))
(propagated-inputs
(list r-htmltools
r-jquerylib