mirror of
https://git.savannah.gnu.org/git/guix.git
synced 2026-04-06 13:10:33 +02:00
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>
This commit is contained in:
committed by
Jelle Licht
parent
ce843095f4
commit
709c37f4db
@@ -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)
|
||||
|
||||
@@ -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")))
|
||||
|
||||
Reference in New Issue
Block a user