Escaping from npm

Hi Community, I’m new in Elm and I’m just starting learning and so far it’s so good, I like all the idea behind of the language one of those is about create a better package ecosystem focus in quality and security.

I have been doing we applications for over 10 years and I really don’t like the way frontend development is going especially npm and the black hole that is node_modules, I want to try to stay away from it.

My concrete question is, are there alternatives to elm-live, elm-analyse or https://github.com/rtfeldman/node-test-runner that don’t depend on node/node_modules package.json and all that stuff?

Thank you

5 Likes

Hi Disptopico.
You don’t want anything of node on your computer ? or just into your elm projet ?
If it’s only into your elm projet, you just need to use npx or install elm-live and elm-test globaly with npm -g.

yes, I don’t want have node just in the elm project but at the time share de dependencies with other forks to have the same dev tools in a easy way to install those

To work completely without node,

  • elm-test: there is now the option to use https://github.com/mpizenberg/elm-test-rs instead
  • elm-live: using elm reactor is the closest thing available
  • elm-analyse: afaik there is no existing alternative that does not require node
3 Likes

… though now that I think of it, elm-test-rs may actually require node to execute the compiled tests. So actually you may not be able to run tests without node. (There used to be an HTML test runner, but it was discontinued in Elm 0.19.)

elm-test-rs seems pretty good options, thank you!

You can use elm-tooling (Announcing elm-tooling CLI) to install and manage the non-npm dependencies, though there are indeed few of them.

I would also suggest elm-review instead of Elm Analyze which is not being developed anymore. Though both still use npm.

2 Likes

elm-tooling itself is an NPM package though?

You can’t escape node itself but you can escape the npm and node modules thing using yarn with plug and play mode

There is also nix which can package tools and applications for multiple languages including elm, I use it to install elm, elm-format and elm-test on per project basis.
Example at

Edit:added link to elm2nix

2 Likes

thanks, looks as a reasonable alternative to install fast all those tools at ones

I’m experimenting with a Deno-based single self-contained binary that features benchmarking, testing, build+optimizations, code-gen, typescript-typing, etc.

It only relies on the elm-binary itself.

5 Likes

I wrote https://deno.land/x/deno_elm_compiler@0.1.0 for compiling Elm with Deno a while back. Excited to see @opvasger 's work too!

1 Like

work in progress available here. It’s very much not done :sunny:

1 Like

As an alternative to npm you could also consider pnpm

2 Likes

I discovered this project a while ago and really liked it: GitHub - cloud8421/elm.mk: Makefile based toolchain for Elm projects. Inspired by Erlang.mk

its only dependencies to npm are uglifyjs and elm-test - you can probably replace the latter with elm-test-rs.

Not sure about uglifyjs - you can replace it with terserjs (?) or the google-closure-compiler or…

The project ist a bit dated, but should get you started…

2 Likes

Very interested in following this too :slight_smile:

We have an issue in elm-test-rs to track progress on possible replacement of the Node runtime dependency to a Deno runtime dependency Remove dependency on Node · Issue #37 · mpizenberg/elm-test-rs · GitHub.

I haven’t spent time on it but what it would take would be rewriting the supervisor distributing the work and gathering the result in a version using Deno APIs instead of Node ones. The main challenge probably is reproducing in Deno the main + worker + worker messages scheme based on Node workers and worker messages API that we are using.

3 Likes

all those are really promising and interesting projects, you have given me a lot of ideas and projects to evaluate, Thank you!, now I see a light at the end of the tunnel away from node_modules :smiley:

3 Likes

be aware, that most people can’t use elm reactor in the long run, as it doesn’t work with certain context

if your using the elm-language-server, you’ll get something similar to elm-analyse, but build in.

2 Likes

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.