[bug#55958,1/9] gnu: Add node-buffer-crc32.

Message ID 20220614094954.15197-1-ngraves@ngraves.fr
State New
Headers
Series [bug#55958,1/9] gnu: Add node-buffer-crc32. |

Commit Message

Nicolas Graves June 14, 2022, 9:49 a.m. UTC
  * gnu/packages/node-xyz.scm (node-buffer-crc32): New variable.
---
 gnu/packages/node-xyz.scm | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)
  

Comments

Nicolas Graves June 14, 2022, 10:03 a.m. UTC | #1
Hi !

This series of patches allows to produce the crx file without having to
rely on chromium and xorg.

Not fully tested, originally designed for fixing bug#55844, and works at
least for building a few extensions.

I volontarily built all node packages without development dependencies
(npm...) so that it stays simple, and replaced mri by minimist so that we
also avoid a lot of dependencies.

Cheers,

Nicolas
  
Marius Bakke June 23, 2022, 8:07 p.m. UTC | #2
Nicolas Graves via Guix-patches via <guix-patches@gnu.org> skriver:

> Hi !
>
> This series of patches allows to produce the crx file without having to
> rely on chromium and xorg.

Awesome.  :-)

> Not fully tested, originally designed for fixing bug#55844, and works at
> least for building a few extensions.

OK.  Looking forward to more Chromium extensions in Guix!

> I volontarily built all node packages without development dependencies
> (npm...) so that it stays simple, and replaced mri by minimist so that we
> also avoid a lot of dependencies.

Makes sense, well done.  I'll comment on the patches individually.

Thanks!
  
Marius Bakke June 23, 2022, 8:15 p.m. UTC | #3
Nicolas Graves via Guix-patches via <guix-patches@gnu.org> skriver:

> * gnu/packages/node-xyz.scm (node-buffer-crc32): New variable.

[...]

> +    (arguments
> +     '(#:phases
> +       (modify-phases %standard-phases
> +         (delete 'check)

Use #:tests? #f instead of deleting the phase.

> +         (replace 'configure
> +           (lambda* (#:key inputs #:allow-other-keys)
> +             (invoke (string-append (assoc-ref inputs "node") "/bin/npm")
> +                     "--offline" "--ignore-scripts" "install" "--production")

Use (search-input-file inputs "/bin/npm") instead of (assoc-ref inputs ...).

Although in this case I think you don't need the absolute file name as
"npm" should already be on PATH, so you can just (invoke "npm" ...).


> +             #t)))))

There is no need to end phases on #t any more.

> +    (home-page "https://github.com/brianloveswords/buffer-crc32")
> +    (synopsis "crc32 that works with binary data and fancy character sets,
> +outputs buffer, signed or unsigned data and has tests.")

Try to keep synopses short, and avoid duplicating the description.
Maybe something like "CRC32 implementation in JavaScript"?

> +    (description "This package provides crc32 that works with binary data and

s/crc32/a CRC32 algorithm/

> +fancy character sets, outputs buffer, signed or unsigned data and has tests, for

I don't understand what "outputs buffer" means here, can you elaborate?

Otherwise LGTM.
  

Patch

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 9dcb5c3d16..be37d627cf 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -56,6 +56,38 @@  (define-public node-acorn
 architecture supporting plugins.")
     (license license:expat)))
 
+(define-public node-buffer-crc32
+  (package
+    (name "node-buffer-crc32")
+    (version "0.2.13")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/brianloveswords/buffer-crc32")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+          (base32
+           "09qx2mnd898190m50mc0rhyvbm7d677sxz9bn09qmqkz6fnsddgf"))))
+    (build-system node-build-system)
+    (arguments
+     '(#:phases
+       (modify-phases %standard-phases
+         (delete 'check)
+         (replace 'configure
+           (lambda* (#:key inputs #:allow-other-keys)
+             (invoke (string-append (assoc-ref inputs "node") "/bin/npm")
+                     "--offline" "--ignore-scripts" "install" "--production")
+             #t)))))
+    (home-page "https://github.com/brianloveswords/buffer-crc32")
+    (synopsis "crc32 that works with binary data and fancy character sets,
+outputs buffer, signed or unsigned data and has tests.")
+    (description "This package provides crc32 that works with binary data and
+fancy character sets, outputs buffer, signed or unsigned data and has tests, for
+Node.")
+    (license license:expat)))
+
 (define-public node-color-name
   (package
     (name "node-color-name")