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): use auto-updates flag in init #7401

Merged
merged 6 commits into from
Sep 12, 2024

Conversation

cngonzalez
Copy link
Member

@cngonzalez cngonzalez commented Aug 20, 2024

Description

As we move to make auto-updates the default way of updating studios, we want to ensure that we give developers the option to maintain legacy behavior and keep to specific versions if they prefer.

This PR updates the sanity init command to allow a --no-auto-updates flag that will then be injected into the CLI configuration as autoUpdates: true or autoUpdates: false

This required a bit of refactoring of our template logic, since we previously only dealt with string variables. I've added another way of identifying the variables we're injecting, but happy to refactor if this is not ideal.

What to review

Are there any ways in which auto-updates might be undefined? Any gotchas in the AST parser?

Testing

I've added a test for this against Typescript -- if needed, I can repeat those tests for the other cases (Javascript, templates) but assume all will be consistent.

(No release notes because this feature is still in beta)

Copy link

vercel bot commented Aug 20, 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 Sep 12, 2024 5:59pm
performance-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 12, 2024 5:59pm
test-compiled-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 12, 2024 5:59pm
test-next-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 12, 2024 5:59pm
test-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 12, 2024 5:59pm
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
studio-workshop ⬜️ Ignored (Inspect) Visit Preview Sep 12, 2024 5:59pm

Copy link
Contributor

No changes to documentation

Copy link
Contributor

github-actions bot commented Aug 20, 2024

Component Testing Report Updated Sep 11, 2024 11:05 PM (UTC)

File Status Duration Passed Skipped Failed
comments/CommentInput.spec.tsx ✅ Passed (Inspect) 47s 15 0 0
formBuilder/ArrayInput.spec.tsx ✅ Passed (Inspect) 8s 3 0 0
formBuilder/inputs/PortableText/Annotations.spec.tsx ✅ Passed (Inspect) 30s 6 0 0
formBuilder/inputs/PortableText/copyPaste/CopyPaste.spec.tsx ✅ Passed (Inspect) 36s 11 7 0
formBuilder/inputs/PortableText/copyPaste/CopyPasteFields.spec.tsx ✅ Passed (Inspect) 0s 0 12 0
formBuilder/inputs/PortableText/Decorators.spec.tsx ✅ Passed (Inspect) 17s 6 0 0
formBuilder/inputs/PortableText/DisableFocusAndUnset.spec.tsx ✅ Passed (Inspect) 10s 3 0 0
formBuilder/inputs/PortableText/DragAndDrop.spec.tsx ✅ Passed (Inspect) 2m 33s 1 0 0
formBuilder/inputs/PortableText/FocusTracking.spec.tsx ✅ Passed (Inspect) 43s 15 0 0
formBuilder/inputs/PortableText/Input.spec.tsx ✅ Passed (Inspect) 1m 49s 21 0 0
formBuilder/inputs/PortableText/ObjectBlock.spec.tsx ✅ Passed (Inspect) 1m 12s 18 0 0
formBuilder/inputs/PortableText/PresenceCursors.spec.tsx ✅ Passed (Inspect) 8s 3 9 0
formBuilder/inputs/PortableText/RangeDecoration.spec.tsx ✅ Passed (Inspect) 25s 9 0 0
formBuilder/inputs/PortableText/Styles.spec.tsx ✅ Passed (Inspect) 17s 6 0 0
formBuilder/inputs/PortableText/Toolbar.spec.tsx ✅ Passed (Inspect) 1m 12s 21 0 0
formBuilder/tree-editing/TreeEditing.spec.tsx ✅ Passed (Inspect) 1m 46s 30 0 0
formBuilder/tree-editing/TreeEditingNestedObjects.spec.tsx ✅ Passed (Inspect) 20s 3 0 0

@cngonzalez cngonzalez force-pushed the feat/sdx-1583/allow-no-auto-updates-in-init branch from 5538e15 to 9d1dc0a Compare August 21, 2024 11:41
@cngonzalez cngonzalez force-pushed the feat/sdx-1583/allow-no-auto-updates-in-init branch from 9d1dc0a to 69395f5 Compare August 21, 2024 11:53
@cngonzalez cngonzalez force-pushed the feat/sdx-1583/allow-no-auto-updates-in-init branch from 69395f5 to 2acba13 Compare August 21, 2024 12:04
@cngonzalez cngonzalez force-pushed the feat/sdx-1583/allow-no-auto-updates-in-init branch from 2acba13 to 9c5d788 Compare August 21, 2024 12:28
if (typeof value !== 'boolean') {
throw new Error(`Expected boolean value for '${variableName}'`)
}
node.name = value.toString()
Copy link
Member

Choose a reason for hiding this comment

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

I don't like this approach - we're relying on the fact that babel won't validate that the name is valid. This identifier node should be replaced with a Literal node. I'll do a fix.

@rexxars rexxars force-pushed the feat/sdx-1583/allow-no-auto-updates-in-init branch from 6deceda to 2e92243 Compare September 12, 2024 17:39
@rexxars rexxars requested review from a team as code owners September 12, 2024 17:39
Copy link
Contributor

@ricokahler ricokahler left a comment

Choose a reason for hiding this comment

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

looks good! i believe this should result in right CLI config

not sure if this was suggested yet, but it seems like we're reimplementing a lot of what babel template could solve but it may be more complicated with dependencies, typescript support, etc so feel free to ignore

@rexxars rexxars added this pull request to the merge queue Sep 12, 2024
Merged via the queue into next with commit 17c02f9 Sep 12, 2024
17 checks passed
@rexxars rexxars deleted the feat/sdx-1583/allow-no-auto-updates-in-init branch September 12, 2024 21:49
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.

5 participants