-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add documentation and flow for building without NPM #918
Comments
Thanks! |
You can download the precompiled binaries from npm without needing npm installed if you'd like. Here is an example of how to do this:
You can also get at them through any of the various npm CDNs if you prefer to not call
|
Ok great, thanks. |
I tried something similar before JSDelivr. Why didn't that work? https://www.jsdelivr.com/package/npm/esbuild?path=bin $ curl -O https://cdn.jsdelivr.net/npm/[email protected]/bin/esbuild That is just a short file that tells you that you don't have the binary installed. #!/usr/bin/env node
throw new Error(`esbuild: Failed to install correctly
Make sure you don't have "ignore-scripts" set to true. You can check this with...
...
`) |
Oh I see you specified Found it here as another package https://www.jsdelivr.com/package/npm/esbuild-darwin-64?path=bin I wasn't aware that binaries are distributed as separated packages on NPM. |
The full list of package names for available platform architectures is here: Lines 277 to 286 in 15b36c5
|
Perfect. Then now I have a way do this on Linux and macOS. A short page in |
Alternative installation methods are now documented here: https://esbuild.github.io/getting-started/#other-ways-to-install. Closing. |
👋 @MichaelCurrin, if it makes it any easier for your workflow, you can also install esbuild using go binaries: curl -sf https://gobinaries.com/evanw/esbuild/cmd/esbuild | sh I am not sure if @evanw prefers this installation method, but it certainly is much faster than NPM/yarn install. |
I will not be personally recommending this installation workflow because I don't know why I should trust gobinaries.com with the security of my computer, and so I shouldn't expect others to either. It's great if it works for you but I don't feel good putting it in esbuild's documentation since it's not an official Go project. |
Thanks @evanw - the instructions look great. |
Thanks @osdevisnot - I hadn't heard of that project. Fascinating ideas. From GitHub https://github.com/tj/gobinaries
But good to hear that point around security from @evanw . |
I am interested in using this tool as a binary that can be downloaded, without having Node installed.
This may not be useful for that many developers. Since if you are running ESBuild on JS scripts, you are probably running ESBuild already. But... if you are using Deno (https://deno.land) as a replacement for Node, it is nice to use ESBuild as a minifier tool without having to install Node at all.
Also, if Deno does end up adding a built-in minifier, this issue may not matter as much.
Using Node
Some NPM flows:
esbuild
as a dev dependency and run it as part ofnpm run
to bundle and minify scripts.npx
, as suggested on a Deno issue thread.Maybe it is worth documenting these Node flows above as multiple ways to install and run ESBuild.
Using Go
Here is a solution without Node installed.
Maybe it is worth documenting that somewhere.
However, the Go flow above requires Go to be installed. And requires one to have a Go 1.16 (actually only enforced with
Makefile
but not enforced if usinggo get
Without Node or Go
I am thinking about how to get a copy of ESBuild on my machine or on GH Actions CI without Node or Go installed.
The solution I think is to prepare a compiled binary and make it ready for download on GitHub Releases under "Assets", or a "Download" page on the website. This could be generated automatically on master when a Tag/Release is generated.
If you use an Action like Go Releaser, this is even easier. It will even build multiple outputs across macOS, Windows, etc. so someone can download a copy suitable for their OS.
https://michaelcurrin.github.io/code-cookbook/recipes/ci-cd/github-actions/workflows/go/go-releaser.html
Example assets: https://github.com/trashhalo/imgcat/releases/tag/v1.2.0
The text was updated successfully, but these errors were encountered: