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

chore(deps): upgrade to turbo v2, pnpm v9 & improve dev scripts #1720

Merged
merged 25 commits into from
Aug 8, 2024

Conversation

stipsan
Copy link
Member

@stipsan stipsan commented Aug 7, 2024

To improve dev scripts the new turbo watch command is used, it re-runs the dev commands in packages/* that currently runs pkg build --strict.

Once @sanity/pkg-utils handles TS types with its watch command we can move to a simplified setup with turbo run dev again instead of turbo watch dev, that handles running build commands during warm up. The reason we manually run build before turbo watch is due to turbo running watch tasks all in parallel, which means you easily have sanity dev happening before packages it uses, like @sanity/presentation, is built.

While at it I've bumped @sanity/ui, sanity packages, and enabled testing our @sanity/styled-components temporary fork (related studio PR).

@stipsan stipsan requested a review from a team as a code owner August 7, 2024 21:34
Copy link

vercel bot commented Aug 7, 2024

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

Name Status Preview Comments Updated (UTC)
visual-editing-astro ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 7, 2024 11:49pm
visual-editing-next ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 7, 2024 11:49pm
visual-editing-next-no-cache ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 7, 2024 11:49pm
visual-editing-next-server-only ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 7, 2024 11:49pm
visual-editing-next-with-i18n ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 7, 2024 11:49pm
visual-editing-nuxt ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 7, 2024 11:49pm
visual-editing-page-builder-demo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 7, 2024 11:49pm
visual-editing-remix ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 7, 2024 11:49pm
visual-editing-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 7, 2024 11:49pm
visual-editing-svelte ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 7, 2024 11:49pm

@stipsan stipsan enabled auto-merge August 7, 2024 21:34
Copy link
Member Author

Choose a reason for hiding this comment

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

This action doesn't really work well with pnpm

@@ -23,12 +22,11 @@ jobs:
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v2
- uses: pnpm/action-setup@v4
Copy link
Member Author

Choose a reason for hiding this comment

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

v4 automatically supports packageManager in package.json, so the corepack command is no longer necessary

@@ -23,7 +22,7 @@ jobs:
with:
app-id: ${{ secrets.ECOSPARK_APP_ID }}
private-key: ${{ secrets.ECOSPARK_APP_PRIVATE_KEY }}
- uses: connor-baer/action-sync-branch@main
- uses: connor-baer/action-sync-branch@v1.1.0
Copy link
Member Author

Choose a reason for hiding this comment

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

Don't know why renovate missed pinning this one, it's pinned now though

Copy link
Member Author

Choose a reason for hiding this comment

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

This workaround is no longer needed, as Google fixed this back in May googleapis/release-please#2281 🥳

Comment on lines +9 to +16
const sanityExports = {}
for (const key of Object.keys(sanityPkg.exports)) {
if (key === '.') continue
const subexport = path.join('sanity', key)
sanityExports[subexport] = requireResolve(subexport)
}
sanityExports['sanity'] = requireResolve('sanity')

Copy link
Member Author

Choose a reason for hiding this comment

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

We'll ship a first class utility for this in next-sanity later. This feature is based on the new aliasing that sanity dev does since v3.53.0

Copy link
Member

Choose a reason for hiding this comment

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

Cool! Also TIL about Import Assertions

@@ -5,9 +5,9 @@

import {visionTool} from '@sanity/vision'
import {defineConfig} from 'sanity'
import {presentationTool} from 'sanity/presentation'
Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks to the link-workspace-packages = deep in the root .npmrc we can use e2e tests that import from sanity/presentation and still have it use the workspace version instead of npm 🥳

Copy link
Member

@rdunk rdunk left a comment

Choose a reason for hiding this comment

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

No obvious issues that I could find in the code changes. Tested locally and it seems work great, big improvement. I left one query about the per branch env vars but not a blocker, can discuss that later on.

Thanks!

@stipsan stipsan added this pull request to the merge queue Aug 8, 2024
Merged via the queue into main with commit e440d20 Aug 8, 2024
19 checks passed
@stipsan stipsan deleted the turbo-v2-pnpm-v9 branch August 8, 2024 09:57
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants