Open laszlopandy opened 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.
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!
Feedback based on the Sublime plugin:
elm-package.json
under a sublime-build.main
key. It's necessary to be able to compile a given project from another file. It also seems necessary to auto-build arbitrary projects.build/Main.html
instead of index.html
. It's not as pretty but prevents accidentally blowing away a separate compilation.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.
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.
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.
Please open another issue.
@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:
--help
message that HTML, JS and NodeJS outputs are supported.js
or .html
. This will prevent the confusion when using .htm
or something else.--node-js
option which gives an error if the output filename does not end in .js
.Let's talk about this at the meeting later.
@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.
@laszlopandy, if you get a chance, I'd be curious if you think we can bring any ideas over.
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.
@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".
For end users (not creating a library)
$ elm make
(no arguments)elm-package.json
or*.elm
, print:No elm project found, should one be created?
Main.elm
and defaultelm-package.json
*.elm
exists, print:No elm-package.json was found, should one be created? (y/n)
elm-package.json
*.elm
andelm-package.json
exist, print:Error: Please specify a main .elm file
$ elm make Main.elm
elm-package.json
Main.elm
, and all modules it depends onindex.html
$ elm make Main.elm -o elm.js
elm.js
$ elm make Main.elm -o mypage.html
mypage.html
$ elm make Main.elm --node-js -o node-test.js
Elm.worker(Elm.Main);
to the end to start the app in NodeJS$ elm make X.elm --node-js -o node.html
--node-js
is used.$ elm make X.elm -o page.htm
For library creators
TODO