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

#429 Migrate to turbo and pnpm #461

Conversation

FranciscoMoretti
Copy link

Description

Replaced Lerna and Yarn with Turbo and Pnpm.

Changes:

  • More tsup and less tsc
    • tsup is the recommended tool in turbo docs
    • tsup --watch replaces all the watch tasks. It automatically re-builds a package when in development tasks. Docs
    • tsup now generates the type definitions with the config dts: true on tsup.config.ts Docs
  • tsconfig's composite is not supported by tsup, so I've changed it to false DTS error with composite egoist/tsup#571.
    • This is also the recommended config on the turbo docs
  • dependencies are linked internally with "workspace:*". They should get replaced by the actual version when publishing Pnpm workspaces.
  • Documentation updates (Readme files)
  • Organized tasks to match turborepo pattern
  • Renamed deploy task to vercel-deploy in examples to avoid confusion with pnpm deploy
    • Now running pnpm vercel-deploy and pnpm run vercel-deploy are valid from an example directory
    • The alternative is to keep the deploy name but that would only work with pnpm run deploy because pnpm deploy is an existent pnpm command.
  • Configured tasks caches with turbo caching.

Benefits

This change has the following advantages:

  • Simplifies processes: E.g. You can now run dev with a single command
  • Faster re-builds: Turbo auto caches builds per package
  • Faster builds, lint, test: Turbo runs things in parallel whenever possible
  • Faster re-installs: Pnpm auto caches node modules
  • Modern tools: Using these new tools is a better developer experience overall and they have better documentation.

Turbo Examples

The configuration was inspired by Turborepo official examples

Tests

[x] Installing

pnpm i

[x] Running a global build:

turbo build

[x] Running a build from the package dir

cd packages/notion-utils
pnpm build

[x] Running every dev task

turbo dev

[x] Running tests execute unit eslint and prettier.

turbo test

[x] Running dev in a single example, modifying a dependency, and verifying it rebuilds it

turbo dev --filter=notion-x-example-minimal...

[x] Connecting with nextjs-notion-starter-kit.

[x] Running publish executed the correct tasks

turbo publish

[x] Running vercel deploy

cd examples/minimal
pnpm run vercel-deploy

[x] The cache works as expected in all tasks

@vercel
Copy link

vercel bot commented Apr 8, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
react-notion-x ❌ Failed (Inspect) Apr 8, 2023 9:45am
react-notion-x-minimal-demo ❌ Failed (Inspect) Apr 8, 2023 9:45am

@FranciscoMoretti
Copy link
Author

FranciscoMoretti commented Apr 8, 2023

Feedback is encouraged. I had to make a few choices here and there and I'm unsure if they are the best.

Also, it seems like deployments are failing and I can't inspect or check details. @transitive-bullshit let me know if there is anything I can do to fix them.

@transitive-bullshit
Copy link
Member

This is great @FranciscoMoretti && sorry I didn't get to this sooner.

I'm currently doing a maintenance sweep which includes these changes.

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.

2 participants