Badget icon indicating copy to clipboard operation
Badget copied to clipboard

feat: Migrate to monorepo

Open Littletonconnor opened this issue 1 year ago • 14 comments

Overview

This pull request aims to fix: #15 by introducing Turborepo to this repository and ultimately migrating this repo over to a monorepo.

Features

Configure Turbo

  • Turbo is now configured in this repo. The monorepo is setup to have apps and packages directories.
    • Apps - Used to hold, well, apps like the Next.js app that powers the site.
    • Packages - We don't currently have any, but this is where we can put reusable libraries and configs.

Reorganize Codebase

  • Mentioned above, but the codebase has been organized to fit common monorepo conventions.

Update package.json

  • Both the root package.json and www package.json are updated and I have ensured the scripts work.

Adopt Yarn/npm Workspaces

  • We have adopted yarn workspaces since yarn is the package manager this project uses.

Testing and Debugging

  • I have tested all scripts and ensured they still work the same as they did before, but now we have first class caching ✨

Documentation

  • I have updated the README to include the fact that this repo is now a monorepo.

Additional Notes

There's a ton more we can do in terms of setting up a monorepo, but I left those out to keep the scope of the PR relatively small. I was already a bit concerned with the amount of files changes just due to the sheer number of files I had to move over. So while this pull request does not set up the perfect monorepo structure it does set the project on the right path, and I figure we can break down future tasks like setting up testing so we can add those to our Turbo.json file, setting up utility packages of sorts, etc.

Littletonconnor avatar Jan 06 '24 05:01 Littletonconnor

Someone is attempting to deploy a commit to a Personal Account owned by @meglerhagen on Vercel.

@meglerhagen first needs to authorize it.

vercel[bot] avatar Jan 06 '24 05:01 vercel[bot]

Totally open to suggestions if there are missing items folks think should be included here 😄

Littletonconnor avatar Jan 06 '24 06:01 Littletonconnor

What would the advantages of a monorepo? If reusable packages are needed they can be uploaded to npm and used within their free plan because they would be open source.

eidriahn avatar Jan 06 '24 12:01 eidriahn

What would the advantages of a monorepo? If reusable packages are needed they can be uploaded to npm and used within their free plan because they would be open source.

So, going ahead, the plan is to have a react-native app, a Node.js server, etc. Having a monorepo will help us having everything related to ProjectX at single place.

akkikumar72 avatar Jan 06 '24 13:01 akkikumar72

I would avoid a monorepo setup until strictly necessary, but the final call should be done by @meglerhagen

eidriahn avatar Jan 06 '24 15:01 eidriahn

What would the advantages of a monorepo? If reusable packages are needed they can be uploaded to npm and used within their free plan because they would be open source. Sure, I can help you with that. Here's a reworded version of the text you provided:

In addition to what @akkikumar72 mentioned, there are a few more benefits to using a monorepo like Turborepo:

  1. Turborepo's ability to cache tasks can save money and time in the long run, especially as more features like Github actions are likely to be added to the repo in the future.
  2. Uploading multiple packages to npm and ensuring that all changes are reflected in a single PR can be a daunting task. A monorepo ensures that all the changes can be made in one go.
  3. With a monorepo, all Git history is organized in one place, making it easier to track changes over time.
  4. Adopting a monorepo early on, before the repository grows too large, can save time and effort in the long run. At my current workplace, we switched to a monorepo quite late and it took us almost a year to complete the transition and we're still nowhere close to where we want to be 😅 .

Littletonconnor avatar Jan 06 '24 16:01 Littletonconnor

@meglerhagen What do we think about this? I can fix the merge conflicts if we plan on merging this soon.

Littletonconnor avatar Jan 09 '24 03:01 Littletonconnor

Hi @Littletonconnor - Yes i would probebly need some help with the merge. But looks like its only the package.json that is the problem right now.

Codehagen avatar Jan 09 '24 18:01 Codehagen

@meglerhagen Conflicts are now resolved!

Littletonconnor avatar Jan 10 '24 06:01 Littletonconnor

Ok! Just did a commit @Littletonconnor , Just saw some new conflicts. Going to wait for new if you could help with the merge ✨

Codehagen avatar Jan 10 '24 07:01 Codehagen

@meglerhagen Okay merge conflicts are cleaned up again! 🤞

Littletonconnor avatar Jan 11 '24 07:01 Littletonconnor

Well @Littletonconnor i see that the conflicts are back, becouse i havent merged this yet (haha) - Do you mind for the last time to fix the merge conflicts that i made so that we can push it? Community wants this ✨

Codehagen avatar Jan 21 '24 16:01 Codehagen

@meglerhagen Yep, I should be able to get around to fixing these either today or tomorrow!

Littletonconnor avatar Jan 21 '24 21:01 Littletonconnor

Cant wait! Need to merge it asap when its ready. Also remember to yarn format so we get trough the github actions

Codehagen avatar Jan 22 '24 18:01 Codehagen

It's failing the github workflow. Make sure to adapt the github action workflow so that it runs for all packages in the monorepo (format, lint, test and build)

palmithor avatar Jan 25 '24 07:01 palmithor

It's failing the github workflow. Make sure to adapt the github action workflow so that it runs for all packages in the monorepo (format, lint, test and build)

Yes, I'm on it. There are a lot of broken paths due to the migration to turborepo that isn't completed at 100%

alexghirelli avatar Jan 25 '24 07:01 alexghirelli

@meglerhagen sorry I wasn't able to get to this in time. Glad this was picked up by someone else though!

Littletonconnor avatar Jan 25 '24 16:01 Littletonconnor

No worries and thanks @Littletonconnor ✨

Codehagen avatar Jan 25 '24 18:01 Codehagen