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

Turborepo migration #100

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

Turborepo migration #100

wants to merge 10 commits into from

Conversation

jhavej
Copy link

@jhavej jhavej commented Oct 12, 2023

I migrated the code structure to Turborepo by following these steps:

  1. I merged my own OSS codebaseup-core - this step was mainly about conflict resolution and deleting unnecessary code
  2. Moving stuff around & building Turborepo -> apps/web + packages (prisma moved to the database package)
  3. Cleaning & fixing (invalid imports, Typescript, minor ESLint errors, etc.)

The repo now uses pnpm@8.8.0 (I assume it was npm before).

You can launch the app by running pnpm run dev (install dependencies beforehand by pnpm run install) anywhere within the repository.

Other commands like pnpm run dev --filter=web or pnpm add -D some-dev-package --filter=ui work out of the box.

The codebase is also covered by Typescript and ESLint tests (shared config, see packages) - simply run pnpm run ts or pnpm run lint (the --filter argument works here too). Prettier helps too.

I added husky - its pre-commit script now contains pnpm run lint && pnpm run ts so it doesn't let anyone commit buggy code. We can also add pnpm run format so the code is duly formatted by Prettier. If you want to skip this pre-commit script, simply add --no-verify argument to the git commit command.

The ui package is shadcn/ui and uses the original config from components.json - CLI should work too as expected.

Known issues:

ESLint errors in the web app (the original Next.js app)

  • for now I added apps/web/.eslintignore to ignore everything in apps/web just so ESLint tests pass (it wouldn't be an issue on localhost as it'd only affect husky's pre-commit tests ☝️ but it also causes failures during Vercel deployments).
  • see packages/eslint-config-custom/rules.js - I use these rules in my projects but they are still too strict for papermark. Loosening these rules would be a solution too.

Deployment:

I tried to deploy the app to Vercel - AIRTABLE_API_KEY is mandatory env so the getInvestors() function can fetch from Airtable - this raised an error, otherwise it looked good.

Create a new project - Vercel needs Root Directory configuration for monorepo:

image

The next steps (optional):

  • Fix linting errors (.eslintignore works as a temporary solution) - to see errors, remove .eslintignore and run pnpm run lint --filter=web -> either fix them all or simply loosen the rules.
  • Move reusable code to packages (e.g. components to ui)

If anything, ping me at X or here.

👋

@jhavej jhavej requested a review from mfts as a code owner October 12, 2023 13:59
@vercel
Copy link

vercel bot commented Oct 12, 2023

@jhavej is attempting to deploy a commit to the mftsio Team on Vercel.

A member of the Team first needs to authorize it.

@jhavej
Copy link
Author

jhavej commented Oct 25, 2023

@mfts Hi Marc, I just merged your main branch and resolved some conflicts. Currently, I see only Typescript errors that need to be fixed (or ignored as they can apparently be fixed gradually in the future) - you can spot them when running pnpm run ts --filter=web - because of that, you must use --no-verify flag when git commit (coming from husky), e.g. git commit -m "something" --no-verify

@mfts
Copy link
Owner

mfts commented Oct 26, 2023

Thanks @jhavej ! I want to merge a couple of ongoing PRs first (Team accounts, Versions), before I switch over to turborepo. I will keep this PR open for now because this will be the basis for the turborepo transition.

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