Node-free Development Workflow?

Hello friends, wondering if any of you came up with a nodejs-free Elm development workflow?

Been using create-elm-app for the longest time—simply started with it years ago when I seriously moved into Elm and never really thought of it much. Until the other day I had to install a fresh computer to continue my project and realized the amount of useless things one needs to download to re-create the development flow with hot module replacement.

Just installing nodejs already pulls 200MB of junk on the computer, and then installing anything from npm scrolls pages and pages of more useless stuff that I have no clue what it does.

After a bit of searching I found this caddy hot reloader—based on something called SystemJS (that I learned of today) and Caddy web server.

I’d really really like to get away from anything nodejs and products of its culture.

Is anyone of you using this or something similar already? Can you share your setup?

7 Likes

I would also love to get off of node js (npm specifically), but have not found a way since I want to use elm-live. My current strategy is to use a docker container for development so that I don’t have to install npm on my computer, just in the docker container.

I’ve been doing some work on github/opvasger/develm to build a single binary for test/benchmarks/other-stuff that only relies on the elm binary for the full workflow.

I’m currently stuck on resolving dependencies for package-modules, but I’ll get there eventually :sunny: I’ll announce the release that gets everything right

3 Likes

@opvasger I’m toying with the idea of extracting a webassembly module from the dependency resolver in elm-test-rs and making the wasm module available wrapped in an es module with the following function:

// Returns the `elm.json` needed to run the tests
// with the dependencies solved.
//
// Inputs:
//   projectElmJson: the JSON string containing the `elm.json` file of the project.
//   elmJsonFetcher: a function able to retrieve the `elm.json` of a given package version.
//       elmJsonFetcher(author, package, version) -> string
function solveTestDeps(projectElmJson, elmJsonFetcher)

This could happen relatively soon with the right motivation since creating a wasm module from Rust code is relatively easy, and definitely sooner than the rewrite of elm-pubgrub I need to do at some point. Could this be useful to you?

EDIT: I’ve copied this in an issue in your repo, we can continue discussions there

2 Likes

Lately, I’ve come across this wonderful tool: entr

It enables you to do build a custom tool chain easily, a such:

# Recompile the project when any .elm file changes
find ./src/ -name *.elm | entr -c elm make ./src/*.elm --output ./dist/Main.js

Although rudimentary, if you already have a page reload solution, this tool could enable you to do without a nodejs dev dependency (which is my case).

What do you use for live reload?

Do you use elm-live for anything other than live reload during development?

Am I understanding correctly that you are working on replacing Node.js with Deno?

In my setup, elm-live:

  • watches the source files to trigger compilation
  • Serves static files, including the compiled elm file
  • Inserts the live reload js snippet
  • Proxies a subdirectory of the request path to a different local server for the API

On windows, you can download develm.exe and as long as the elm compiler is installed, you can serve, test, benchmark, and build elm-apps without anything else.

Develm is built with deno, but doesn’t rely on it.

There’s builds for Linux and macos too

1 Like

You also can try pnpm instead of npm

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