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

Migrate to Vite #213

Open
wants to merge 48 commits into
base: main
Choose a base branch
from
Open

Migrate to Vite #213

wants to merge 48 commits into from

Conversation

dfosco
Copy link

@dfosco dfosco commented Mar 12, 2025

This is a major update to react-template that:

  • Moves away from CRA as tooling for the template, since it has been officially deprecated and breaks very easily on modern React apps
  • Adds GH-pages deployment configuration and instructions for easily sharing React prototypes
  • Adds simple file-based routing with generouted
  • Adds detailed documentation for how to run locally and on Codespaces
  • Adds a few GitHub layout Templates with links to more documentation

I appreciate if the team feels this PR is too big to merge at once, and I'd be happy to find smaller slices if that's a better way!

This started as a separate (private) repo on https://github.com/github/primer-react-prototype, and I was encouraged to merge it back. Since there are no private forks however, it was messy to pull changes back, so apologies if the git history
looks... weird 😅

image image image

@dfosco dfosco requested a review from a team as a code owner March 12, 2025 11:30
@dfosco dfosco requested review from jonrohan, maximedegreve, langermank and lesliecdubs and removed request for a team and jonrohan March 12, 2025 11:30
@dfosco dfosco self-assigned this Mar 12, 2025
@lesliecdubs lesliecdubs requested a review from joshblack March 13, 2025 02:36
@joshblack
Copy link
Member

Hi there! 👋 Thanks so much for taking the time to make this PR 🙏 Definitely agreed moving off CRA would be 💯

Just had some questions that came up when looking at this and would love to hear your thoughts 👀

  • Is Vite preferable to something like Next.js or Tanstack Start for prototyping for most folks?
  • Is the key thing for generouted that it sets up file-based routing?

@dfosco
Copy link
Author

dfosco commented Mar 14, 2025

Is Vite preferable to something like Next.js or Tanstack Start for prototyping for most folks?

@joshblack The goal with using Vite was to stay as close as possible to "pure React", where folks can just write HTML / CSS / import Primer React components. For most designers starting a prototype, what they're looking for is a way to render static layouts in code, with some interactivity sprinkled on top.

Next and Tanstack are great for larger, stateful prototypes. @victoriaNine started a prototype with this template and migrated to Next bc she needed client-side routing.

I think having a Next/Tanstack variant of this template would also be good, but they aim at different needs / experience levels IMO.

Is the key thing for generouted that it sets up file-based routing?

Yeah, it reads the /pages folder and creates static routes. It helps users not have to manually fiddle with <Routes> markup from React Router, or having to import all of Next's kitchen sink into the template.

Keep in mind that while Next is "not complicated", the target audience for this template is folks who don't really know how to use React, so the goal is to avoid stacking multiple concepts/frameworks for them to understand.

@dfosco
Copy link
Author

dfosco commented Mar 24, 2025

@joshblack Let me know if you have any other thoughts in the way of merging this PR 😄

I'd be happy to keep this Vite-based version as a separate template, but staying with CRA makes adoption pretty tough at this point, and Vite seems to be the winning comparable solution at the moment.

@dfosco
Copy link
Author

dfosco commented Mar 25, 2025

Just found out our React codespaces template also uses Vite: https://github.com/github/codespaces-react

Copy link
Member

@TylerJDev TylerJDev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this PR @dfosco! I think everything looks good! I left one comment which I think should be it 😁

@dfosco dfosco requested a review from TylerJDev March 25, 2025 16:03
@dfosco
Copy link
Author

dfosco commented Mar 25, 2025

@TylerJDev Thanks for the review! Fixed the merge conflicts, including the upcoming one with the package.json from main. Let me know if it looks good now!

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.

3 participants