[PATCH] gnu: Add esbuild.

  • Done
  • quality assurance status badge
Details
2 participants
  • Efraim Flashner
  • Ryan Prior
Owner
unassigned
Submitted by
Ryan Prior
Severity
normal
R
R
Ryan Prior wrote on 7 Oct 2020 04:31
(address . guix-patches@gnu.org)
20201007023119.22495-1-rprior@protonmail.com
* gnu/packages/web.scm (esbuild): New variable.
---
gnu/packages/web.scm | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)

Toggle diff (41 lines)
diff --git a/gnu/packages/web.scm b/gnu/packages/web.scm
index b798e0abca..1e2f2e7e10 100644
--- a/gnu/packages/web.scm
+++ b/gnu/packages/web.scm
@@ -1345,6 +1345,34 @@ used to validate and fix HTML data.")
(home-page "http://tidy.sourceforge.net/")
(license (license:x11-style "file:///include/tidy.h"))))
+(define-public esbuild
+ (package
+ (name "esbuild")
+ (version "0.7.11")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/evanw/esbuild")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "08lx1i0s1q3my6x4csz746rc3c2fl4p0hyrwx4rpx80gwwjj1i11"))))
+ (build-system go-build-system)
+ (arguments
+ '(#:import-path "github.com/evanw/esbuild/cmd/esbuild"
+ #:unpack-path "github.com/evanw/esbuild"))
+ (inputs
+ `(("go-golang-org-x-sys" ,go-golang-org-x-sys)))
+ (home-page "https://github.com/evanw/esbuild")
+ (synopsis "Bundler and minifier tool for JavaScript and TypeScript")
+ (description
+ "The esbuild tool provides a unified bundler, transpiler and
+minifier. It packages up JavaScript and TypeScript code, along with JSON
+and other data, for distribution on the web.")
+ (license license:expat)))
+
(define-public tinyproxy
(package
(name "tinyproxy")
--
2.17.1
E
E
Efraim Flashner wrote on 7 Oct 2020 08:34
(name . Ryan Prior)(address . rprior@protonmail.com)(address . 43840@debbugs.gnu.org)
20201007063431.GH21174@E5400
On Wed, Oct 07, 2020 at 02:31:24AM +0000, Ryan Prior via Guix-patches via wrote:
Toggle quote (48 lines)
> * gnu/packages/web.scm (esbuild): New variable.
> ---
> gnu/packages/web.scm | 28 ++++++++++++++++++++++++++++
> 1 file changed, 28 insertions(+)
>
> diff --git a/gnu/packages/web.scm b/gnu/packages/web.scm
> index b798e0abca..1e2f2e7e10 100644
> --- a/gnu/packages/web.scm
> +++ b/gnu/packages/web.scm
> @@ -1345,6 +1345,34 @@ used to validate and fix HTML data.")
> (home-page "http://tidy.sourceforge.net/")
> (license (license:x11-style "file:///include/tidy.h"))))
>
> +(define-public esbuild
> + (package
> + (name "esbuild")
> + (version "0.7.11")
> + (source
> + (origin
> + (method git-fetch)
> + (uri (git-reference
> + (url "https://github.com/evanw/esbuild")
> + (commit (string-append "v" version))))
> + (file-name (git-file-name name version))
> + (sha256
> + (base32
> + "08lx1i0s1q3my6x4csz746rc3c2fl4p0hyrwx4rpx80gwwjj1i11"))))
> + (build-system go-build-system)
> + (arguments
> + '(#:import-path "github.com/evanw/esbuild/cmd/esbuild"
> + #:unpack-path "github.com/evanw/esbuild"))
> + (inputs
> + `(("go-golang-org-x-sys" ,go-golang-org-x-sys)))
> + (home-page "https://github.com/evanw/esbuild")
> + (synopsis "Bundler and minifier tool for JavaScript and TypeScript")
> + (description
> + "The esbuild tool provides a unified bundler, transpiler and
> +minifier. It packages up JavaScript and TypeScript code, along with JSON
> +and other data, for distribution on the web.")
> + (license license:expat)))
> +
> (define-public tinyproxy
> (package
> (name "tinyproxy")
> --
> 2.17.1
>

First pass, I don't see a vendor directory that needs to be deleted, and
it does seem to only really depend on go-golang-org-x-sys, which is
nice. There is an npm directory which is where the compiled binaries are
placed, there are a couple in the checked out repo.

Toggle diff (30 lines)
diff --git a/gnu/packages/web.scm b/gnu/packages/web.scm
index 1e2f2e7e10..f55f1a02d9 100644
--- a/gnu/packages/web.scm
+++ b/gnu/packages/web.scm
@@ -1358,7 +1358,13 @@ used to validate and fix HTML data.")
(file-name (git-file-name name version))
(sha256
(base32
- "08lx1i0s1q3my6x4csz746rc3c2fl4p0hyrwx4rpx80gwwjj1i11"))))
+ "08lx1i0s1q3my6x4csz746rc3c2fl4p0hyrwx4rpx80gwwjj1i11"))
+ (modules '((guix build utils)))
+ (snippet
+ '(begin
+ ;; Remove pre-compiled binaries
+ (delete-file-recursively "npm")
+ #t))))
(build-system go-build-system)
(arguments
'(#:import-path "github.com/evanw/esbuild/cmd/esbuild"

`esbuild --help` still works after removing the npm directory.

Is it worth trying to run some of the test suite? I see there are a
couple of 'make check' type targets in the Makefile at the root of the
repository and currently there are none run during the build.

--
Efraim Flashner <efraim@flashner.co.il> אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted
-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEEoov0DD5VE3JmLRT3Qarn3Mo9g1EFAl99YXIACgkQQarn3Mo9
g1EBTA//QMWVHAs8Mpt6XTDcHZ9MEdoNxsNMGiMXke48F8UsceyIJqVisJzeNsxq
im8sLxdD9cItF9u96ULSADOewvR4VWIULnPSMXZOOuJVwJQIyo91axsESVhUs75Y
c/369rJS5bkqwErzpbk5P7dc8eg/xwq/45g+xqB6K4Km6Y133pVAtOL8q6rvAfal
2JDrB/t6ATZlMWWe5G82N0mDZyf51AbPuYGum5YxCimorY7de+OB8+tnul2HwdX0
DRifZp5+gm01dwASbCRFbcduUkzK78IIWvMyWPykuFrXWtsLIi9ZK7CUKDWVLcWX
7s/d6XryaEvvBUF0aFKPNsSf3OL/uzspv0OvlkhWOLCTRlxaSYBRGwbjc2pCpnVa
kz6jxUBIxEnVhyKpvQ6jhMaJKCw55LbVTcP71P9HFi9eQqZX3QYL4kwTvZPokbmU
iL+QUsAsL26n+ogbGxoAKkq9zeWy99QUR9oAecRc1L6vXbBiiaJceMzn7mAzTitD
hrwEDd9kTzKaCoNGgYGsmn6pN1CBsFA0dUWLxOYR3Sz4bD2PBBiLjuiYzHGzMNdt
D1FmdqdWL+QUexk6RRci0ZPASYz1vS+e9j/NzarN6XmoHJe6L+h5tK0R3e+TXrzT
6pWnv7uTsMCcprg64EOhRM0047+YMWbEo3knKXiFH4UK7Fws5ZA=
=4SkT
-----END PGP SIGNATURE-----


R
R
Ryan Prior wrote on 8 Oct 2020 04:08
(name . Efraim Flashner)(address . efraim@flashner.co.il)(name . 43840@debbugs.gnu.org)(address . 43840@debbugs.gnu.org)
eRbjjbkvSfoIArq_dDiUdIJuEELuy9q0D1IjfscSbHRUxVzaKiPLRVlip0--bqGYaSiw_PDAhSrGLk-O0WJERF7MidM3bFZISAReIpsWG5A=@protonmail.com
Hey Efraim, thank you for your comments!

On Wednesday, October 7th, 2020 at 6:34 AM, Efraim Flashner <efraim@flashner.co.il> wrote:

Toggle quote (3 lines)
> There is an npm directory which is where the compiled binaries are
> placed, there are a couple in the checked out repo.

The compiled binaries might be placed there by the gnu-build-system, but the go-build-system does not put binaries there by itself. (Note that their make target explicitly specifies output directories.)

I think our build totally ignores this directory, so it shouldn't matter whether we delete it, but if you think removing the unneeded directory improves the package I'll update the patch with a snippet.

Toggle quote (4 lines)
> Is it worth trying to run some of the test suite? I see there are a
> couple of 'make check' type targets in the Makefile at the root of the
> repository and currently there are none run during the build.

It would be nice to run their tests, but the test system currently assumes network access to install some various JavaScript dependencies using npm. We might patch the test system and vendor in the deps (used only for testing,) what do you think?

Ryan
E
E
Efraim Flashner wrote on 11 Oct 2020 12:28
(name . Ryan Prior)(address . rprior@protonmail.com)(name . 43840@debbugs.gnu.org)(address . 43840@debbugs.gnu.org)
20201011102853.GB1301@E5400
On Thu, Oct 08, 2020 at 02:08:36AM +0000, Ryan Prior wrote:
Toggle quote (11 lines)
> Hey Efraim, thank you for your comments!
>
> On Wednesday, October 7th, 2020 at 6:34 AM, Efraim Flashner <efraim@flashner.co.il> wrote:
>
> > There is an npm directory which is where the compiled binaries are
> > placed, there are a couple in the checked out repo.
>
> The compiled binaries might be placed there by the gnu-build-system, but the go-build-system does not put binaries there by itself. (Note that their make target explicitly specifies output directories.)
>
> I think our build totally ignores this directory, so it shouldn't matter whether we delete it, but if you think removing the unneeded directory improves the package I'll update the patch with a snippet.

It's important to not ship any precompiled binaries so go ahead and
remove them in a snippet.

Toggle quote (7 lines)
> > Is it worth trying to run some of the test suite? I see there are a
> > couple of 'make check' type targets in the Makefile at the root of the
> > repository and currently there are none run during the build.
>
> It would be nice to run their tests, but the test system currently assumes network access to install some various JavaScript dependencies using npm. We might patch the test system and vendor in the deps (used only for testing,) what do you think?
>

I was able to run some of the test suite with the following arguments section:

(arguments
'(#:import-path "github.com/evanw/esbuild/cmd/esbuild"
#:unpack-path "github.com/evanw/esbuild"
#:phases
(modify-phases %standard-phases
(replace 'check
(lambda* (#:key tests? unpack-path #:allow-other-keys)
(if tests?
(with-directory-excursion (string-append "src/" unpack-path)
(invoke "make" "test-go"))
#t))))))

Unfortunately it also depends on github.com/kylelemons/godebug/diff, but
it doesn't look like it has any dependants. With that added as a
native-input I think it's ready.

Toggle quote (2 lines)
> Ryan

Thanks

--
Efraim Flashner <efraim@flashner.co.il> אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted
-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEEoov0DD5VE3JmLRT3Qarn3Mo9g1EFAl+C3mIACgkQQarn3Mo9
g1GguA/+LSWqZyAvyql0Try/Xq2EIHSSIb42KqBG7lQMJo4JbgeTqFWWvK0kNalC
ee3Ks8DvasuEM0WYbk2wWsoC0u+fseYeefZkb8aHIGXeti8iTLUcOaauGTHE96ym
BMPqL3QiQhDY2r6ALJKJWCsxMZvO/z+ynpqJkPLSRoYkBJHYkyBh3xekeLL0zjXK
hoKfqMirpOcpR9l7iT3rowdjC+DBWq4x8UIC8DjHN6FsxAbpgdTZRXzEIpg1jy9s
US+nWFiJ2FTbtP/9C/6HtpolOgusBZZ0JiAkhnA0qC1wBJabm1hGuiAydeBfdK4u
nqXMVYl9JHKQiR9H0HWr6P7rbKbnf9ZxoyoWrJioRa4Z27BTjbzJT/7c05a/EW5F
SCFTitCivrPLDNmBGghwJxkOHyOnTUNmwpWhH2cxcalh9ZfFFy3MKX7rHiQq1g6R
Voz4zM27do2vrdu8/0c+u6SdOjgfARqPRetzDNkSJYW/ehpEIwM0ojyhYtpsa2X7
7l2i6RVkI8+UebA/aw52+hhs8lxTKUJnrxA97YU2BQ0/b7rDrfTql+plkXPoVY1w
ucYqCItAqgy9ClxQbusgwcoiDQsMO50OvOCPdG5jRYSgvp75+fu9SANFJyuZeHXw
O9+rtLTuGjkX5sytQGyNf//dFAMt/YYrpm2h2XAvfqqH/rZE7SA=
=PX+p
-----END PGP SIGNATURE-----


R
R
Ryan Prior wrote on 11 Oct 2020 18:15
(name . Efraim Flashner)(address . efraim@flashner.co.il)(name . 43840@debbugs.gnu.org)(address . 43840@debbugs.gnu.org)
impJSqTruwGOFiNbNOpGCv26lJXzeDb0kcRXhSvTNX-FoS2SybRjbQXf3gbgkeok8YdEmJftvGfxjLPQjmds8HwEp4rShLmCuxU_VtXW0g8=@protonmail.com
On Sunday, October 11th, 2020 at 10:28 AM, Efraim Flashner <efraim@flashner.co.il> wrote:
Toggle quote (3 lines)
> It's important to not ship any precompiled binaries so go ahead and
> remove them in a snippet.

You got it.

Toggle quote (6 lines)
> I was able to run some of the test suite with the following arguments section:
> [snip]
> Unfortunately it also depends on github.com/kylelemons/godebug/diff, but
> it doesn't look like it has any dependants. With that added as a
> native-input I think it's ready.

I do have a package for godebug. If you want to run all the tests, it goes in to the `scripts` module and runs `npm install` to pull in various test dependencies: https://github.com/evanw/esbuild/blob/master/scripts/package.json

But running just the "test-go" target seems like a good compromise for now! Maybe we can revisit this once node packaging in Guix is in a better state (which esbuild may help us with.)

I'll send my godebug package and an updated esbuild package with the code to run the tests.

Ryan
R
R
Ryan Prior wrote on 11 Oct 2020 18:16
[PATCH 1/2] gnu: Add go-github-com-kylelemons-godebug.
(address . 43840@debbugs.gnu.org)
20201011161619.30562-1-rprior@protonmail.com
* gnu/packages/golang.scm (go-github-com-kylelemons-godebug): New variable.
---
gnu/packages/golang.scm | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)

Toggle diff (39 lines)
diff --git a/gnu/packages/golang.scm b/gnu/packages/golang.scm
index fb7f7174fb..b89b62cea2 100644
--- a/gnu/packages/golang.scm
+++ b/gnu/packages/golang.scm
@@ -3378,6 +3378,32 @@ format in Go.")
(home-page "https://github.com/kr/pretty")
(license license:expat)))
+(define-public go-github-com-kylelemons-godebug
+ (package
+ (name "go-github-com-kylelemons-godebug")
+ (version "1.1.0")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/kylelemons/godebug")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "0dkk3friykg8p6wgqryx6745ahhb9z1j740k7px9dac6v5xjp78c"))))
+ (build-system go-build-system)
+ (arguments
+ '(#:import-path "github.com/kylelemons/godebug/diff"
+ #:unpack-path "github.com/kylelemons/godebug"))
+ (home-page "https://github.com/kylelemons/godebug")
+ (synopsis "Pretty printer for Go values.")
+ (description
+ "This package will pretty print a compact representation of a Go data
+structure. It can also produce a much more verbose, one-item-per-line
+representation suitable for computing diffs.")
+ (license license:asl2.0)))
+
(define-public go-github-com-kr-text
(package
(name "go-github-com-kr-text")
--
2.17.1
R
R
Ryan Prior wrote on 11 Oct 2020 18:16
[PATCH 2/2] gnu: Add esbuild.
(address . 43840@debbugs.gnu.org)
20201011161619.30562-2-rprior@protonmail.com
* gnu/packages/web.scm (esbuild): New variable.
---
gnu/packages/web.scm | 48 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 48 insertions(+)

Toggle diff (82 lines)
diff --git a/gnu/packages/web.scm b/gnu/packages/web.scm
index 1699c92366..7963bff4d1 100644
--- a/gnu/packages/web.scm
+++ b/gnu/packages/web.scm
@@ -45,6 +45,7 @@
;;; Copyright © 2018, 2019, 2020 Björn Höfling <bjoern.hoefling@bjoernhoefling.de>
;;; Copyright © 2020 Paul Garlick <pgarlick@tourbillion-technology.com>
;;; Copyright © 2020 Michael Rohleder <mike@rohleder.de>
+;;; Copyright © 2020 Ryan Prior <rprior@protonmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -84,6 +85,7 @@
#:use-module (gnu packages admin)
#:use-module (gnu packages adns)
#:use-module (gnu packages apr)
+ #:use-module (gnu packages base)
#:use-module (gnu packages boost)
#:use-module (gnu packages check)
#:use-module (gnu packages documentation)
@@ -129,6 +131,7 @@
#:use-module (gnu packages markup)
#:use-module (gnu packages ncurses)
#:use-module (gnu packages networking)
+ #:use-module (gnu packages node)
#:use-module (gnu packages nss)
#:use-module (gnu packages openldap)
#:use-module (gnu packages openstack)
@@ -1346,6 +1349,51 @@ used to validate and fix HTML data.")
(home-page "http://tidy.sourceforge.net/")
(license (license:x11-style "file:///include/tidy.h"))))
+(define-public esbuild
+ (package
+ (name "esbuild")
+ (version "0.7.14")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/evanw/esbuild")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "1y5hqymv2r8r29f8vh8kgncj3wlkg4fzi0zlc7mgyss872ajkc7i"))
+ (modules '((guix build utils)))
+ (snippet
+ '(begin
+ ;; Remove prebuilt binaries
+ (delete-file-recursively "npm")
+ #t))))
+ (build-system go-build-system)
+ (arguments
+ '(#:import-path "github.com/evanw/esbuild/cmd/esbuild"
+ #:unpack-path "github.com/evanw/esbuild"
+ #:phases
+ (modify-phases %standard-phases
+ (replace 'check
+ (lambda* (#:key tests? unpack-path #:allow-other-keys)
+ (if tests?
+ (with-directory-excursion (string-append "src/" unpack-path)
+ (invoke "make" "test-go")))
+ #t)))))
+ (inputs
+ `(("go-golang-org-x-sys" ,go-golang-org-x-sys)))
+ (native-inputs
+ `(("make" ,gnu-make)
+ ("go-github-com-kylelemons-godebug" ,go-github-com-kylelemons-godebug)))
+ (home-page "https://github.com/evanw/esbuild")
+ (synopsis "Bundler and minifier tool for JavaScript and TypeScript")
+ (description
+ "The esbuild tool provides a unified bundler, transpiler and
+minifier. It packages up JavaScript and TypeScript code, along with JSON
+and other data, for distribution on the web.")
+ (license license:expat)))
+
(define-public tinyproxy
(package
(name "tinyproxy")
--
2.17.1
E
E
Efraim Flashner wrote on 12 Oct 2020 08:41
(name . Ryan Prior)(address . rprior@protonmail.com)(address . 43840-done@debbugs.gnu.org)
20201012064118.GE1301@E5400
I removed make from native-inputs and the module imports and pushed the
patches. Thanks!

--
Efraim Flashner <efraim@flashner.co.il> אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted
-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEEoov0DD5VE3JmLRT3Qarn3Mo9g1EFAl+D+o0ACgkQQarn3Mo9
g1EhwhAAvxvJ8bizZojqn921iI377LYT/7Y5Z+JrDw1LX0hri0ztaW7Xi5bE80Uh
+HDUooHs18hpsFUyfw0p7k1ucr7NlzuzBQx8fOZOjgtt9CF6FJXnGXXzsk9MD0n+
eu3I1G9bZuc9A1v8zdovAx234sFKmtC0g8InEviudWV5XpIavn8h3LLkeqkEmrfr
/KgQO6rHUUTzFlEYXGjpmL5lipLp1gMc4LJ9K/dMNZL0UmBL/loPJYKBcW7CyZjw
p2ytYi/xkLBmV7dxCpFo+gWCRTDOeOT5DoKZhGuqb7nUsBZidp2Zt5OSvwyK7Mhy
P7Z0GdQey+0yCRjLmloT/bHlrimLKgA05iMLRGPirUcA0IUsTbvoXHSWvrP6yz1o
qugrksSiDhIx0AyK6IM3JBHJruoS4NxBXHUPVwm6vxZ9md+z08jdWfFRNSWJT6Xf
nkS00XUXLZ5lANvt1yWTCkXHTQVaZkTCbVOHwfngwO+qVlX+kTH6fI5SDF9MDoRO
SiIVS8scXP1dXMivQWOiwuEsNbkMMFUopItyA1d1lenj89c8AH4KtUyXakISKBNP
vN+Te8HxAf+gFVwYxSreedx43kL66H0y3s9fRPNBu2uqYJYn8qhnb4D10Dq64Yoo
TLCydFMeb34L2SLS3KL5QryYFoEuRIKYRRww8fhfczgjTjT6/DQ=
=D/MI
-----END PGP SIGNATURE-----


Closed
?