-
Notifications
You must be signed in to change notification settings - Fork 4
Description
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.jsI'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:
ncc build --minify lib/elm-test.jsgenerates adist/directory with a few files, including a maindist/index.js, and a total size of 692Kb- Prepend the shebang line
#!/usr/bin/env nodeto the filedist/index.jsand make it executable - Add a link to that
dist/index.jsfile in a PATH directory, and call itelm-test-ncc - Call
elm-test-nccfrom anywhere I'd callelm-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.