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

fix(cli): prevent crash when no package.json found in studio folder #7220

Draft
wants to merge 2 commits into
base: next
Choose a base branch
from

Conversation

rexxars
Copy link
Member

@rexxars rexxars commented Jul 22, 2024

Description

If you have the following folder structure:

.
├── node_modules
│   └── sanity
├── package.json
└── studios
    ├── studio-1
    │   └── sanity.config.ts
    └── studio-2
        └── sanity.config.ts

Running sanity dev, sanity build or sanity deploy from within studios/studio-1 will currently crash, because we attempt to read package.json from the "work directory", which is resolved to studios/studio-1.

The folder structure does make sense, since you may want to reuse the same dependencies for multiple studios.

Additionally, if you happen to be missing required dependencies (styled-components), it will install to the studio folder, not the "dependency root" (eg in folder containing package.json). Attempted to fix this too.

Marked as draft since I have yet to write tests.

What to review

Testing

Notes for release

Copy link

vercel bot commented Jul 22, 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 Jul 22, 2024 7:17am
performance-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 22, 2024 7:17am
test-compiled-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 22, 2024 7:17am
test-next-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 22, 2024 7:17am
test-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 22, 2024 7:17am
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
studio-workshop ⬜️ Ignored (Inspect) Jul 22, 2024 7:17am

Copy link
Contributor

No changes to documentation

Copy link
Contributor

Component Testing Report Updated Jul 22, 2024 7:32 AM (UTC)

File Status Duration Passed Skipped Failed
comments/CommentInput.spec.tsx ✅ Passed (Inspect) 44s 15 0 0
formBuilder/ArrayInput.spec.tsx ✅ Passed (Inspect) 9s 3 0 0
formBuilder/inputs/PortableText/Annotations.spec.tsx ✅ Passed (Inspect) 30s 6 0 0
formBuilder/inputs/PortableText/copyPaste/CopyPaste.spec.tsx ✅ Passed (Inspect) 38s 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) 3m 0s 0 0 0
formBuilder/inputs/PortableText/FocusTracking.spec.tsx ✅ Passed (Inspect) 43s 15 0 0
formBuilder/inputs/PortableText/Input.spec.tsx ✅ Passed (Inspect) 1m 50s 21 0 0
formBuilder/inputs/PortableText/ObjectBlock.spec.tsx ✅ Passed (Inspect) 1m 14s 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) 18s 6 0 0
formBuilder/inputs/PortableText/Toolbar.spec.tsx ❌ Failed (Inspect) 1m 25s 20 0 1
formBuilder/tree-editing/TreeEditing.spec.tsx ✅ Passed (Inspect) 1m 48s 30 0 0
formBuilder/tree-editing/TreeEditingNestedObjects.spec.tsx ✅ Passed (Inspect) 20s 3 0 0

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.

1 participant