summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Graves <ngraves@ngraves.fr>2025-09-11 01:00:43 +0200
committerJelle Licht <jlicht@fsfe.org>2025-10-13 10:26:46 +0200
commitaa71bbd0b739f170ce24f2fbd15d62871029e34f (patch)
tree630588f52d3c0557728d2e5343981f50b35e8382
parent8cb9fa4757bd67adb7e2f27b0331f7f9255d5639 (diff)
build-system: node: Rewrite modify-json.
This function seems way too complex for what it's trying to do. * guix/build/node-build-system.scm (modify-json): Rewrite procedure using apply and compose. Change-Id: I6419bd32eea76031393573a1d6450571d092ec4d Signed-off-by: Jelle Licht <jlicht@fsfe.org>
-rw-r--r--guix/build/node-build-system.scm21
1 files changed, 4 insertions, 17 deletions
diff --git a/guix/build/node-build-system.scm b/guix/build/node-build-system.scm
index 0cd05fc0e8..c153a2fcc9 100644
--- a/guix/build/node-build-system.scm
+++ b/guix/build/node-build-system.scm
@@ -67,24 +67,11 @@ to be written as json to the replacement FILE."
(lambda (in out)
(scm->json (proc (json->scm in)) out))))
-(define* (modify-json #:key (file "package.json") #:rest all-arguments)
+(define* (modify-json #:key (file "package.json") #:rest modifications)
"Provide package.json modifying callbacks such as (delete-dependencies ...)"
- (let
- (
- (modifications
- (let loop ((arguments all-arguments))
- (cond
- ((null? arguments) '())
- ((keyword? (car arguments)) (loop (cddr arguments)))
- (else (cons (car arguments) (loop (cdr arguments))))))))
- (with-atomic-json-file-replacement
- (lambda (package)
- (fold
- (lambda (modification package)
- (modification package))
- package
- modifications))
- file)))
+ (with-atomic-json-file-replacement
+ (apply compose modifications)
+ file))
(define (delete-dependencies dependencies-to-remove)
"Rewrite 'package.json' to allow the build to proceed without packages