From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id qDMwHMofxGXUJQEAe85BDQ:P1 (envelope-from ) for ; Thu, 08 Feb 2024 01:26:50 +0100 Received: from aspmx1.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id qDMwHMofxGXUJQEAe85BDQ (envelope-from ) for ; Thu, 08 Feb 2024 01:26:50 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gnu.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1707352010; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post; bh=Ye/u0x6K53TzwcEL44IEjXIPSg6+H9JF1OsSCAPbmk0=; b=f4sL03mpzjiwCI0L3p4Lpg7GASXBm62Akyi+HEkvMBdNVCyHaz0n5QmqTPqKOIn8xzCWka XHE/lai3y+oBUacsa89iHL2DES5lZ2RxvyJv5VYHW9L5nBLyOQXRWmMW1BLFWEr52YVLGU Bcaflo7S8PoZx/x37X1olmU6nkRsmmTWCXzTicWv8f5Jl44JkWwvN5diGysPC4/QYtKvbN RILQVVtd6/NpObEGJYwk2OZUH8QY7lSH9FQqcRb3Hnf+AKnsPJ/iuuq5UIXLrd7YcEs+8v prw+EUMX3STHqXS9o6asIt/vm2W52aYslnMt4wGTNgevNoKh5cO0hRlCDVzUbw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gnu.org ARC-Seal: i=1; s=key1; d=yhetil.org; t=1707352010; a=rsa-sha256; cv=none; b=Kix3bwVDL3s473z9SCtfFRIzXIB75s2WrRz9ChtF1zmr62Omln00swIb3fr15ssJuvCIOw oBMQH0PRep7SThHtt1HIL/gKtM7D3Abkf9zwWHmvZoMh72V8y6Vm/wnuLf7qaiptmaO7JS HvL51jl7glm0pkpKp0tdtrb5okztJ7sleqobebuRYNm1Vtiraaw9/MKwh4+0x6PFyVjQKh TAzHHcVGrPGhtYLA9KPxvEw5Oo+smSCWl2vSZAVDvntQ+Zn3SEsYF/OiBYHjG8U3aLngSa FgbO892P89PqRbhY188vBXEFW4CIvaZoISJplIkAqVv27XGEBRuZ59yseeJW5A== Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 18E0869FF8 for ; Thu, 8 Feb 2024 01:26:49 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rXsEh-0000g4-3m; Wed, 07 Feb 2024 19:25:51 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rXsEf-0000dn-2P for guix-patches@gnu.org; Wed, 07 Feb 2024 19:25:49 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rXsEe-0000lO-K4 for guix-patches@gnu.org; Wed, 07 Feb 2024 19:25:48 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rXsEs-00073L-JY for guix-patches@gnu.org; Wed, 07 Feb 2024 19:26:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#68941] [PATCH v2 01/44] guix: build-system: node: Add trivial-node-package helper. References: <20240205231557.22629-1-ngraves@ngraves.fr> In-Reply-To: <20240205231557.22629-1-ngraves@ngraves.fr> Resent-From: Nicolas Graves Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 08 Feb 2024 00:26:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 68941 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 68941@debbugs.gnu.org Cc: ngraves@ngraves.fr Received: via spool by 68941-submit@debbugs.gnu.org id=B68941.170735195427022 (code B ref 68941); Thu, 08 Feb 2024 00:26:02 +0000 Received: (at 68941) by debbugs.gnu.org; 8 Feb 2024 00:25:54 +0000 Received: from localhost ([127.0.0.1]:58324 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rXsEk-00071j-7t for submit@debbugs.gnu.org; Wed, 07 Feb 2024 19:25:54 -0500 Received: from 15.mo581.mail-out.ovh.net ([87.98.180.21]:45447) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rXsEg-00071I-LE for 68941@debbugs.gnu.org; Wed, 07 Feb 2024 19:25:52 -0500 Received: from director10.ghost.mail-out.ovh.net (unknown [10.109.139.225]) by mo581.mail-out.ovh.net (Postfix) with ESMTP id 3F3C2270F6 for <68941@debbugs.gnu.org>; Thu, 8 Feb 2024 00:25:33 +0000 (UTC) Received: from ghost-submission-6684bf9d7b-ltz77 (unknown [10.110.168.40]) by director10.ghost.mail-out.ovh.net (Postfix) with ESMTPS id EC56E1FE39; Thu, 8 Feb 2024 00:25:32 +0000 (UTC) Received: from ngraves.fr ([37.59.142.108]) by ghost-submission-6684bf9d7b-ltz77 with ESMTPSA id E13ONXwfxGUQbwIA49HlTA (envelope-from ); Thu, 08 Feb 2024 00:25:32 +0000 X-OVh-ClientIp: 81.67.146.208 Date: Thu, 8 Feb 2024 01:24:24 +0100 Message-ID: <20240208002527.27165-1-ngraves@ngraves.fr> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Ovh-Tracer-Id: 2268969788741706466 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: 0 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvledrtdefgddvvdcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecunecujfgurhephffvvefufffkofggtgfgsehtkeertdertdejnecuhfhrohhmpefpihgtohhlrghsucfirhgrvhgvshcuoehnghhrrghvvghssehnghhrrghvvghsrdhfrheqnecuggftrfgrthhtvghrnhepkefgteelueekleefffeuieejieekveffueevueffiefgieetieejheffgeeflefhnecuffhomhgrihhnpehmohiiihhllhgrrdhorhhgnecukfhppeduvdejrddtrddtrddupdekuddrieejrddugeeirddvtdekpdefjedrheelrddugedvrddutdeknecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepuddvjedrtddrtddruddpmhgrihhlfhhrohhmpeeonhhgrhgrvhgvshesnhhgrhgrvhgvshdrfhhrqedpnhgspghrtghpthhtohepuddprhgtphhtthhopeeikeelgeduseguvggssghughhsrdhgnhhurdhorhhgpdfovfetjfhoshhtpehmohehkedupdhmohguvgepshhmthhpohhuth X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Nicolas Graves X-ACL-Warn: , Nicolas Graves via Guix-patches From: Nicolas Graves via Guix-patches via Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: -7.17 X-Migadu-Queue-Id: 18E0869FF8 X-Spam-Score: -7.17 X-Migadu-Scanner: mx11.migadu.com X-TUID: OJa11Sigxgkp * guix/build-system/node.scm (trivial-node-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 ;;; Copyright © 2021 Philip McGrath ;;; Copyright © 2021 Dhruvin Gandhi -;;; Copyright © 2022 Nicolas Graves +;;; Copyright © 2022, 2023, 2024 Nicolas Graves ;;; Copyright © 2023 Jelle Licht ;;; ;;; This file is part of GNU Guix. diff --git a/guix/build-system/node.scm b/guix/build-system/node.scm index 3f73390809..a16627e68c 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 + + trivial-node-package)) + +(define* (trivial-node-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