Giter VIP home page Giter VIP logo

Comments (11)

evanw avatar evanw commented on April 28, 2024 3

I will definitely do this at some point. I took a stab at it earlier but couldn't figure out a great way to do it without having to host the binary somewhere myself, which I'd like to avoid if possible. My current plan is to figure out some way of having the install script invoke npm recursively to install the platform specific package. I'm not sure how straightforward that is. Please let me know if there are existing examples of packages that do this well.

from esbuild.

evanw avatar evanw commented on April 28, 2024 2

I was hoping that optional dependencies would work since they seem like the closest thing to what I want. However, they didn't end up working.

Optional dependencies sometimes randomly cause npm to install the binary in node_modules/esbuild/node_modules/esbuild-darwin-64 instead of node_modules/esbuild-darwin-64. This means npx esbuild no longer works because the binary lives in node_modules/esbuild/node_modules/.bin/esbuild instead of node_modules/.bin/esbuild. You can still do npm explore esbuild -- npx esbuild to run it but I don't want to make people do that.

I'll have to figure something else out.

from esbuild.

ravener avatar ravener commented on April 28, 2024 1

Right i forgot npm had a way to publish prebuilt binaries. I know that https://github.com/Automattic/node-canvas does this to provide prebuilt binaries for the C++ code, it seems like they use a "binary" field in their package.json

from esbuild.

ravener avatar ravener commented on April 28, 2024

What do you mean by "unique npm package"? There is already binary npm packages available for esbuild if you mean that.

from esbuild.

marcelaraujo avatar marcelaraujo commented on April 28, 2024

I mean one package to be cross-platform, so I can install it in my project and I dont need worry about OS

from esbuild.

ravener avatar ravener commented on April 28, 2024

Binaries aren't cross-platform so not really, unless the owner makes a package that packages all binaries and use a script to execute one conditionally depending on the platform but it isn't really a good idea, makes package bigger and have to depend on a script to startup.

from esbuild.

marcelaraujo avatar marcelaraujo commented on April 28, 2024

@pollen5 I know that binaries are not cross-platform but what I suggested is to have a NPM package which identifies and install the right binary due the platform. I don't know if it is only possible with node-gyp.

from esbuild.

marcelaraujo avatar marcelaraujo commented on April 28, 2024

@pollen5 This binary property is related to node-pre-gyp package

from esbuild.

Akiyamka avatar Akiyamka commented on April 28, 2024

Great idea, current format with different packages add a lot of pain to open source projects that want to use that library.

from esbuild.

benmerckx avatar benmerckx commented on April 28, 2024

You might publish a single package which lists every platform as an optional dependency. Npm/yarn will figure out which one to install based on the "os" field of the package.json. Example of that being used by the google-closure-compiler npm package:
https://github.com/google/closure-compiler-npm/blob/8a8c255015cf7bc46846449f3e706bc3c596f72d/packages/google-closure-compiler/package.json#L46

from esbuild.

macarie avatar macarie commented on April 28, 2024

Wouldn't it be possible to publish a package with the Go source files, and an install/postinstall script (that should be just make)?

Yeah, the user should have Go and make already installed... but it's not that hard to install them, and I think that's kinda the same thing that node-fibers does πŸ€”

from esbuild.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.