-
Notifications
You must be signed in to change notification settings - Fork 29
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/pro 173 #99
Fix/pro 173 #99
Conversation
Thanks for this PR @christianzoppi 🙏 This weird behaviour we're currently getting is probably caused by concurrent
Making those requests synchronous would mean that we'd be getting well-formatted JSONs, but this doesn't solve the underlying issue: the CLI is not handling presets for different bloks that share the same name. To solve this issue we should probably come up with a more refined naming strategy, or a folder-based structure. Something like:
or
If this is going to be a breaking change (albeit a fix), we might consider taking some time to think about this whole naming update more thoroughly and group it with other breaking changes, so that we don't release a bunch of new majors, one for each breaking change. |
Hey @Edo-San, like we agreed in DM I added a parameter for the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍 At this point, I don't think it's even necessary to swap writeFile
with its sync counterpart but the end result is basically the same 😊 We can leave it as it is right now, knowing that this is going to be rewritten from the ground up, eventually.
README.md
Outdated
@@ -96,12 +96,14 @@ $ storyblok pull-languages --space <SPACE_ID> | |||
|
|||
Download your space's components schema as json. By default this command will download 2 files: 1 for the components and 1 for the presets; But if you pass a flag `--separate-files or --sf` the command will create file for each component and presets. And also you could pass a path `--path or -p` to save your components and presets. | |||
|
|||
It's highly recommended to use also the `--prefix-presets-names` or `-ppn` parameter if you use `--separate-files` because it will prefix the names of the individual files with the name of the component. This feature solves the issue of multiple presets from different compoentns but with the same name, being written in the same file. In a future major version this will become the default behavior. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo: compoentns
instead of components
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed, thank you!
🎉 This PR is included in version 3.32.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This PR fixes some problems that happen when running
pull-components
with the--separate-files
parameter. Some files will be corrupted during the asynchronous save. The code of the CLI doesn't even wait for the writing operation to be over.Pull request type
Jira Link: INT-
How to test this PR
In the same parent folder as the
storyblok-cli
one, create one calleddata
, then run:Run
npm run dev pull-components -- --space 88751 --separate-files --path ./../data/
You should get no errors. Now open any JSON file and inspect the content. The content should be correct.
What is the new behavior?
Files from
pull-components
command are stored synchronouslyOther information