gnu: r-excelr: Reuse minify-build-system tools.

* gnu/packages/cran.scm (r-excelr)[arguments]: Use minify-build-system.
[native-inputs]: Use git repository for jexcel.js.
[description]: Reformat.

Change-Id: I82f7e466bbab6ad837359f04ee616a7766433c13
This commit is contained in:
Ricardo Wurmus 2024-01-02 18:34:15 +01:00
parent 85dabe71e6
commit f1bf43cdff
No known key found for this signature in database
GPG key ID: 197A5888235FACAC

View file

@ -7437,6 +7437,10 @@ (define-public r-evmix
can safely interchange most code.") can safely interchange most code.")
(license license:gpl3))) (license license:gpl3)))
;; This package contains minified JavaScript: jExcel CE Spreadsheet,
;; version 3.9.1. It is not clear how to obtain this particular
;; version as there is no tag for 3.9.1. There only is 3.6.1 and
;; 4.2.0 at https://github.com/jspreadsheet/ce.
(define-public r-excelr (define-public r-excelr
(package (package
(name "r-excelr") (name "r-excelr")
@ -7452,37 +7456,44 @@ (define-public r-excelr
(properties `((upstream-name . "excelR"))) (properties `((upstream-name . "excelR")))
(build-system r-build-system) (build-system r-build-system)
(arguments (arguments
`(#:phases (list
(modify-phases %standard-phases #:modules
(add-after 'unpack 'process-javascript '((guix build r-build-system)
(lambda* (#:key inputs #:allow-other-keys) (guix build minify-build-system)
(with-directory-excursion "inst/htmlwidgets/lib/jexcel/js/" (guix build utils))
(let ((source (assoc-ref inputs "js-jexcel")) #:imported-modules
(target "jexcel.min.js")) `(,@%r-build-system-modules
(format #true "Processing ~a --> ~a~%" (guix build minify-build-system))
source target) #:phases
(invoke "esbuild" source "--minify" #~(modify-phases (@ (guix build r-build-system) %standard-phases)
(string-append "--outfile=" target))))))))) (add-after 'unpack 'process-javascript
(native-inputs (lambda* (#:key inputs #:allow-other-keys)
`(("esbuild" ,esbuild) (with-directory-excursion "inst/htmlwidgets/lib/jexcel/js"
;; There is no tag for this particular commit, but comparison of the (minify (search-input-file inputs "/dist/jexcel.js")
;; contents of the JavaScript files point to this commit as the most #:target "jexcel.min.js")))))))
;; likely source.
("js-jexcel"
,(origin
(method url-fetch)
(uri (string-append "https://raw.githubusercontent.com/jspreadsheet/ce/"
"8af1960f76e6803bebc5750013d2ebe95354e88a/dist/jexcel.js"))
(sha256
(base32
"0y88hsr9d8cpnvdmbm17m328pc4kc5wbcv02kzmhm0bryzhviw7h"))))))
(propagated-inputs (list r-htmlwidgets r-jsonlite)) (propagated-inputs (list r-htmlwidgets r-jsonlite))
(native-inputs
(list esbuild
;; There is no tag for this particular commit, but comparison of
;; the contents of the JavaScript files point to this commit as the
;; most likely source.
(let* ((commit "8af1960f76e6803bebc5750013d2ebe95354e88a")
(version (git-version "3.9.1" "0" commit)))
(origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/jspreadsheet/ce")
(commit commit)))
(file-name (git-file-name "jexcel" version))
(sha256
(base32
"1zk0wc4h0vax7zgimhwqq2icrvjr84agm3qv42l16gim7gq7fqfq"))))))
(home-page "https://github.com/Swechhya/excelR") (home-page "https://github.com/Swechhya/excelR")
(synopsis "Wrapper of the JavaScript library jExcel") (synopsis "Wrapper of the JavaScript library jExcel")
(description (description
"This package provides an R interface to the jExcel library to "This package provides an R interface to the jExcel library to create
create web-based interactive tables and spreadsheets compatible with web-based interactive tables and spreadsheets compatible with spreadsheet
spreadsheet software.") software.")
(license license:expat))) (license license:expat)))
(define-public r-extremes (define-public r-extremes