choonkeat / elm-webapp

A setup for writing http based, client-server app in elm, inspired wholly by lamdera.com
https://package.elm-lang.org/packages/choonkeat/elm-webapp/latest
MIT License
57 stars 7 forks source link

Generating crud operations fails #11

Closed Beny406 closed 8 months ago

Beny406 commented 11 months ago

Hi,

unfortunatelly generating crud operations fails for me

image

choonkeat commented 11 months ago

Looks like the instructions were bad. The idea is that you can crud <TypeName> for one type then repeat for new types

$ npx elm-webapp@latest crud Article hello-webapp
Writing hello-webapp/Makefile ...
Writing hello-webapp/index.js ...
Writing hello-webapp/node.js ...
Writing hello-webapp/lambda.js ...
Writing hello-webapp/src/Client.elm ...
Writing hello-webapp/src/Protocol.elm ...
Writing hello-webapp/src/Server.elm ...
Writing hello-webapp/scripts/wait-for-changes.js ...
Writing hello-webapp/src/Extra/Codec.elm ...
Writing hello-webapp/src/Extra/Http.elm ...
creating hello-webapp/src/Client/ArticleUI.elm ...
patching hello-webapp/src/Client.elm ...
patching hello-webapp/src/Client.elm ...
patching hello-webapp/src/Client.elm ...
patching hello-webapp/src/Client.elm ...
patching hello-webapp/src/Client.elm ...
patching hello-webapp/src/Client.elm ...
patching hello-webapp/src/Client.elm ...
patching hello-webapp/src/Client.elm ...
patching hello-webapp/src/Client.elm ...
patching hello-webapp/src/Client.elm ...
creating hello-webapp/src/Protocol/Article.elm ...
patching hello-webapp/src/Protocol.elm ...
patching hello-webapp/src/Protocol.elm ...
patching hello-webapp/src/Protocol.elm ...
patching hello-webapp/src/Protocol.elm ...
patching hello-webapp/src/Protocol.elm ...
patching hello-webapp/src/Protocol.elm ...
creating hello-webapp/src/Server/ArticleAPI.elm ...
patching hello-webapp/src/Server.elm ...
patching hello-webapp/src/Server.elm ...
patching hello-webapp/src/Server.elm ...
patching hello-webapp/src/Server.elm ...

  Done! Now execute:

      1. cd hello-webapp
      2. make install
      3. make

Then you can add more

$ npx elm-webapp@latest crud Comment hello-webapp
creating hello-webapp/src/Client/CommentUI.elm ...
patching hello-webapp/src/Client.elm ...
patching hello-webapp/src/Client.elm ...
patching hello-webapp/src/Client.elm ...
patching hello-webapp/src/Client.elm ...
patching hello-webapp/src/Client.elm ...
patching hello-webapp/src/Client.elm ...
patching hello-webapp/src/Client.elm ...
patching hello-webapp/src/Client.elm ...
patching hello-webapp/src/Client.elm ...
patching hello-webapp/src/Client.elm ...
creating hello-webapp/src/Protocol/Comment.elm ...
patching hello-webapp/src/Protocol.elm ...
patching hello-webapp/src/Protocol.elm ...
patching hello-webapp/src/Protocol.elm ...
patching hello-webapp/src/Protocol.elm ...
patching hello-webapp/src/Protocol.elm ...
patching hello-webapp/src/Protocol.elm ...
creating hello-webapp/src/Server/CommentAPI.elm ...
patching hello-webapp/src/Server.elm ...
patching hello-webapp/src/Server.elm ...
patching hello-webapp/src/Server.elm ...
patching hello-webapp/src/Server.elm ...

I should improve the phrasing of

    This generates a different "src/Server.elm" that comes with "CRUD"
    operations with an in-memory server state: Data is preserved on the
    Server only while the Server process is running.

        crud <TypeName>         patch the <target_directory> with the ability
                                to list, create, edit, and destroy "TypeName"
                                records
Beny406 commented 11 months ago

Oh, ok. I did try to run the crud command on its own but for some reason Protocol.Auto was not generated in that case. Thats why I thought it needs to be run with combination of some other command. It works now though :man_shrugging: Thx.