mirror of
https://git.savannah.gnu.org/git/guix.git
synced 2026-04-06 21:20:33 +02:00
Revert "build-system: node: Rewrite modify-json."
This reverts commit dff01d4eb12016435b8fb8878294b79b25b3bf4a. The #:file keyword argument was still part of the rest arguments, which lead to custom file arguments being called as functions due to the `apply compose'. Change-Id: I91d6b576adb7ebb5af6a584e999248b5cc410f6a
This commit is contained in:
@@ -55,11 +55,24 @@ 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 modifications)
|
||||
(define* (modify-json #:key (file "package.json") #:rest all-arguments)
|
||||
"Provide package.json modifying callbacks such as (delete-dependencies ...)"
|
||||
(with-atomic-json-file-replacement
|
||||
(apply compose modifications)
|
||||
file))
|
||||
(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)))
|
||||
|
||||
(define (delete-dependencies dependencies-to-remove)
|
||||
"Rewrite 'package.json' to allow the build to proceed without packages
|
||||
|
||||
Reference in New Issue
Block a user