[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#51838] [PATCH v6 05/41] guix: node-build-system: Add 'delete-depend
From: |
Liliana Marie Prikler |
Subject: |
[bug#51838] [PATCH v6 05/41] guix: node-build-system: Add 'delete-dependencies' helper function. |
Date: |
Thu, 30 Dec 2021 18:29:37 +0100 |
User-agent: |
Evolution 3.42.1 |
Am Donnerstag, dem 30.12.2021 um 02:38 -0500 schrieb Philip McGrath:
> * guix/build/node-build-system.scm (delete-dependencies): New
> exported procedure. Functionally updates a "package.json"-like value
> by removing specified npm packages from the "dependencies" and
> "devDependencies" objects.
> ---
> guix/build/node-build-system.scm | 18 ++++++++++++++++++
> 1 file changed, 18 insertions(+)
>
> diff --git a/guix/build/node-build-system.scm b/guix/build/node-
> build-system.scm
> index dc8b6a41c2..9967223b86 100644
> --- a/guix/build/node-build-system.scm
> +++ b/guix/build/node-build-system.scm
> @@ -27,6 +27,7 @@ (define-module (guix build node-build-system)
> #:use-module (srfi srfi-1)
> #:export (%standard-phases
> with-atomic-json-file-replacement
> + delete-dependencies
> node-build))
>
> ;; Commentary:
> @@ -325,6 +326,23 @@ (define resolve-dependencies
> deps))))))
> #t)
>
> +(define (delete-dependencies pkg-meta absent-dependencies)
> + "Functionally update PKG-META, a json object corresponding to a
> +'package.json' file, to allow building without the ABSENT-
> DEPENDENCIES. To
> +avoid reintroducing the ABSENT-DEPENDENCIES, only use this procedure
> after the
> +'patch-dependencies' phase."
> + (define delete-fom-jsobject
> + (match-lambda
> + (('@ . alist)
> + (cons '@ (filter (match-lambda
> + ((k . v)
> + (not (member k absent-dependencies))))
> + alist)))))
> + (jsobject-update*
> + pkg-meta
> + "devDependencies" '(@) delete-fom-jsobject
> + "dependencies" '(@) delete-fom-jsobject))
Given this rather easy definition in terms of our helper functions, I
think this procedure can do more. Particularly, I'd argue that we can
define it as such:
(define* (delete-dependencies dependencies #:key (file "package.json")
(json-keys
'("dependencies" "devDependencies"))
"Remove DEPENDENCIES from JSON_KEYS in FILE."
(with-atomic-json-file-replacement ...))
This would in turn make it easier to delete dependencies from #:phases,
eliminating the need to shorten it to #:absent-dependencies. WDYT?
- [bug#51838] [PATCH v5 07/45] guix: node-build-system: Add #:absent-dependencies argument., (continued)
- [bug#51838] [PATCH v5 07/45] guix: node-build-system: Add #:absent-dependencies argument., Liliana Marie Prikler, 2021/12/23
- [bug#51838] [PATCH v6 00/41] guix: node-build-system: Support compiling add-ons with node-gyp., Philip McGrath, 2021/12/30
- [bug#51838] [PATCH v6 02/41] guix: node-build-system: Add implicit libuv input., Philip McGrath, 2021/12/30
- [bug#51838] [PATCH v6 01/41] guix: node-build-system: Add delete-lockfiles phase., Philip McGrath, 2021/12/30
- [bug#51838] [PATCH v6 04/41] guix: node-build-system: Add avoid-node-gyp-rebuild phase., Philip McGrath, 2021/12/30
- [bug#51838] [PATCH v6 06/41] gnu: node-semver-bootstrap: Use 'delete-dependencies'., Philip McGrath, 2021/12/30
- [bug#51838] [PATCH v6 03/41] guix: node-build-system: Add JSON utilities., Philip McGrath, 2021/12/30
- [bug#51838] [PATCH v6 03/41] guix: node-build-system: Add JSON utilities., Liliana Marie Prikler, 2021/12/30
- [bug#51838] [PATCH v6 03/41] guix: node-build-system: Add JSON utilities., Liliana Marie Prikler, 2021/12/30
- [bug#51838] [PATCH v6 05/41] guix: node-build-system: Add 'delete-dependencies' helper function., Philip McGrath, 2021/12/30
- [bug#51838] [PATCH v6 05/41] guix: node-build-system: Add 'delete-dependencies' helper function.,
Liliana Marie Prikler <=
- [bug#51838] [PATCH v6 05/41] guix: node-build-system: Add 'delete-dependencies' helper function., Philip McGrath, 2021/12/30
- [bug#51838] [PATCH v6 05/41] guix: node-build-system: Add 'delete-dependencies' helper function., Liliana Marie Prikler, 2021/12/30
- [bug#51838] [PATCH v6 07/41] gnu: node-ms-bootstrap: Use 'delete-dependencies'., Philip McGrath, 2021/12/30
- [bug#51838] [PATCH v6 09/41] gnu: node-debug-bootstrap: Use 'delete-dependencies'., Philip McGrath, 2021/12/30
- [bug#51838] [PATCH v6 08/41] gnu: node-binary-search-bootstrap: Use 'delete-dependencies'., Philip McGrath, 2021/12/30
- [bug#51838] [PATCH v6 11/41] gnu: node-llparse-frontend-bootstrap: Use 'delete-dependencies'., Philip McGrath, 2021/12/30
- [bug#51838] [PATCH v6 13/41] gnu: node-semver: Use 'delete-dependencies'., Philip McGrath, 2021/12/30
- [bug#51838] [PATCH v6 10/41] gnu: node-llparse-builder-bootstrap: Use 'delete-dependencies'., Philip McGrath, 2021/12/30
- [bug#51838] [PATCH v6 12/41] gnu: node-llparse-bootstrap: Use 'delete-dependencies'., Philip McGrath, 2021/12/30
- [bug#51838] [PATCH v6 14/41] gnu: node-wrappy: Use 'delete-dependencies'., Philip McGrath, 2021/12/30