summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRicardo Wurmus <rekado@elephly.net>2024-01-24 13:24:33 +0100
committerRicardo Wurmus <rekado@elephly.net>2024-01-24 13:43:13 +0100
commit2e80b64f4cd408ea1c03e1b22307c32107e48814 (patch)
tree819d16ac042feb9a82d98264b09c3bda775c3d07
parent25e2d7d72c4f380467174f99b75015e78c12dbcf (diff)
cran: r-shinydashboardplus: Process all JavaScript.
* guix-science/packages/cran.scm (r-shinydashboardplus)[source]: Delete all minified JavaScript. [arguments]: Use minify-build-system; change 'process-javascript phase to process two more files. [native-inputs]: Add clone of MaterialAdminLTE repository.
-rw-r--r--guix-science/packages/cran.scm80
1 files changed, 51 insertions, 29 deletions
diff --git a/guix-science/packages/cran.scm b/guix-science/packages/cran.scm
index 671608b..f8585de 100644
--- a/guix-science/packages/cran.scm
+++ b/guix-science/packages/cran.scm
@@ -856,9 +856,7 @@ bles and plots.")
856for Shiny with spinners, progress bars, and notifications.") 856for Shiny with spinners, progress bars, and notifications.")
857 (license license:expat))) 857 (license license:expat)))
858 858
859;; TODO: still have to remove these: 859;; This depends on r-waiter.
860;; materialDesign-1.0/js/material.min.js
861;; materialDesign-1.0/js/ripples.min.js
862(define-public r-shinydashboardplus 860(define-public r-shinydashboardplus
863 (package 861 (package
864 (name "r-shinydashboardplus") 862 (name "r-shinydashboardplus")
@@ -871,13 +869,18 @@ for Shiny with spinners, progress bars, and notifications.")
871 "10sdb1vddx2ij867pqijr63l4233hw1vnn7mzbs0z23g77x8ra29")) 869 "10sdb1vddx2ij867pqijr63l4233hw1vnn7mzbs0z23g77x8ra29"))
872 (modules '((guix build utils))) 870 (modules '((guix build utils)))
873 (snippet 871 (snippet
874 `(with-directory-excursion 872 `(begin
875 ,(string-append "inst/shinydashboardPlus-" version 873 (with-directory-excursion
876 "/js/") 874 ,(string-append "inst/shinydashboardPlus-" version
877 (for-each delete-file-recursively 875 "/js/")
878 '("app.min.js" 876 (for-each delete-file
879 "shinydashboardPlus.min.js" 877 '("app.min.js"
880 "shinydashboardPlus.min.js.map")))))) 878 "shinydashboardPlus.min.js"
879 "shinydashboardPlus.min.js.map")))
880 (with-directory-excursion "inst/materialDesign-1.0/js"
881 (for-each delete-file
882 '("material.min.js"
883 "ripples.min.js")))))))
881 (properties `((upstream-name . "shinydashboardPlus"))) 884 (properties `((upstream-name . "shinydashboardPlus")))
882 (build-system r-build-system) 885 (build-system r-build-system)
883 (arguments 886 (arguments
@@ -885,23 +888,30 @@ for Shiny with spinners, progress bars, and notifications.")
885 ;; The tests launch a shinyApp; they are interactive tests that 888 ;; The tests launch a shinyApp; they are interactive tests that
886 ;; will block forever, so we just don't run them. 889 ;; will block forever, so we just don't run them.
887 #:tests? #false 890 #:tests? #false
891 #:modules
892 '((guix build r-build-system)
893 (guix build minify-build-system)
894 (guix build utils)
895 (ice-9 match))
896 #:imported-modules
897 `(,@%r-build-system-modules
898 (guix build minify-build-system))
888 #:phases 899 #:phases
889 `(modify-phases %standard-phases 900 #~(modify-phases (@ (guix build r-build-system) %standard-phases)
890 (add-after 'unpack 'process-javascript 901 (add-after 'unpack 'process-javascript
891 (lambda _ 902 (lambda* (#:key inputs #:allow-other-keys)
892 (with-directory-excursion 903 (with-directory-excursion
893 ,(string-append "inst/shinydashboardPlus-" version 904 (string-append "inst/shinydashboardPlus-" #$version "/js/")
894 "/js/") 905 (for-each
895 (let ((mapping 906 (match-lambda
896 `(("app.js" . "app.min.js") 907 ((source . target)
897 ("shinydashboardPlus.js" . "shinydashboardPlus.min.js")))) 908 (minify source #:target target)))
898 (for-each (lambda (source target) 909 `(("app.js" . "app.min.js")
899 (format #true "Processing ~a --> ~a~%" 910 ("shinydashboardPlus.js" . "shinydashboardPlus.min.js")
900 source target) 911 (,(search-input-file inputs "/dist/js/material.js")
901 (invoke "esbuild" source "--minify" 912 . "materialDesign-1.0/js/material.min.js")
902 (string-append "--outfile=" target))) 913 (,(search-input-file inputs "/dist/js/ripples.js")
903 (map car mapping) 914 . "materialDesign-1.0/js/ripples.min.js")))))))))
904 (map cdr mapping)))))))))
905 (propagated-inputs 915 (propagated-inputs
906 (list r-fresh 916 (list r-fresh
907 r-htmltools 917 r-htmltools
@@ -910,11 +920,23 @@ for Shiny with spinners, progress bars, and notifications.")
910 r-shinydashboard 920 r-shinydashboard
911 r-waiter)) 921 r-waiter))
912 (native-inputs 922 (native-inputs
913 (list esbuild r-knitr)) 923 (list esbuild
924 r-knitr
925 (let ((commit "92a2284b47aed56a9d7ae92cf9b40072d27982b3"))
926 (origin
927 (method git-fetch)
928 (uri (git-reference
929 (url "https://github.com/DucThanhNguyen/MaterialAdminLTE")
930 (commit commit)))
931 (file-name (git-file-name "MaterialAdminLTE"
932 (git-version "0" "0" commit)))
933 (sha256
934 (base32
935 "0cn11hxpf25h7xj2lk473z24swgz979dz255zwk2m2fj00iljkn9"))))))
914 (home-page "https://github.com/RinteRface/shinydashboardPlus") 936 (home-page "https://github.com/RinteRface/shinydashboardPlus")
915 (synopsis "Add more AdminLTE2 components to shinydashboard") 937 (synopsis "Add more AdminLTE2 components to shinydashboard")
916 (description 938 (description
917 "This package extends shinydashboard with AdminLTE2 components. 939 "This package extends shinydashboard with AdminLTE2 components.
918AdminLTE2 is a Bootstrap 3 dashboard template. Customize boxes, add 940AdminLTE2 is a Bootstrap 3 dashboard template. Customize boxes, add timelines
919timelines and a lot more.") 941and a lot more.")
920 (license license:gpl2+))) 942 (license license:gpl2+)))