summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Graves <ngraves@ngraves.fr>2025-09-11 21:39:39 +0200
committerJelle Licht <jlicht@fsfe.org>2025-10-13 10:26:55 +0200
commitd7a5da50c52353b262a24264d6d7bcf4499cb3e1 (patch)
tree3293ffb79b71c76768740e2ad8b9bf1401269215
parent28e4bc50e240cee8d1b1814aa64eb8520fd1ff6a (diff)
build-system: node: Improve lockfiles extensibility.
* guix/build-system/node.scm (%default-lockfiles): New variable. (node-build): Add lockfiles argument. * guix/build/node-build-system.scm (delete-lockfiles): Re-factor with lockfiles argument. Change-Id: I09927977ec7c6430191f592f7f36d4030721c520 Signed-off-by: Jelle Licht <jlicht@fsfe.org>
-rw-r--r--guix/build-system/node.scm7
-rw-r--r--guix/build/node-build-system.scm10
2 files changed, 10 insertions, 7 deletions
diff --git a/guix/build-system/node.scm b/guix/build-system/node.scm
index abd29b2529..3e4b2829da 100644
--- a/guix/build-system/node.scm
+++ b/guix/build-system/node.scm
@@ -34,6 +34,11 @@
node-build
node-build-system))
+(define %default-lockfiles
+ (list "package-lock.json"
+ "yarn.lock"
+ "npm-shrinkwrap.json"))
+
(define %node-build-system-modules
;; Build-side modules imported by default.
`((guix build node-build-system)
@@ -87,6 +92,7 @@
source
(npm-flags ''())
(test-target "test")
+ (lockfiles %default-lockfiles)
(tests? #t)
(phases '%standard-phases)
(outputs '("out"))
@@ -108,6 +114,7 @@
#:system #$system
#:npm-flags #$npm-flags
#:test-target #$test-target
+ #:lockfiles '#$lockfiles
#:tests? #$tests?
#:phases #$phases
#:outputs #$(outputs->gexp outputs)
diff --git a/guix/build/node-build-system.scm b/guix/build/node-build-system.scm
index c153a2fcc9..21004a8ff4 100644
--- a/guix/build/node-build-system.scm
+++ b/guix/build/node-build-system.scm
@@ -264,16 +264,12 @@ only after the 'patch-dependencies' phase."
(or (assoc-ref pkg-meta "dependencies") '())))))))))
#t)
-(define* (delete-lockfiles #:key inputs #:allow-other-keys)
- "Delete 'package-lock.json', 'yarn.lock', and 'npm-shrinkwrap.json', if they
-exist."
+(define* (delete-lockfiles #:key lockfiles #:allow-other-keys)
+ "Delete LOCKFILES if they exist."
(for-each (lambda (pth)
(when (file-exists? pth)
(delete-file pth)))
- '("package-lock.json"
- "yarn.lock"
- "npm-shrinkwrap.json"))
- #t)
+ lockfiles))
(define* (configure #:key outputs inputs #:allow-other-keys)
(let ((npm (string-append (assoc-ref inputs "node") "/bin/npm")))