Subject: [bug#51838] [PATCH v6 40/41] gnu: Add node-serialport-stream.

From: Philip McGrath <[email-masked]>
Date: Thu, 30 Dec 2021 02:39:18 -0500

* gnu/packages/node-xyz.scm (node-serialport-stream): New variable.
---
 gnu/packages/node-xyz.scm | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index e427f31b1a..a95749f737 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -1317,3 +1317,34 @@ (define-public node-serialport-parser-byte-length
 Parsers are used to take raw binary data and transform them into usable
 messages.  This package provides @code{ByteLength}, a parser that emits data
 as a buffer every time a specified number of bytes are received.")))
+
+(define-public node-serialport-stream
+  (package
+    (inherit node-serialport-binding-abstract)
+    (name "node-serialport-stream")
+    (version "9.2.4")
+    (inputs
+     (list node-debug))
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'patch-dependencies 'delete-dependencies
+           (lambda args
+             (with-atomic-json-file-replacement "package.json"
+               (lambda (pkg-meta)
+                 (delete-dependencies pkg-meta
+                                      `(;; devDependencies
+                                        "@serialport/binding-mock"))))))
+         (add-after 'unpack 'chdir
+           (lambda args
+             (chdir "packages/stream"))))
+       #:tests? #f))
+    (synopsis "Node.js stream interface for Node SerialPort")
+    (description "Node SerialPort is a modular suite of Node.js packages for
+accessing serial ports.  The Guix package @code{node-serialport} provides the
+recommended high-level interface.
+
+This package provides an interface for using Node SerialPort bindings via the
+Node.js Stream API.  The stream is a duplex stream, allowing for reading and
+writing.  It has additional methods for managing the SerialPort
+connection.")))
-- 
2.32.0