guix_mirror_bot pushed a commit to branch javascript-team
in repository guix.

commit d7a5da50c52353b262a24264d6d7bcf4499cb3e1
Author: Nicolas Graves <[email protected]>
AuthorDate: Thu Sep 11 21:39:39 2025 +0200

    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 <[email protected]>
---
 guix/build-system/node.scm       |  7 +++++++
 guix/build/node-build-system.scm | 10 +++-------
 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")))

Reply via email to