feat(create-mud): add create-mud package#336
Conversation
|
I think |
yarn create create-app create-mud
3aa36ba to
23acaa4
Compare
|
This is ready to go! Didn't need much to bring it up to speed. I made sure that the resulting npm package will have the necessary I also updated MUD dependencies in each template and made sure each works by first building |
alvrs
left a comment
There was a problem hiding this comment.
Looks good! Just had a few minor questions. For a follow up - how hard would it be to make the templates "modular" with the create-create-app setup? Eg. the contracts setup is probably the same for different client templates, so we could just define it once and then copy it into the generated project. Or maybe in the future we could have different contract templates that can be mixed-and-matched with different client templates.
| @@ -0,0 +1,19 @@ | |||
| Copyright (c) 2023 Lattice <mud@lattice.xyz> | |||
There was a problem hiding this comment.
Do we need a separate licence file in the package? If so, should we align it with the global one (MIT): https://github.com/latticexyz/mud/blob/main/LICENSE ?
There was a problem hiding this comment.
Oops, I think this one was auto created by create-create-app
| "version": "0.0.0", | ||
| "author": "Lattice <mud@lattice.xyz>", | ||
| "scripts": { | ||
| "postinstall": "cd node_modules/create-create-app && npm run build", |
There was a problem hiding this comment.
since I'm using my own (unpublished) fork, this makes sure the create-create-app is built before using
| "scripts": { | ||
| "postinstall": "cd node_modules/create-create-app && npm run build", | ||
| "build": "tsup src/cli.ts --minify", | ||
| "clean": "shx rm -rf lib", |
There was a problem hiding this comment.
uhh I like this, maybe we should use shx in all our packages. I don't see shx in the dependencies though, where does it come from?
There was a problem hiding this comment.
this was also included by create-create-app, looks like a transitive dependency (but prob should be a real dev dep): https://github.com/uetchy/create-create-app/blob/master/package.json#L53
|
Oh also to @dk1a comment, should we move |
|
Just thought of two more things: we need to add |
Moving Looks like because our default in |
yep, mud cli has a bunch of hardocded paths (
I address some of that in #309. That may be best left for v2. For now I had thought you'd just add |
Done! I think in the future, we should probably use a top-level Edit: opened an issue for it here: #389 |
|
merge queue stalled, I think #391 should fix it |

Generated with create-create-app (using my fork to fix some issues).
Example using

npm create mud [project name]:(Just uses a
templateoption for now, but we can add more things as needed)Main benefit for me is that the template code is now colocated with the rest of MUD, so we can update references/dependencies together in single commits/PRs.
I'd like to eventually set up some CI that can create + build projects from this new CLI (to make sure everything is happy) but will save that for a follow up.
One thing we may run into is that publishing to npm may ignore/not include the
.gitignorefiles as part of the template output, so we may need to try a few things:.gitignoretogitignoreinside templates, but we'll want to couple this with adding all the previous.gitignoreentries to thecreate-mud-level package so that we don't accidentally check innode_modules, etc..npmignoreworkarounds