diff mbox series

[bug#51838,v3,30/43] gnu: Add node-file-uri-to-path.

Message ID 20211208202838.752542-31-philip@philipmcgrath.com
State Accepted
Headers show
Series guix: node-build-system: Support compiling add-ons with node-gyp. | expand

Commit Message

Philip McGrath Dec. 8, 2021, 8:28 p.m. UTC
* gnu/packages/node-xyz.scm (node-file-uri-to-path): New variable.
---
 gnu/packages/node-xyz.scm | 54 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 54 insertions(+)

Comments

Pierre Langlois Dec. 12, 2021, 4:26 p.m. UTC | #1
Philip McGrath <philip@philipmcgrath.com> writes:

> * gnu/packages/node-xyz.scm (node-file-uri-to-path): New variable.
> ---
>  gnu/packages/node-xyz.scm | 54 +++++++++++++++++++++++++++++++++++++++
>  1 file changed, 54 insertions(+)
>
> diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
> index b979d0cd53..d23326fa25 100644
> --- a/gnu/packages/node-xyz.scm
> +++ b/gnu/packages/node-xyz.scm
> @@ -24,6 +24,7 @@ (define-module (gnu packages node-xyz)
>    #:use-module ((guix licenses) #:prefix license:)
>    #:use-module (gnu packages sqlite)
>    #:use-module (gnu packages python)
> +  #:use-module (gnu packages web)
>    #:use-module (guix gexp)
>    #:use-module (guix packages)
>    #:use-module (guix git-download)
> @@ -772,3 +773,56 @@ (define-public node-sqlite3
>  non-blocking bindings for SQLite3, written in modern C++ and tested for memory
>  leaks.")
>       (license license:bsd-3)))
> +
> +(define-public node-file-uri-to-path
> +  (package
> +    (name "node-file-uri-to-path")
> +    (version "2.0.0")
> +    (source
> +     (origin
> +       (method git-fetch)
> +       (uri (git-reference
> +             (url "https://github.com/TooTallNate/file-uri-to-path")
> +             (commit version)))
> +       (file-name (git-file-name name version))
> +       (sha256
> +        (base32 "08l779az44czm12xdhgcrnzpqw34s59hbrlfphs7g9y2k26drqav"))))
> +    (native-inputs
> +     `(("esbuild" ,esbuild)))
> +    (build-system node-build-system)
> +    (arguments
> +     `(#:absent-dependencies
> +       `("@types/mocha"
> +         "@types/node"
> +         "@typescript-eslint/eslint-plugin"
> +         "@typescript-eslint/parser"
> +         "cpy-cli"
> +         "eslint"
> +         "eslint-config-airbnb"
> +         "eslint-config-prettier"
> +         "eslint-import-resolver-typescript"
> +         "eslint-plugin-import"
> +         "eslint-plugin-jsx-a11y"
> +         "eslint-plugin-react"
> +         "mocha"
> +         "rimraf"
> +         "typescript")
> +       #:phases
> +       (modify-phases %standard-phases
> +         (replace 'build
> +           (lambda* (#:key inputs native-inputs #:allow-other-keys)
> +             (copy-recursively "src" "dist")
> +             (invoke (string-append
> +                      (assoc-ref (or native-inputs inputs) "esbuild")
> +                      "/bin/esbuild")
> +                     "dist/index.ts"
> +                     "--outfile=dist/src/index.js"
> +                     "--format=cjs"
> +                     "--sourcemap"
> +                     "--platform=node"))))
> +       #:tests? #f))
> +    (home-page "https://github.com/TooTallNate/file-uri-to-path")
> +    (synopsis "Convert a @code{file:} URI to a file path")
> +    (description "Accepts a @code{file:} URI and returns a regular file path
> +suitable for use with the @code{fs} module functions.")

nit: We generally write description as full sentences, I'd suggest:

--8<---------------cut here---------------start------------->8---
This package provides a method to convert a @code{file:} URI to a file
path.  It accepts a @code{file:} URI and returns a regular file path
suitable for use with the @code{fs} module functions.
--8<---------------cut here---------------end--------------->8---

Otherwise LGTM!

Thanks,
Pierre
Philip McGrath Dec. 12, 2021, 9:34 p.m. UTC | #2
On 12/12/21 11:26, Pierre Langlois wrote:
> 
> Philip McGrath <philip@philipmcgrath.com> writes:
> 
>> * gnu/packages/node-xyz.scm (node-file-uri-to-path): New variable.
>> ---
>>   gnu/packages/node-xyz.scm | 54 +++++++++++++++++++++++++++++++++++++++
>>   1 file changed, 54 insertions(+)
>>
>> diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
>> index b979d0cd53..d23326fa25 100644
>> --- a/gnu/packages/node-xyz.scm
>> +++ b/gnu/packages/node-xyz.scm
>> @@ -24,6 +24,7 @@ (define-module (gnu packages node-xyz)
>>     #:use-module ((guix licenses) #:prefix license:)
>>     #:use-module (gnu packages sqlite)
>>     #:use-module (gnu packages python)
>> +  #:use-module (gnu packages web)
>>     #:use-module (guix gexp)
>>     #:use-module (guix packages)
>>     #:use-module (guix git-download)
>> @@ -772,3 +773,56 @@ (define-public node-sqlite3
>>   non-blocking bindings for SQLite3, written in modern C++ and tested for memory
>>   leaks.")
>>        (license license:bsd-3)))
>> +
>> +(define-public node-file-uri-to-path
>> +  (package
>> +    (name "node-file-uri-to-path")
>> +    (version "2.0.0")
>> +    (source
>> +     (origin
>> +       (method git-fetch)
>> +       (uri (git-reference
>> +             (url "https://github.com/TooTallNate/file-uri-to-path")
>> +             (commit version)))
>> +       (file-name (git-file-name name version))
>> +       (sha256
>> +        (base32 "08l779az44czm12xdhgcrnzpqw34s59hbrlfphs7g9y2k26drqav"))))
>> +    (native-inputs
>> +     `(("esbuild" ,esbuild)))
>> +    (build-system node-build-system)
>> +    (arguments
>> +     `(#:absent-dependencies
>> +       `("@types/mocha"
>> +         "@types/node"
>> +         "@typescript-eslint/eslint-plugin"
>> +         "@typescript-eslint/parser"
>> +         "cpy-cli"
>> +         "eslint"
>> +         "eslint-config-airbnb"
>> +         "eslint-config-prettier"
>> +         "eslint-import-resolver-typescript"
>> +         "eslint-plugin-import"
>> +         "eslint-plugin-jsx-a11y"
>> +         "eslint-plugin-react"
>> +         "mocha"
>> +         "rimraf"
>> +         "typescript")
>> +       #:phases
>> +       (modify-phases %standard-phases
>> +         (replace 'build
>> +           (lambda* (#:key inputs native-inputs #:allow-other-keys)
>> +             (copy-recursively "src" "dist")
>> +             (invoke (string-append
>> +                      (assoc-ref (or native-inputs inputs) "esbuild")
>> +                      "/bin/esbuild")
>> +                     "dist/index.ts"
>> +                     "--outfile=dist/src/index.js"
>> +                     "--format=cjs"
>> +                     "--sourcemap"
>> +                     "--platform=node"))))
>> +       #:tests? #f))
>> +    (home-page "https://github.com/TooTallNate/file-uri-to-path")
>> +    (synopsis "Convert a @code{file:} URI to a file path")
>> +    (description "Accepts a @code{file:} URI and returns a regular file path
>> +suitable for use with the @code{fs} module functions.")
> 
> nit: We generally write description as full sentences, I'd suggest:
> 
> --8<---------------cut here---------------start------------->8---
> This package provides a method to convert a @code{file:} URI to a file
> path.  It accepts a @code{file:} URI and returns a regular file path
> suitable for use with the @code{fs} module functions.
> --8<---------------cut here---------------end--------------->8---

Yes, I'll do something like that.

-Philip
diff mbox series

Patch

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index b979d0cd53..d23326fa25 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -24,6 +24,7 @@  (define-module (gnu packages node-xyz)
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (gnu packages sqlite)
   #:use-module (gnu packages python)
+  #:use-module (gnu packages web)
   #:use-module (guix gexp)
   #:use-module (guix packages)
   #:use-module (guix git-download)
@@ -772,3 +773,56 @@  (define-public node-sqlite3
 non-blocking bindings for SQLite3, written in modern C++ and tested for memory
 leaks.")
      (license license:bsd-3)))
+
+(define-public node-file-uri-to-path
+  (package
+    (name "node-file-uri-to-path")
+    (version "2.0.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/TooTallNate/file-uri-to-path")
+             (commit version)))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "08l779az44czm12xdhgcrnzpqw34s59hbrlfphs7g9y2k26drqav"))))
+    (native-inputs
+     `(("esbuild" ,esbuild)))
+    (build-system node-build-system)
+    (arguments
+     `(#:absent-dependencies
+       `("@types/mocha"
+         "@types/node"
+         "@typescript-eslint/eslint-plugin"
+         "@typescript-eslint/parser"
+         "cpy-cli"
+         "eslint"
+         "eslint-config-airbnb"
+         "eslint-config-prettier"
+         "eslint-import-resolver-typescript"
+         "eslint-plugin-import"
+         "eslint-plugin-jsx-a11y"
+         "eslint-plugin-react"
+         "mocha"
+         "rimraf"
+         "typescript")
+       #:phases
+       (modify-phases %standard-phases
+         (replace 'build
+           (lambda* (#:key inputs native-inputs #:allow-other-keys)
+             (copy-recursively "src" "dist")
+             (invoke (string-append
+                      (assoc-ref (or native-inputs inputs) "esbuild")
+                      "/bin/esbuild")
+                     "dist/index.ts"
+                     "--outfile=dist/src/index.js"
+                     "--format=cjs"
+                     "--sourcemap"
+                     "--platform=node"))))
+       #:tests? #f))
+    (home-page "https://github.com/TooTallNate/file-uri-to-path")
+    (synopsis "Convert a @code{file:} URI to a file path")
+    (description "Accepts a @code{file:} URI and returns a regular file path
+suitable for use with the @code{fs} module functions.")
+    (license license:expat)))