Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build(em): use vite for dev & build #1933

Merged
merged 8 commits into from
Jun 7, 2022
Merged

build(em): use vite for dev & build #1933

merged 8 commits into from
Jun 7, 2022

Conversation

eventualbuddha
Copy link
Collaborator

@eventualbuddha eventualbuddha commented Jun 6, 2022

Overview

Refs #1314

Replaces react-scripts with vite when running and building Election Manager. I originally was going to leave react-scripts alongside vite, but making everything work with @zip.js/zip.js under react-scripts was not going to be straightforward.

This took more effort than the equivalent changes for the other frontends. In particular, I had to replace zip-stream with zip.js. I tested it a fair amount, but it's possible there's some difference I haven't accounted for. The reason for the change is that zip-stream uses readable-streams, which is a NPM-land implementation of streams from NodeJS. The readable-streams package had a circular dependency that rollup chokes on: nodejs/readable-stream#348. While it seems to be fixed in the latest version, the dependency that uses it is not compatible with the latest version so I cannot simply replace all readable-stream copies with the newest one. Switching the ZIP library turned out to be simpler.

Demo Video or Screenshot

n/a

Testing Plan

Lots of manual testing of various EM features in Chrome and kiosk-browser. Ensured that ballot packages could be exported properly and validated the contents.

Checklist

  • I have added logging where appropriate to any new user actions, system updates such as file reads or storage writes, or errors introduced.
  • I have added JSDoc comments to any newly introduced exports
  • I have added a screenshot and/or video to this PR to demo the change
  • I have added the "user_facing_change" label to this PR to automate an announcement in #machine-product-updates

@eventualbuddha eventualbuddha requested a review from a team as a code owner June 6, 2022 22:04
@eventualbuddha eventualbuddha requested review from taravancil and removed request for a team June 6, 2022 22:04
@eventualbuddha eventualbuddha changed the title build(em): add vite as an option build(em): use vite for dev & build Jun 6, 2022
Base automatically changed from build/all/tsconfig-updates to main June 7, 2022 15:12
@eventualbuddha eventualbuddha merged commit b4fa048 into main Jun 7, 2022
@eventualbuddha eventualbuddha deleted the build/em/vite branch June 7, 2022 16:54
Adds `vite` alongside `react-scripts` as a method for running and building Election Manager. To use it, run `pnpm start:vite` or `pnpm build:vite`. These will soon replace the `react-scripts`  method.

This took more effort than the equivalent changes for the other frontends. In particular, I had to replace zip-stream with zip.js. I tested it a fair amount, but it's possible there's some difference I haven't accounted for. The reason for the change is that zip-stream uses `readable-streams`, which is a NPM-land implementation of streams from NodeJS. The `readable-streams` package had a circular dependency that rollup chokes on: nodejs/readable-stream#348. While it seems to be fixed in the latest version, the dependency that uses it is not compatible with the latest version so I cannot simply replace all `readable-stream` copies with the newest one. Switching the ZIP library turned out to be simpler.
The equivalent to this with `vite` is `env.d.ts`.
Extracts the `jest` and `babel` configs from `package.json` to their own files and configures Jest to work with packages that have ES modules, specifically `@zip.js/zip.js`.
eventualbuddha added a commit that referenced this pull request Jun 13, 2022
Should have been done in #1933.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants