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

Feat request: support 0-dependency node js executables #88

Open
mpizenberg opened this issue Mar 29, 2022 · 0 comments
Open

Feat request: support 0-dependency node js executables #88

mpizenberg opened this issue Mar 29, 2022 · 0 comments

Comments

@mpizenberg
Copy link

Currently elm-tooling-cli is awesome to install pre-built executables but cannot be used to install other elm tools such as elm-test or elm-review because they require npm + dependencies. But there is at least one tool called vercel/ncc (and maybe others) able to take an npm executable and to compile it down into a single JS file or a few files (like a main + assets + workers) with all its dependencies brought in such that you can execute the main index.js file with:

node path/to/index.js

I've mentioned this already in the past, but I'm opening an issue for real now since elm-test is about to become free of the elm-json dependency, meaning it could be added solo in a elm-tooling.json and work even if elm-json is not there.

Concretely, the testing I've done is the following:

  1. ncc build --minify lib/elm-test.js generates a dist/ directory with a few files, including a main dist/index.js, and a total size of 692Kb
  2. Prepend the shebang line #!/usr/bin/env node to the file dist/index.js and make it executable
  3. Add a link to that dist/index.js file in a PATH directory, and call it elm-test-ncc
  4. Call elm-test-ncc from anywhere I'd call elm-test

The strategy above would only work for linux and mac, but I'm confident we could make something equivalent in windows. When compressed, that dist/ directory is 203kb. The small size of the compressed archive also means that installing elm-test via elm-tooling would be super fast.

Using ncc would not be required to fit the requirements, just being 0 dependency so that a simple node call is enough to execute the program.

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

No branches or pull requests

1 participant