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): ensure output path for types exist before writing #6300

Merged
merged 1 commit into from
Apr 9, 2024

Conversation

rexxars
Copy link
Member

@rexxars rexxars commented Apr 9, 2024

Description

If the generates path in the typegen configuration points to a path that does not exist, it will crash with a ENOENT: no such file or directory, open '<some-path>/<generates-path>' error.

This PR fixes this by running a recursive directory creation process before writing the output file.

What to review

  • Changes makes sense, paths are correct

Testing

Added a CLI test to reproduce - the out directory does not exist in the fixture, and thus should fail before this change and pass after this change.

Notes for release

  • Fixes an issue where sanity typegen generate would crash if the configured output path did not exist prior to running the command

@rexxars rexxars requested review from a team as code owners April 9, 2024 22:52
@rexxars rexxars requested review from ricokahler and removed request for a team April 9, 2024 22:52
Copy link

vercel bot commented Apr 9, 2024

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

Name Status Preview Comments Updated (UTC)
performance-studio ✅ Ready (Inspect) Visit Preview Apr 9, 2024 10:54pm
test-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 9, 2024 10:54pm
1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
studio-workshop ⬜️ Ignored (Inspect) Apr 9, 2024 10:54pm

Copy link
Contributor

github-actions bot commented Apr 9, 2024

No changes to documentation

Copy link
Contributor

github-actions bot commented Apr 9, 2024

Component Testing Report Updated Apr 9, 2024 10:59 PM (UTC)

File Status Duration Passed Skipped Failed
comments/CommentInput.spec.tsx ✅ Passed (Inspect) 30s 15 0 0
formBuilder/ArrayInput.spec.tsx ✅ Passed (Inspect) 6s 3 0 0
formBuilder/inputs/PortableText/Annotations.spec.tsx ✅ Passed (Inspect) 25s 6 0 0
formBuilder/inputs/PortableText/copyPaste/CopyPaste.spec.tsx ✅ Passed (Inspect) 12s 4 2 0
formBuilder/inputs/PortableText/Decorators.spec.tsx ✅ Passed (Inspect) 12s 6 0 0
formBuilder/inputs/PortableText/FocusTracking.spec.tsx ✅ Passed (Inspect) 31s 15 0 0
formBuilder/inputs/PortableText/Input.spec.tsx ✅ Passed (Inspect) 1m 1s 15 0 0
formBuilder/inputs/PortableText/ObjectBlock.spec.tsx ✅ Passed (Inspect) 1m 0s 18 0 0
formBuilder/inputs/PortableText/RangeDecoration.spec.tsx ✅ Passed (Inspect) 11s 6 0 0
formBuilder/inputs/PortableText/Styles.spec.tsx ✅ Passed (Inspect) 13s 6 0 0
formBuilder/inputs/PortableText/Toolbar.spec.tsx ✅ Passed (Inspect) 19s 9 0 0

@@ -1,3 +1,4 @@
{
"schema": "./working-schema.json"
"schema": "./working-schema.json",
"generates": "./out/types.ts"
Copy link
Contributor

Choose a reason for hiding this comment

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

we probably should have a test with a directory and one without a directory, but otherwise, 👍

Copy link
Contributor

@jtpetty jtpetty left a comment

Choose a reason for hiding this comment

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

👍

@rexxars rexxars added this pull request to the merge queue Apr 9, 2024
Merged via the queue into next with commit e75bffe Apr 9, 2024
37 checks passed
@rexxars rexxars deleted the fix/typegen-ensure-output-path branch April 9, 2024 23:06
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