automerge / automerge-repo

MIT License
458 stars 51 forks source link

Add @automerge/create-vite-app #313

Closed alexjg closed 6 months ago

alexjg commented 6 months ago

When getting people up and running with automerge it's painful to go through the whole ceremony of setting up a vite app, installing automerge dependencies, and setting up the react hooks just to demonstrate simple functionality. This patch adds an @automerge/create-vite-app which allows you to run npm create @automerge/vite-app to quickly spin up a Vite + React + Typescript project with a simple counter app inside it.

Most of this is just template code in packages/create-vite-app/template. The code which actually sets up the new project is in packages/create-vite-app/index.ts.

If you want to have a play with this the easiest way I've found to test things is to run npm pack in the create-vite-app package, then npm install <the tarball we just created> in a new project and finally ./node_modules/@automerge/create-vite-app/dist/index.js to actually run the helper.

pvh commented 6 months ago

Nice! Noticed a few small things -- will leave notes on the PR.