Closed astrale-sharp closed 2 years ago
Oops sorry, the issue was closed by commit without comment
There were several issues causing the problems
scripts/wait-for-changes.js
missing from the packaged npm bundle (fixed in 314950aaef8da1c57e2732427092a8d457dcfbb1)There was the problem of "infinite loop" after we make a change to the code. This was because a crucial file scripts/wait-for-changes.js missing from the packaged npm bundle
Then again scripts/wait-for-changes.js
has the same recursive
problem on Linux 😮💨
https://github.com/choonkeat/elm-webapp/blob/8703775296bbd1908dc16b5309d39d83adb0c2b3/templates/crud/scripts/wait-for-changes.js#L5
trying hard to avoid too much dependencies ...
Thanks so much, it works better now!
Although the problem of "infinite loop" is still present on linux! If your elm code wont compile (you can check with elm make src/Server.elm
and elm make src/Client.elm
then running make
will indeed go into infinite loop again.
Yes it's happening on Linux because scripts/wait-for-changes.js
is probably spouting errors due to https://github.com/choonkeat/elm-webapp/issues/8#issuecomment-979954826
But the fix won't be as easy as https://github.com/choonkeat/elm-auto-encoder-decoder/commit/a94f289123373c7c14be9a6f5d9502728ade23fa since we do need a recursive file watcher here ...
Switching from fs.watch
to something like chokidar or gaze is an option, but means burdening apps with more js dependencies...
Another option might be to warn linux users and have them ensure their files compiles (check by running elm make src/*.elm
) and then maybe tweak the make file so it stops when encountering an error? (if that is possible)
actually if this only affects Linux, we could try using inotifywait
(from apt-get install inotify-tools
, apk add inotify-tools
, or ...)
you can try editing your Makefile
to replace
node scripts/wait-for-changes.js .
with
inotifywait -r -e close_write -e move -e create -e delete .
(take note of the trailing .
)
if it works, I'll try to work the instructions or do a cli swap into the installation process
I'm messing around with https://package.elm-lang.org/packages/choonkeat/elm-webapp/latest and I'm trying to expand the types in Protocol.elm, But im unsure how to edit the Protocol/Auto.elm or if I should since it has been generated automatically (but by what?)
When i edit for instance this :
To this :
running
make
fails (expectedly) but it runs in a loop and if i correct back the code it still wont compile ! (I started from start again but i think supressing elm-stuff might do the trick.what's the right way to re-autogenerate the code so you can safely mess with the types? Thank you !