Skip to content
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

Publish @monokle/cli as binary on brew #10

Closed
WitoDelnat opened this issue Sep 28, 2022 · 3 comments
Closed

Publish @monokle/cli as binary on brew #10

WitoDelnat opened this issue Sep 28, 2022 · 3 comments

Comments

@WitoDelnat
Copy link
Collaborator

Ideally our CLI is available as a single binary and we can download it from brew. Most DevOps people are not in the JavaScript world so we can't expect them to have NodeJs installed.

@WitoDelnat
Copy link
Collaborator Author

WitoDelnat commented Oct 20, 2022

So the most commonly used way to do this is through vercel/pkg. Unfortunately this does not have ESM support. I've tried creating a CJS bundle with Rollup but there are things that keep going wrong.

As an alternative, I've started exploring Caxa which does have support for ESM. Initial test seems to work. The author mentions some limitations and imo his solution is a bit dirty and hacky - however it works and maybe for now we should be happy with that.

I'd suggest rolling with this until pkg version 6.0 is released which will support ESM.

Why is it hacky? It basically copies your Node to node_modules/.bin/node and zips it afterwards. Then the 'executable' simply unwraps it to a temporary directory and executes it as if it as if it was just Node natively. It's dirty because it does not clean up this tmp directory for "caching" which basically pollutes a users file system.

@olensmar
Copy link
Member

can't you define a dependency on nodejs in your brew installer which then gets automatically installed?

@WitoDelnat
Copy link
Collaborator Author

You might start messing with the version of NodeJs that the user has installed and that will give very awkward behaviour. I think Brew should have a cleanup call when you uninstall or update and I found the directory of the temporary file. For now it's fine but I might look into writing a small cleanup script. Not for now in any case!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants