Commit graph

15 commits

Author SHA1 Message Date
Nicolas Graves
93d4d16375
build-system/node: Use test-target argument.
* guix/build/node-build-system.scm (check): Use test-target argument.

Signed-off-by: Jelle Licht <jlicht@fsfe.org>
Change-Id: I5b6b273d7c8ad9f9b4d48a5e50e000adcf504402
2025-04-13 14:19:43 +02:00
Daniel Khodabakhsh
3e9e164154
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>
2025-04-13 14:19:43 +02:00
Daniel Khodabakhsh
86caf257e7
build-system/node: Switch to (json).
Replace (guix build json) with (json) in node-build-system

* guix/build/node-build-system.scm
(jsobject-ref, jsobject-update, jsobject-union, newest,
unkeyed->keyed): Remove unused functions.
(with-atomic-json-file-replacement): Switch to (json) module.  Move
file argument as a second optional argument.
(alist-update): Switch to (json) module.  Remove optional default
argument.
(patch-dependencies, delete-dependencies, build): Switch to (json)
module.  Arguments are unchanged.

* guix/build-system/node.scm (%node-build-system-modules): Switch
to (json) module.

* gnu/packages/node-xyz.scm (node-acorn, node-addon-api,
node-serialport-bindings, node-sqlite3): Adapt package custom
<#:phases> to the replacement.

Change-Id: I9fd5152a98b6a241d414e9a94ab179c9cabcfb85
Signed-off-by: Jelle Licht <jlicht@fsfe.org>
2025-04-13 14:19:34 +02:00
Lars-Dominik Braun
37c2e94cec
guix: node-build-system: Delete from peerDependencies too.
The current version of npm in Guix installs peerDependencies by default,
whereas previously it would just warn about missing/wrong packages.

Fixes <https://issues.guix.gnu.org/issue/64203>.

* guix/build/node-build-system.scm (delete-dependencies): Remove supplied
dependencies from peerDependencies field too.
2023-06-22 12:54:19 +02:00
Jelle Licht
d8ce5e3297
build-system: node: Use --install-links' with npm install'.
Later versions of npm need to explicitly install a copy of local dependencies,
instead of only a symlink.

* guix/build/node-build-system.scm (configure): Add `--install-links' to npm
install invocation.
(install): Ditto.
2023-05-06 13:53:21 +02:00
Philip McGrath
a62e6e3220
guix: node-build-system: Add 'delete-dependencies' helper function.
Many node packages currently skip the configure phase, because they lack
both dependencies and a convenient way to build without all of them, e.g.
for the purposes of bootstrapping.  This patch adds a big hammer to flatten
these nails.

* guix/build/node-build-system.scm (delete-dependencies): New variable.

Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com>
2022-01-09 02:07:12 +01:00
Philip McGrath
df7d787ba4
guix: node-build-system: Add avoid-node-gyp-rebuild phase.
Packages with native addons currently try to write to store paths
when used as dependecies.  This patch adds a phase to replace that
behaviour with a no-op.

* guix/build/node-build-system.scm (avoid-node-gyp-rebuild): New
variable.
(%standard-phases): Add 'avoid-node-gyp-rebuild' after 'install'.

Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com>
2022-01-09 02:07:11 +01:00
Philip McGrath
2ef3fe9f35
guix: node-build-system: Add JSON utilities.
This commit adds several utility functions for non-destructive
transformation of the JSON representation used by (guix build json),
particularly for purely functional update of JSON objects.  They ought
to eventually be exported from their own module, but for now are kept
private to allow experimentation.

* guix/build/node-build-system.scm (assoc-ref*, jsobject-ref, alist-pop)
(alist-update, jsobject-update*, jsobject-union): New variables.
(with-atomic-json-file-replacement): New public variable.
(module-name, build, patch-dependencies): Use them.  Do not resort to
unsafe alist primitives from Guile core.

Co-authored-by: Liliana Marie Prikler <liliana.prikler@gmail.com>
2022-01-09 02:07:11 +01:00
Philip McGrath
5add4af6fc
guix: node-build-system: Add delete-lockfiles phase.
Guix does not use any of these lock files to determine the package versions
used during the build, so they only serve to cause problems.

* guix/build/node-build-system.scm (delete-lockfiles): New variable.
(%standard-phases): Add 'delete-lockfiles' after 'patch-dependencies'.

Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com>
2022-01-09 02:07:10 +01:00
Lars-Dominik Braun
9c93573d15
build: Make outputs of node-build-system reproducible.
package.json records two hashes of package.tgz, which change for each
build, resulting in non-reproducible builds.

* guix/build/node-build-system.scm (repack): Add reproducibility options
to tar command.
2021-06-24 14:10:29 +02:00
Jelle Licht
23ea84cdf0
build-system: Rewrite node build system.
* guix/build/node-build-system.scm: Rewrite it.
* guix/build-system/node.scm: Adjust accordingly.
* gnu/packages/node-xyz.scm (node-semver): Likewise.

Co-authored-by: Timothy Sample <samplet@ngyro.com>
2021-04-02 18:04:22 +02:00
Julien Lepiller
c23b42dd55
guix: node-build-system: Do not symlink /bin.
* guix/build/node-build-system.scm (install): Do not add a symlink for
/bin.
2020-02-25 00:27:09 +01:00
Julien Lepiller
a4bb189210
Revert "guix: node-build-system: Use guile-json instead of a custom parser."
The effect of this change was to import the (json parser) from the host
side into the build side. The solution here would be to do the equivalent
of ‘with-extensions’ for gexps. Since we don't use gexps for build
systems just yet, revert this for now.

This reverts commit 8eb0ba532e.
2019-07-14 20:18:07 +02:00
Julien Lepiller
8eb0ba532e
guix: node-build-system: Use guile-json instead of a custom parser.
* guix/build/json.scm: Remove file.
* Makefile.am: Remove it.
* guix/build/node-build-system.scm: Use (json parser) instead of (guix build json).
* guix/build-system/node.scm: Idem.
2019-07-14 14:57:46 +02:00
Jelle Licht
09a1f92f61
build: Add node-build-system.
* guix/build/node-build-system.scm: New file.
* guix/build-system/node.scm: New file.
* guix/build/json.scm: New file.
* doc/guix.texi: Document it.
* Makefile.am: Added new files.

Co-Authored-By: Julien Lepiller <julien@lepiller.eu>
2019-07-14 12:20:48 +02:00