From: Nicolas Graves via Guix-patches via <guix-patches@gnu.org>
To: 68941@debbugs.gnu.org
Cc: ngraves@ngraves.fr
Subject: [bug#68941] [PATCH 01/44] guix: build-system: node: Add node-trivial-package helper.
Date: Tue, 6 Feb 2024 00:18:49 +0100 [thread overview]
Message-ID: <20240205231952.26410-1-ngraves@ngraves.fr> (raw)
In-Reply-To: <20240205231557.22629-1-ngraves@ngraves.fr>
* guix/build-system/node.scm (node-trivial-package): Add function.
Change-Id: I618750ebb3a9f9c4ec4f22256541cfbdfbf4388a
---
gnu/packages/node-xyz.scm | 2 +-
guix/build-system/node.scm | 52 +++++++++++++++++++++++++++++++++++++-
2 files changed, 52 insertions(+), 2 deletions(-)
diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index d68f730b77..36fa575049 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -5,7 +5,7 @@
;;; Copyright © 2021 Charles <charles.b.jackson@protonmail.com>
;;; Copyright © 2021 Philip McGrath <philip@philipmcgrath.com>
;;; Copyright © 2021 Dhruvin Gandhi <contact@dhruvin.dev>
-;;; Copyright © 2022 Nicolas Graves <ngraves@ngraves.fr>
+;;; Copyright © 2022, 2023, 2024 Nicolas Graves <ngraves@ngraves.fr>
;;; Copyright © 2023 Jelle Licht <jlicht@fsfe.org>
;;;
;;; This file is part of GNU Guix.
diff --git a/guix/build-system/node.scm b/guix/build-system/node.scm
index 3f73390809..8a903b4fe5 100644
--- a/guix/build-system/node.scm
+++ b/guix/build-system/node.scm
@@ -29,9 +29,59 @@ (define-module (guix build-system node)
#:use-module (guix search-paths)
#:use-module (guix build-system)
#:use-module (guix build-system gnu)
+ #:use-module (guix build-system trivial)
+ #:use-module ((guix licenses) #:prefix license:)
#:export (%node-build-system-modules
node-build
- node-build-system))
+ node-build-system
+
+ node-trivial-package))
+
+(define* (node-trivial-package node-name version replacement description
+ #:key (propagated-inputs '())
+ (mozilla-doclink #f) ;maybe-string
+ (shams #f))
+ "This helper makes it easy to replace a cumbersome npm package by the
+underlying javascript code. This is also useful to cut down the Node
+dependency tree for some cumbersome polyfills that all current web browsers
+already support."
+ (package
+ (name (string-append "node-"
+ (string-join (string-split node-name #\.) "-")))
+ (version (format #f "~a" version))
+ (source #f)
+ (build-system trivial-build-system)
+ (arguments
+ (list
+ #:builder
+ (with-imported-modules '((guix build utils))
+ #~(begin
+ (use-modules (guix build utils))
+ (let ((dir (string-append #$output "/lib/node_modules/" #$node-name)))
+ (mkdir-p dir)
+ (with-output-to-file (string-append dir "/index.js")
+ (lambda _
+ (format #t "module.exports = ~a\n" #$replacement)))
+ (when #$shams
+ (copy-file (string-append dir "/index.js")
+ (string-append dir "/shams.js")))
+ (with-output-to-file (string-append dir "/package.json")
+ (lambda _
+ (format #t "{\"name\":~s~a}\n" #$node-name
+ (if #$shams
+ "\
+,\"exports\":{\".\":\"./index.js\",\"./shams\":\"./shams.js\"}"
+ "")))))))))
+ (propagated-inputs propagated-inputs)
+ (home-page
+ (if mozilla-doclink
+ (string-append
+ "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/"
+ mozilla-doclink "#browser_compatibility")
+ ""))
+ (synopsis (string-append "Replacement for npm package " name))
+ (description description)
+ (license license:gpl3+)))
(define %node-build-system-modules
;; Build-side modules imported by default.
--
2.41.0
next prev parent reply other threads:[~2024-02-05 23:22 UTC|newest]
Thread overview: 96+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-05 23:06 [bug#68941] [PATCH 00/44] Node : a solution for tiny packages Nicolas Graves via Guix-patches via
2024-02-05 23:18 ` Nicolas Graves via Guix-patches via [this message]
2024-02-05 23:18 ` [bug#68941] [PATCH 02/44] guix: build-system: node: Add node-is-type-object helper Nicolas Graves via Guix-patches via
2024-02-06 19:33 ` Liliana Marie Prikler
2024-02-18 22:58 ` Nicolas Graves via Guix-patches via
2024-02-05 23:18 ` [bug#68941] [PATCH 03/44] gnu: Add node-function-bind Nicolas Graves via Guix-patches via
2024-02-05 23:18 ` [bug#68941] [PATCH 04/44] gnu: Add node-has-proto Nicolas Graves via Guix-patches via
2024-02-05 23:18 ` [bug#68941] [PATCH 05/44] gnu: Add node-has Nicolas Graves via Guix-patches via
2024-02-05 23:18 ` [bug#68941] [PATCH 06/44] gnu: Add node-has-symbols Nicolas Graves via Guix-patches via
2024-02-05 23:18 ` [bug#68941] [PATCH 07/44] gnu: Add node-has-tostringtag Nicolas Graves via Guix-patches via
2024-02-05 23:18 ` [bug#68941] [PATCH 08/44] gnu: Add node-is-callable Nicolas Graves via Guix-patches via
2024-02-05 23:18 ` [bug#68941] [PATCH 09/44] gnu: Add node-get-intrinsic Nicolas Graves via Guix-patches via
2024-02-05 23:18 ` [bug#68941] [PATCH 10/44] gnu: Add node-is-symbol Nicolas Graves via Guix-patches via
2024-02-05 23:18 ` [bug#68941] [PATCH 11/44] gnu: Add node-for-each Nicolas Graves via Guix-patches via
2024-02-05 23:19 ` [bug#68941] [PATCH 12/44] gnu: Add node-available-typed-arrays Nicolas Graves via Guix-patches via
2024-02-05 23:19 ` [bug#68941] [PATCH 13/44] gnu: Add node-gopd Nicolas Graves via Guix-patches via
2024-02-05 23:19 ` [bug#68941] [PATCH 14/44] gnu: Add node-call-bind Nicolas Graves via Guix-patches via
2024-02-05 23:19 ` [bug#68941] [PATCH 15/44] gnu: Add node-object-inspect Nicolas Graves via Guix-patches via
2024-02-05 23:19 ` [bug#68941] [PATCH 16/44] gnu: Add node-is-regex Nicolas Graves via Guix-patches via
2024-02-05 23:19 ` [bug#68941] [PATCH 17/44] gnu: Add node-which-typed-array Nicolas Graves via Guix-patches via
2024-02-05 23:19 ` [bug#68941] [PATCH 18/44] gnu: Add node-side-channel Nicolas Graves via Guix-patches via
2024-02-05 23:19 ` [bug#68941] [PATCH 19/44] gnu: Add node-is-weakmap Nicolas Graves via Guix-patches via
2024-02-05 23:19 ` [bug#68941] [PATCH 20/44] gnu: Add node-is-weakset Nicolas Graves via Guix-patches via
2024-02-05 23:19 ` [bug#68941] [PATCH 21/44] gnu: Add node-is-typed-array Nicolas Graves via Guix-patches via
2024-02-05 23:19 ` [bug#68941] [PATCH 22/44] gnu: Add node-is-shared-array-buffer Nicolas Graves via Guix-patches via
2024-02-05 23:19 ` [bug#68941] [PATCH 23/44] gnu: Add node-internal-slot Nicolas Graves via Guix-patches via
2024-02-05 23:19 ` [bug#68941] [PATCH 24/44] gnu: Add node-is-array-buffer Nicolas Graves via Guix-patches via
2024-02-05 23:19 ` [bug#68941] [PATCH 25/44] gnu: Add node-define-properties Nicolas Graves via Guix-patches via
2024-02-05 23:19 ` [bug#68941] [PATCH 26/44] gnu: Add node-is-arguments Nicolas Graves via Guix-patches via
2024-02-05 23:19 ` [bug#68941] [PATCH 27/44] gnu: Add node-isarray Nicolas Graves via Guix-patches via
2024-02-05 23:19 ` [bug#68941] [PATCH 28/44] gnu: Add node-stop-iteration-iterator Nicolas Graves via Guix-patches via
2024-02-05 23:19 ` [bug#68941] [PATCH 29/44] gnu: Add node-is-map Nicolas Graves via Guix-patches via
2024-02-05 23:19 ` [bug#68941] [PATCH 30/44] gnu: Add node-is-set Nicolas Graves via Guix-patches via
2024-02-05 23:19 ` [bug#68941] [PATCH 31/44] gnu: Add node-is-string Nicolas Graves via Guix-patches via
2024-02-05 23:19 ` [bug#68941] [PATCH 32/44] gnu: Add node-is-number-object Nicolas Graves via Guix-patches via
2024-02-05 23:19 ` [bug#68941] [PATCH 33/44] gnu: Add node-is-bigint Nicolas Graves via Guix-patches via
2024-02-05 23:19 ` [bug#68941] [PATCH 34/44] gnu: Add node-is-boolean-object Nicolas Graves via Guix-patches via
2024-02-05 23:19 ` [bug#68941] [PATCH 35/44] gnu: Add node-object-is Nicolas Graves via Guix-patches via
2024-02-05 23:19 ` [bug#68941] [PATCH 36/44] gnu: Add node-es-get-iterator Nicolas Graves via Guix-patches via
2024-02-05 23:19 ` [bug#68941] [PATCH 37/44] gnu: Add node-which-boxed-primitive Nicolas Graves via Guix-patches via
2024-02-05 23:19 ` [bug#68941] [PATCH 38/44] gnu: Add node-which-collection Nicolas Graves via Guix-patches via
2024-02-05 23:19 ` [bug#68941] [PATCH 39/44] gnu: Add node-array-buffer-byte-length Nicolas Graves via Guix-patches via
2024-02-05 23:19 ` [bug#68941] [PATCH 40/44] gnu: Add node-is-date-object Nicolas Graves via Guix-patches via
2024-02-05 23:19 ` [bug#68941] [PATCH 41/44] gnu: Add node-object-assign Nicolas Graves via Guix-patches via
2024-02-05 23:19 ` [bug#68941] [PATCH 42/44] gnu: Add node-object-keys Nicolas Graves via Guix-patches via
2024-02-05 23:19 ` [bug#68941] [PATCH 43/44] gnu: Add node-regexp-prototype-flags Nicolas Graves via Guix-patches via
2024-02-05 23:19 ` [bug#68941] [PATCH 44/44] gnu: Add node-deep-equal Nicolas Graves via Guix-patches via
2024-02-06 19:30 ` [bug#68941] [PATCH 01/44] guix: build-system: node: Add node-trivial-package helper Liliana Marie Prikler
2024-02-07 0:19 ` Nicolas Graves via Guix-patches via
2024-02-07 5:11 ` Liliana Marie Prikler
2024-06-01 16:12 ` Nicolas Graves via Guix-patches via
2024-06-01 16:19 ` Liliana Marie Prikler
2024-02-08 0:24 ` [bug#68941] [PATCH v2 01/44] guix: build-system: node: Add trivial-node-package helper Nicolas Graves via Guix-patches via
2024-02-08 0:24 ` [bug#68941] [PATCH v2 02/44] guix: build-system: node: Add node-is-type-object helper Nicolas Graves via Guix-patches via
2024-02-08 0:24 ` [bug#68941] [PATCH v2 03/44] gnu: Add node-function-bind Nicolas Graves via Guix-patches via
2024-02-08 0:24 ` [bug#68941] [PATCH v2 04/44] gnu: Add node-has-proto Nicolas Graves via Guix-patches via
2024-02-08 0:24 ` [bug#68941] [PATCH v2 05/44] gnu: Add node-has Nicolas Graves via Guix-patches via
2024-02-08 0:24 ` [bug#68941] [PATCH v2 06/44] gnu: Add node-has-symbols Nicolas Graves via Guix-patches via
2024-02-08 0:24 ` [bug#68941] [PATCH v2 07/44] gnu: Add node-has-tostringtag Nicolas Graves via Guix-patches via
2024-02-08 0:24 ` [bug#68941] [PATCH v2 08/44] gnu: Add node-is-callable Nicolas Graves via Guix-patches via
2024-02-08 0:24 ` [bug#68941] [PATCH v2 09/44] gnu: Add node-get-intrinsic Nicolas Graves via Guix-patches via
2024-02-08 0:24 ` [bug#68941] [PATCH v2 10/44] gnu: Add node-is-symbol Nicolas Graves via Guix-patches via
2024-02-08 0:24 ` [bug#68941] [PATCH v2 11/44] gnu: Add node-for-each Nicolas Graves via Guix-patches via
2024-02-08 0:24 ` [bug#68941] [PATCH v2 12/44] gnu: Add node-available-typed-arrays Nicolas Graves via Guix-patches via
2024-02-08 0:24 ` [bug#68941] [PATCH v2 13/44] gnu: Add node-gopd Nicolas Graves via Guix-patches via
2024-02-08 0:24 ` [bug#68941] [PATCH v2 14/44] gnu: Add node-call-bind Nicolas Graves via Guix-patches via
2024-02-08 0:24 ` [bug#68941] [PATCH v2 15/44] gnu: Add node-object-inspect Nicolas Graves via Guix-patches via
2024-02-08 0:24 ` [bug#68941] [PATCH v2 16/44] gnu: Add node-is-regex Nicolas Graves via Guix-patches via
2024-02-08 0:24 ` [bug#68941] [PATCH v2 17/44] gnu: Add node-which-typed-array Nicolas Graves via Guix-patches via
2024-02-08 0:24 ` [bug#68941] [PATCH v2 18/44] gnu: Add node-side-channel Nicolas Graves via Guix-patches via
2024-02-08 0:24 ` [bug#68941] [PATCH v2 19/44] gnu: Add node-is-weakmap Nicolas Graves via Guix-patches via
2024-02-08 0:24 ` [bug#68941] [PATCH v2 20/44] gnu: Add node-is-weakset Nicolas Graves via Guix-patches via
2024-02-08 0:24 ` [bug#68941] [PATCH v2 21/44] gnu: Add node-is-typed-array Nicolas Graves via Guix-patches via
2024-02-08 0:24 ` [bug#68941] [PATCH v2 22/44] gnu: Add node-is-shared-array-buffer Nicolas Graves via Guix-patches via
2024-02-08 0:24 ` [bug#68941] [PATCH v2 23/44] gnu: Add node-internal-slot Nicolas Graves via Guix-patches via
2024-02-08 0:24 ` [bug#68941] [PATCH v2 24/44] gnu: Add node-is-array-buffer Nicolas Graves via Guix-patches via
2024-02-08 0:24 ` [bug#68941] [PATCH v2 25/44] gnu: Add node-define-properties Nicolas Graves via Guix-patches via
2024-02-08 0:24 ` [bug#68941] [PATCH v2 26/44] gnu: Add node-is-arguments Nicolas Graves via Guix-patches via
2024-02-08 0:24 ` [bug#68941] [PATCH v2 27/44] gnu: Add node-isarray Nicolas Graves via Guix-patches via
2024-02-08 0:24 ` [bug#68941] [PATCH v2 28/44] gnu: Add node-stop-iteration-iterator Nicolas Graves via Guix-patches via
2024-02-08 0:24 ` [bug#68941] [PATCH v2 29/44] gnu: Add node-is-map Nicolas Graves via Guix-patches via
2024-02-08 0:24 ` [bug#68941] [PATCH v2 30/44] gnu: Add node-is-set Nicolas Graves via Guix-patches via
2024-02-08 0:24 ` [bug#68941] [PATCH v2 31/44] gnu: Add node-is-string Nicolas Graves via Guix-patches via
2024-02-08 0:24 ` [bug#68941] [PATCH v2 32/44] gnu: Add node-is-number-object Nicolas Graves via Guix-patches via
2024-02-08 0:24 ` [bug#68941] [PATCH v2 33/44] gnu: Add node-is-bigint Nicolas Graves via Guix-patches via
2024-02-08 0:24 ` [bug#68941] [PATCH v2 34/44] gnu: Add node-is-boolean-object Nicolas Graves via Guix-patches via
2024-02-08 0:24 ` [bug#68941] [PATCH v2 35/44] gnu: Add node-object-is Nicolas Graves via Guix-patches via
2024-02-08 0:24 ` [bug#68941] [PATCH v2 36/44] gnu: Add node-es-get-iterator Nicolas Graves via Guix-patches via
2024-02-08 0:25 ` [bug#68941] [PATCH v2 37/44] gnu: Add node-which-boxed-primitive Nicolas Graves via Guix-patches via
2024-02-08 0:25 ` [bug#68941] [PATCH v2 38/44] gnu: Add node-which-collection Nicolas Graves via Guix-patches via
2024-02-08 0:25 ` [bug#68941] [PATCH v2 39/44] gnu: Add node-array-buffer-byte-length Nicolas Graves via Guix-patches via
2024-02-08 0:25 ` [bug#68941] [PATCH v2 40/44] gnu: Add node-is-date-object Nicolas Graves via Guix-patches via
2024-02-08 0:25 ` [bug#68941] [PATCH v2 41/44] gnu: Add node-object-assign Nicolas Graves via Guix-patches via
2024-02-08 0:25 ` [bug#68941] [PATCH v2 42/44] gnu: Add node-object-keys Nicolas Graves via Guix-patches via
2024-02-08 0:25 ` [bug#68941] [PATCH v2 43/44] gnu: Add node-regexp-prototype-flags Nicolas Graves via Guix-patches via
2024-02-08 0:25 ` [bug#68941] [PATCH v2 44/44] gnu: Add node-deep-equal Nicolas Graves via Guix-patches via
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240205231952.26410-1-ngraves@ngraves.fr \
--to=guix-patches@gnu.org \
--cc=68941@debbugs.gnu.org \
--cc=ngraves@ngraves.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.