create-elm-app
create-elm-app copied to clipboard
Move `elm-scripts` into a separate package (like create-react-app)
Let's say as as user I have created my app with c-e-a and now I want to setup npm run deploy
which runs elm-app build
and then some custom deploy script.
This will work if I have elm-app
installed globally but it means that all my colleagues also have to ensure they are running the same version.
What create-react-app does is install react-scripts
locally into the new project it creates. react-scripts
contains the build
, start
, test
and eject
commands. It then creates a package.json
with this in:
scripts: {
"start": "react-scripts start",
...
}
This also means if they update react-scripts with a bug fix, any user can get that fix by installing the latest react-scripts.
I think we should consider replicating this for create-elm-app as I think it adds a few benefits. What do you think @halfzebra ? :)
Alternatively, c-e-a should add itself as a dependency of the new project and then this works as designed but is less effort. See how I've done it here: https://github.com/jackfranklin/do-you-even-elm/blob/master/package.json
@jackfranklin this is a good idea!
We are trying to avoid introducing a local package.json
and local npm dependencies as long as it is possible to reduce the initial complexity of the setup and keep a default global encapsulated config on user's machine to work with all Elm Apps they have created.
I don't know if that's a reasonable ambition, personally, I prefer to use a single global version of Create Elm App and introduce local npm dependencies in Elm Apps if it's totally necessary.
I have started splitting up the project already, but I there's no consensus on local npm dependencies yet. Let's get some more feedback and try to figure out the best way of pulling this off.
My original motivation for splitting the project is to simplify the development process on the utilities and see what kind of opportunities we will get in the context of extensibility. I would like to enable users to fork elm-app-scripts
to customize the build setup for situations like #134 #174 #175 #176 #178
I think in any realistic project it's pretty likely that you will end up needing a package.json
and some npm dependencies - I was in fact surprised to see that c-e-a didn't do it for you. Normally now I run c-e-a and then npm init
to get going.
Isn’t it possible to just npm i —save-dev create-elm-app && npx elm-app build
to solve the described issue? Why would you need to split anything?