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

Upgrade to Node V20 and use Vite on the Client #29

Closed
wants to merge 10 commits into from

Conversation

psmithshine
Copy link
Collaborator

@psmithshine psmithshine commented Jul 4, 2024

Upgrade client, server, shared, and integration (sorta) packages and support and run Node v20. Local development and build is faster 🚀 and the overall app's runtime (Node) is more secure - no longer deprecated!! 🔒

The following changelog documents major things done to these packages to make the entire app run in Node v20 context.

Changelog

Frontend - Lets get Vite ⚡️
Now using ViteJS build tool as a replacement of react-scripts for compiling and running the app locally, as well as building it for production. The react team doesn't even recommend using their own react-scripts tool anymore, and the nerd community much prefer Vite over react-scripts - so it was time! You will find that Vite is significantly quicker to run localhost and to build the app for production in the pipeline.

Changes:

index.html uses the new Vite-friendly syntax, like ridding the %PUBLIC_URL% stuff for project-relative paths
adding a vite.config.ts, for a basic Vite build configuration to work with our React app
package.json had the following updates:
-- script for deploy, so that we can very quickly test just our frontend changes in the deployed Dev environment - takes less than 20seconds to see them live.
-- type: module required for Vite to function corectly.
-- jsonwebtoken wasnt working with Node v20, so jose was employed instead
tsconfig.json had some of the most important changes, to deal with Node v20 updates + Vite.
-- a big part of these changes were supporting Vite's HMR (Hot Module Reloading) features, which require "ESNext" Module code (some latest ECMAScript standard, but not pegged to a specific version like ES2019, ES2020)
-- another part of these changes + effort had to do with being able to deal with the Shared/ folder's Typescript compiled code -> requiring shared's tsconfig to also have updated compilerOptions -> specifically having module and target be ES6.
Backend - Node v20 🔥
Many of Server's packages broke when updating to Node v20 runtime, so bulk of these changes had to do with updating the packages to their latest versions. Most importantly were upgrading Apollo + GraphQL-supporting packages to their latest versions, which is absolutely great considering we want the server to be as updated + secure as possible. Other packages such as concurrently and tsx are there to support running the server locally in the Node v20 context. Finally, the tsconfig update essentially allows for the Server to read the new module syntax which shared/ directory compiles.

- update tsconfig target and packages in shared
- update packages in server
- upgrade server packages necessary to support Node v20, and remove some deprecated packages
- adopt new Apollo Server API from Apollo v4.9 (jumped two major versions), for much of the setup of the local standalone server
- use latest tsconfig for Node v20
- use more sensical Datasources sertup (to also complement newer Apollo API)
👍 Node v20 Upgrades 👍
- update package versions to support latest node
- use same GraphQL codegen tooling as Server for consistent code generation across BE/FE, + with codegen.yaml file
⚡️ Vite Upgrades ⚡️
- new Vite build + dev server tool - the speed!! 🚀
- supporting Vite packages, vite config, index.html setup, index.html placement, tsconfig setup, start and build scripts updates
- remove react-scripts and any react scripts setup 🤮
… the correct server EP, so we're getting error on requesting from server
@psmithshine psmithshine closed this Jul 4, 2024
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.

1 participant