elm-lang / elm-make

A build tool for Elm projects
BSD 3-Clause "New" or "Revised" License
175 stars 45 forks source link

Friendlier elm-make interface for beginners #23

Open laszlopandy opened 9 years ago

laszlopandy commented 9 years ago

For end users (not creating a library)

  1. [ ] $ elm make (no arguments)
    • [ ] if no elm-package.json or *.elm, print: No elm project found, should one be created?
      • create hello world Main.elm and default elm-package.json
    • [ ] if *.elm exists, print: No elm-package.json was found, should one be created? (y/n)
      • create elm-package.json
    • [ ] if *.elm and elm-package.json exist, print: Error: Please specify a main .elm file
  2. [x] $ elm make Main.elm
    • install dependencies found in elm-package.json
    • compile Main.elm, and all modules it depends on
    • write concatenated Html output to index.html
  3. [x] $ elm make Main.elm -o elm.js
    • write concatenated output to elm.js
  4. [x] $ elm make Main.elm -o mypage.html
    • wrap JS output in HTML and write to mypage.html
  5. [ ] $ elm make Main.elm --node-js -o node-test.js
    • writes JS output and adds Elm.worker(Elm.Main); to the end to start the app in NodeJS
  6. [ ] $ elm make X.elm --node-js -o node.html
    • Error: output file must end in .js when --node-js is used.
  7. [x] $ elm make X.elm -o page.htm
    • Error: output file must end in either .js or .html

      For library creators

TODO

laszlopandy commented 9 years ago

The above is my suggestion for how elm make can be easier for beginners. Please add your comments, especially about the part for library creators (which I have no experience with). Once there is agreement, we can start the implementation.

evancz commented 8 years ago

I am going to try to do this in the next couple days. I like it. I think we can combine the --node-js and --js flags into one thing, but otherwise I think this is way nicer!

texastoland commented 8 years ago

Feedback based on the Sublime plugin:

evancz commented 8 years ago

I can't understand either of these points. Can you move this to its own issue and describe your scenario more completely? I don't know how sublime works, I don't know what you are asking for or how it relates to any of the very concrete suggestions made in this thread.

texastoland commented 8 years ago

The latter point is more concrete:

write concatenated output to index.html

The default we use is build/Main.html. If you then run elm make Counter.elm it wouldn't blow away your previous output.

The former point might belong in a separate thread. It's difficult for us to infer what file to build. It seems like a main key in elm-package.json would not only benefit tooling but concepts like an auto-building gallery repo. I brought it up because it's relevant to the proposed interface.

texastoland commented 8 years ago

It seems like a main key in elm-package.json

I.e. elm make would check for main in elm-package.json and elm make Counter.elm would override that key.

evancz commented 8 years ago

Please open another issue.

laszlopandy commented 8 years ago

@evancz I've changed my mind regarding the --js and --html. I think having --html, --js and --node-js is too much, especially since they cannot be used at the same time.

Instead I think we should:

Let's talk about this at the meeting later.

evancz commented 8 years ago

@seliopou is more used to being able to get everything compiling without something like elm-package.json and suggested we look at OCaml's Oasis for inspiration on how to support that usage in a nice way.

evancz commented 8 years ago

@laszlopandy, if you get a chance, I'd be curious if you think we can bring any ideas over.

laszlopandy commented 8 years ago

That link makes it look like a cabal-type thing. Is there any info about specifically what the good parts are?

On Thursday, September 24, 2015, Evan Czaplicki notifications@github.com wrote:

@laszlopandy https://github.com/laszlopandy, if you get a chance, I'd be curious if you think we can bring any ideas over.

— Reply to this email directly or view it on GitHub https://github.com/elm-lang/elm-make/issues/23#issuecomment-143057347.

jpierson commented 6 years ago

@laszlopandy I noticed under For Library Authors there were no suggestions but I believe I have one from my own experience today. It looks like if no modules are specified for exposed-modules that elm-make will not build anything and just reports "Success! Compiled 0 modules.". I would suggest that a simple hint should be displayed at this point that says something along the lines of "If you want to make a library you need to list one or more modules as exposed-modules in elm-package.json".