gleam-lang / cookbook

👩🏾‍🍳 How to do many things in Gleam
131 stars 4 forks source link

Running in watch mode #18

Closed poelstra closed 1 month ago

poelstra commented 1 month ago

Running the tests or the app in watch mode is often convenient, and there's watchexec to help with this, but it has issues that sometimes it seems to get stuck in e.g. the compilation phase.

I'm using two helpers:

gr (Gleam Run)

#!/bin/sh
watchexec --restart --wrap-process=session gleam run "$@"

gt (Gleam Test)

#!/bin/sh
watchexec --on-busy-update=queue --wrap-process=session gleam test

I don't remember exactly why I used on-busy-update, could be to get around broken cache issues when using this with lustre/dev.

Perhaps someone has a simpler/better approach though!

lpil commented 1 month ago

Hello! Thank you, but here the goal is to document how to do things in Gleam code, so it wouldn't be the place to document CLI programs, even if one could use them with Gleam.