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 Nuxt 3 #34

Merged
merged 63 commits into from
Sep 12, 2024
Merged

🏗️ Upgrade to Nuxt 3 #34

merged 63 commits into from
Sep 12, 2024

Conversation

rudokemper
Copy link
Member

@rudokemper rudokemper commented Sep 9, 2024

Closes #33.

Oooook, this is a big one. The big picture is an upgrade from Nuxt 2 to 3 (and by proxy an upgrade from Vue 2 to 3).

As the migration documents note, "Nuxt 3 is a complete rewrite of Nuxt 2, and also based on a new set of underlying technologies." Hence, upgrading touched nearly every part of the application.1

Before After
Nuxt version ^2.17.2 (EOL) ^3.12.2
Vue version ^2.7.10 (EOL) ^3.4.29
Size of Docker image 570mb 202mb
Memory usage upon startup 116.8mb 10.62mb
Dependencies 19 11
Lines of code - -8,754
Tests none Vitest + Nuxt test-utils

Going granular on all of my changes would take me a long time, and I don't know that anyone is particularly keen on that level of detail. But some of the major changes include:

  • Dumping Express.js in favor of Nuxt 3's own server-side and API tooling.
  • Dumping axios in favor of Nuxt 3's built-in data fetching library.
  • Switching out @nuxtjs/auth-next for nuxt-auth-utils for auth0 authentication. (This actually took the most time because the Nuxt 3 tooling for authentication was / is still under active development when I started this work, and the documentation on how to implement it is relatively sparse.)
  • Reworked Nuxt config and how we retrieve and utilize config vars across the app. Ensured that it will work in all deployment environments - local dev, Dockerized with local .env, Dockerized on Azure.
  • Rewriting all pages and components to use Vue 3 APIs, in particular leveraging the Composition API and other new tooling.
  • Simplified all of the API endpoints, and removed a few since I have optimized how we pass config to the client.
  • Added a Vitest testing framework, and a first set of unit tests! For the Auth0Login component.
  • Upgraded all dependencies and libraries where possible.
  • Broadly, as I was rewriting for Nuxt 3, I have also sought fit to clean up or streamline code wherever I have found redundancies or unclear logic.

Now that this repo has been upgraded to Nuxt 3, we can (1) create a shared module library in Nuxt 3 for usage across the GC Nuxt apps, and (2) upgrader the other Nuxt 2 application, GuardianConnector Views, which will take much less time since the hard lifting has been done here.

What I'm not doing here:

Supporting building Docker images for arm in the Github workflows. Something about the refactor, or maybe the upgrade of the Docker image Node version, was breaking arm64, arm/v7 builds. So we'll have to figure that out later for Kakawa integration @luandro (moreso important for GuardianConnector Views than this repo).

Footnotes

  1. I don't have the reference handy, but at some point I watched a video of a presentation by Evan You, the creator of Vue.js & Vite, where he described that upgrades moving forward will be much less painful, thankfully.

@rudokemper rudokemper marked this pull request as ready for review September 9, 2024 22:09
@rudokemper rudokemper changed the title [WIP] 🚧 Upgrade to Nuxt 3 🏗️ Upgrade to Nuxt 3 Sep 10, 2024
@rudokemper rudokemper merged commit 7d62edd into main Sep 12, 2024
1 check passed
@rudokemper rudokemper deleted the upgrade-to-nuxt-3 branch September 12, 2024 12:10
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.

Upgrade to Nuxt 3
1 participant