diff options
| author | Daniel Khodabakhsh <d.khodabakhsh@gmail.com> | 2025-02-18 00:43:53 +0100 |
|---|---|---|
| committer | Andreas Enge <andreas@enge.fr> | 2025-04-13 14:19:43 +0200 |
| commit | 3e9e164154af6245389af5a1781473b36263ad20 (patch) | |
| tree | 792a3389b93cebc455edaa3acfbcb642c3e3ad62 /gnu/packages/node.scm | |
| parent | 86caf257e728ce9dd43273a50323e3b93a5769e0 (diff) | |
build-system/node: New API for modifying json.
Introduce (modify-json), (delete-fields), and (replace-fields) to node-build-system
This change introduces helper procedures (modify-json) which takes in lambdas
which modify the target json #:file which defaults to package.json
This change also includes (delete-fields) and (replace-fields) to help deleting
and replacing the value of fields in a package.json file.
* guix/build/node-build-system.scm
(modify-json, modify-json-fields, delete-fields, replace-fields,
delete-dev-dependencies): New API exported procedures.
(with-atomic-json-file-replacement, delete-dependencies): Change
procedures to adapt to the new API.
* gnu/packages/node.scm (node-ms-bootstrap,
node-binary-search-bootstrap, node-debug-boostrap,
node-llparse-builder-bootstrap, node-llparse-frontend-boostrap,
node-llparse-bootstrap): Use new API procedures.
* gnu/packages/node-xyz.scm (node-acorn, node-addon-api,
node-buffer-crc32, node-crx3, node-debug, node-file-uri-to-path,
node-ieee754, node-inherits, node-irc, node-irc-colors, node-minimist,
node-ms, node-nan, node-normalize-path, node-once, node-path-key,
node-pbf, node-protocol-buffers-schema, node-readable-stream,
node-resolve-protobuf-schema, node-safe-buffer,
node-safe-stable-stringify, node-semver, node-serialport,
node-serialport-bindings, node-serialport-stream, node-sqlite3,
node-string-decoder, node-tiddlywiki, node-wrappy, node-yazl): Use new
API procedures.
Change-Id: I957f7ca814078d2136d5261985174820235f1369
Signed-off-by: Jelle Licht <jlicht@fsfe.org>
Diffstat (limited to 'gnu/packages/node.scm')
| -rw-r--r-- | gnu/packages/node.scm | 86 |
1 files changed, 46 insertions, 40 deletions
diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm index b2f30d48293..ba258d56fc6 100644 --- a/gnu/packages/node.scm +++ b/gnu/packages/node.scm @@ -13,6 +13,7 @@ ;;; Copyright © 2021, 2022 Philip McGrath <philip@philipmcgrath.com> ;;; Copyright © 2022 Hilton Chain <hako@ultrarare.space> ;;; Copyright © 2024 Efraim Flashner <efraim@flashner.co.il> +;;; Copyright © 2024 Daniel Khodabakhsh <d.khodabakhsh@gmail.com> ;;; ;;; This file is part of GNU Guix. ;;; @@ -373,7 +374,7 @@ devices.") (modify-phases %standard-phases (add-after 'patch-dependencies 'delete-dependencies (lambda args - (delete-dependencies '("tap"))))))) + (modify-json (delete-dependencies '("tap")))))))) (home-page "https://github.com/npm/node-semver") (properties '((hidden? . #t))) (synopsis "Parses semantic versions strings") @@ -404,11 +405,12 @@ devices.") (modify-phases %standard-phases (add-after 'patch-dependencies 'delete-dependencies (lambda args - (delete-dependencies '("eslint" - "expect.js" - "husky" - "lint-staged" - "mocha"))))))) + (modify-json (delete-dependencies + '("eslint" + "expect.js" + "husky" + "lint-staged" + "mocha")))))))) (home-page "https://github.com/zeit/ms#readme") (properties '((hidden? . #t))) (synopsis "Tiny millisecond conversion utility") @@ -438,7 +440,7 @@ formats to milliseconds.") (modify-phases %standard-phases (add-after 'patch-dependencies 'delete-dependencies (lambda args - (delete-dependencies `("chai" "mocha"))))))) + (modify-json (delete-dependencies `("chai" "mocha")))))))) (home-page "https://github.com/darkskyapp/binary-search#readme") (properties '((hidden? . #t))) (synopsis "Tiny binary search function with comparators") @@ -467,17 +469,18 @@ formats to milliseconds.") (modify-phases %standard-phases (add-after 'patch-dependencies 'delete-dependencies (lambda args - (delete-dependencies `("brfs" - "browserify" - "coveralls" - "istanbul" - "karma" - "karma-browserify" - "karma-chrome-launcher" - "karma-mocha" - "mocha" - "mocha-lcov-reporter" - "xo"))))))) + (modify-json (delete-dependencies + `("brfs" + "browserify" + "coveralls" + "istanbul" + "karma" + "karma-browserify" + "karma-chrome-launcher" + "karma-mocha" + "mocha" + "mocha-lcov-reporter" + "xo")))))))) (inputs (list node-ms-bootstrap)) (home-page "https://github.com/visionmedia/debug#readme") (properties '((hidden? . #t))) @@ -533,12 +536,13 @@ Node.js and web browsers.") (modify-phases %standard-phases (add-after 'patch-dependencies 'delete-dependencies (lambda _ - (delete-dependencies `("@types/mocha" - "@types/node" - "mocha" - "ts-node" - "tslint" - "typescript")))) + (modify-json (delete-dependencies + `("@types/mocha" + "@types/node" + "mocha" + "ts-node" + "tslint" + "typescript"))))) (replace 'build (lambda* (#:key inputs #:allow-other-keys) (let ((esbuild (search-input-file inputs "/bin/esbuild"))) @@ -594,13 +598,14 @@ Node.js and web browsers.") (modify-phases %standard-phases (add-after 'patch-dependencies 'delete-dependencies (lambda args - (delete-dependencies `("@types/debug" - "@types/mocha" - "@types/node" - "mocha" - "ts-node" - "tslint" - "typescript")))) + (modify-json (delete-dependencies + `("@types/debug" + "@types/mocha" + "@types/node" + "mocha" + "ts-node" + "tslint" + "typescript"))))) (replace 'build (lambda* (#:key inputs #:allow-other-keys) (let ((esbuild (search-input-file inputs "/bin/esbuild"))) @@ -655,15 +660,16 @@ Node.js and web browsers.") (modify-phases %standard-phases (add-after 'patch-dependencies 'delete-dependencies (lambda args - (delete-dependencies `("@types/debug" - "@types/mocha" - "@types/node" - "esm" - "llparse-test-fixture" - "mocha" - "ts-node" - "tslint" - "typescript")))) + (modify-json (delete-dependencies + `("@types/debug" + "@types/mocha" + "@types/node" + "esm" + "llparse-test-fixture" + "mocha" + "ts-node" + "tslint" + "typescript"))))) (replace 'build (lambda* (#:key inputs #:allow-other-keys) (let ((esbuild (search-input-file inputs "/bin/esbuild"))) |
