empiricaly / empirica

Open source project to tackle the problem of long development cycles required to produce software to conduct multi-participant and real-time human experiments online.
https://empirica.ly/
Apache License 2.0
44 stars 8 forks source link

feat: update react template #513

Closed aridyckovsky closed 5 months ago

aridyckovsky commented 5 months ago

This PR upgrades the template source for creating React clients that use Vite v5 instead of v2. The main updates are to the package.json and vite.config.js files, reflecting package dependencies and configuration updates. Note that Common JS is no longer the preferred build for Vite, so "type": "module" is included in the package.json file.

I have tested these changes on a newly created experiment by using equivalent package.json files, but I'm not sure how to test the empirica create command to make sure these changes work. The development guide doesn't seem to address this, so please let me know what steps I should take for testing. Happy to update the development guide to reflect these steps as well.

changeset-bot[bot] commented 5 months ago

🦋 Changeset detected

Latest commit: 196f99010531c317583d03499726e2b5792aeb1d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package | Name | Type | | -------------- | ----- | | @empirica/core | Patch |

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

npaton commented 5 months ago

Thank you @aridyckovsky! This looks good to me.

The template gets embedded into the empirica Go-based binary.

If you have Go setup, you can build with:

go generate ./internal/templates/...
go build -o empirica ./cmds/empirica

You can then test with ./empirica create.

If you have the time to make some improvements to the dev doc, that's of course welcome. Thank you.

Also, if you wouldn't mind, please add a changeset to this PR, to help with the change log. See https://github.com/empiricaly/empirica/blob/main/.changeset/README.md for details.

aridyckovsky commented 5 months ago

Added a few other updates @npaton to make sure Volta configs were the same node and npm versions across the active templates (it looks like the svelte one hasn't been used for a while). I also updated the development guide with the basics for working on react and callbacks. The export template looks like a new addition for testing, but I wasn't sure how to discuss it in the guide so left it out. Lastly, I added a changeset for a patch. Please let me know if anything else is needed before merging!

aridyckovsky commented 5 months ago

Also when running go generate I needed to have go-bindata installed, but it was not in the go.mod file. In the docs/DEVELOPMENT.md, I suggest using the Homebrew installation on MacOS or using go get, but the latter would make a change to the go.mod and go.sum files. If there's more appropriate advice for using go generate, please let me know and I can make the change in the guide.

npaton commented 5 months ago

This looks ready to merge. Development guide changes can happen in another PR.

The export and svelte dirs can be removed. Export was recently reimplemented in Go and the svelte template never landed.

We should remove the dependency on go-bindata, Go added an embed directive that should do the same job without a dependency. Until that happens, we can maybe just link here: https://github.com/kevinburke/go-bindata?tab=readme-ov-file#installation