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

feat(cli): show prompt if local version doesn't match remote #6707

Merged
merged 12 commits into from
Jun 11, 2024
Merged

Conversation

binoy14
Copy link
Contributor

@binoy14 binoy14 commented May 16, 2024

Description

Shows a prompt if the installed version of importmap deps are different then what it would resolve to.

FIXES SDX-1342

What to review

Updates makes sense.

To test no error case in test-studio

  1. cd dev/test-studio/
  2. run pnpm sanity:build --auto-updates

Expected: No warning

To test error case in test-studio

  1. Update the sanity and/or @sanity/vision version to something older in dev/test-studio/package.json and run pnpm install
  2. cd dev/test-studio
  3. run pnpm sanity:build --auto-updates

Expect: will show copy with different versions

Testing

It's probably very hard to do a more integration level test for this, I wrote a unit test for the compare function at least

Notes for release

N/A

Copy link

vercel bot commented May 16, 2024

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

Name Status Preview Comments Updated (UTC)
page-building-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 11, 2024 9:12pm
performance-studio ✅ Ready (Inspect) Visit Preview Jun 11, 2024 9:12pm
test-compiled-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 11, 2024 9:12pm
test-next-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 11, 2024 9:12pm
test-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 11, 2024 9:12pm
1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
studio-workshop ⬜️ Ignored (Inspect) Visit Preview Jun 11, 2024 9:12pm

Copy link
Contributor Author

binoy14 commented May 16, 2024

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @binoy14 and the rest of your teammates on Graphite Graphite

Copy link
Contributor

No changes to documentation

Copy link
Contributor

github-actions bot commented May 16, 2024

Component Testing Report Updated Jun 11, 2024 9:17 PM (UTC)

File Status Duration Passed Skipped Failed
comments/CommentInput.spec.tsx ✅ Passed (Inspect) 37s 15 0 0
formBuilder/ArrayInput.spec.tsx ✅ Passed (Inspect) 7s 3 0 0
formBuilder/inputs/PortableText/Annotations.spec.tsx ✅ Passed (Inspect) 26s 6 0 0
formBuilder/inputs/PortableText/copyPaste/CopyPaste.spec.tsx ✅ Passed (Inspect) 32s 11 7 0
formBuilder/inputs/PortableText/Decorators.spec.tsx ✅ Passed (Inspect) 14s 6 0 0
formBuilder/inputs/PortableText/DisableFocusAndUnset.spec.tsx ✅ Passed (Inspect) 9s 3 0 0
formBuilder/inputs/PortableText/FocusTracking.spec.tsx ✅ Passed (Inspect) 37s 15 0 0
formBuilder/inputs/PortableText/Input.spec.tsx ✅ Passed (Inspect) 1m 15s 21 0 0
formBuilder/inputs/PortableText/ObjectBlock.spec.tsx ✅ Passed (Inspect) 1m 2s 18 0 0
formBuilder/inputs/PortableText/PresenceCursors.spec.tsx ✅ Passed (Inspect) 7s 3 9 0
formBuilder/inputs/PortableText/RangeDecoration.spec.tsx ✅ Passed (Inspect) 21s 9 0 0
formBuilder/inputs/PortableText/Styles.spec.tsx ✅ Passed (Inspect) 15s 6 0 0
formBuilder/inputs/PortableText/Toolbar.spec.tsx ✅ Passed (Inspect) 29s 12 0 0

Comment on lines +62 to +68
// Get the version without any tags if any
const coercedSanityVersion = semver.coerce(installedSanityVersion)?.version
if (autoUpdatesEnabled && !coercedSanityVersion) {
throw new Error(`Failed to parse installed Sanity version: ${installedSanityVersion}`)
}
const version = encodeURIComponent(`^${coercedSanityVersion}`)
const autoUpdatesImports = getAutoUpdateImportMap(version)
Copy link
Member

Choose a reason for hiding this comment

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

Can we move this into the conditional below? Feels like unnecessary work and potentially throwing if the user has not opted in to auto updates

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@rexxars the reason I have it outside the conditional is because the autoUpdatesImports variable is used below in line 160 If I make a variable like let autoUpdatesImports TS can't necessarily tell if the variable is initialized so it complains. The problem with moving the whole thing after the clean is that it does into a spinner and prompt doesn't work with spinner. I think there is some opportunity to clean this up a little bit but unless you strongly feel that we should do it now, punt it for future work?

Copy link
Member

Choose a reason for hiding this comment

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

Makes sense. Can refactor later 👍

Base automatically changed from sdx-1242 to next June 11, 2024 20:40
@binoy14 binoy14 dismissed ricokahler’s stale review June 11, 2024 20:40

The base branch was changed.

@binoy14 binoy14 added this pull request to the merge queue Jun 11, 2024
Merged via the queue into next with commit 50f1e54 Jun 11, 2024
45 checks passed
@binoy14 binoy14 deleted the sdx-1259 branch June 11, 2024 21:39
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

3 participants