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

pull-components separate files fails with folders #105

Open
reinabo opened this issue Jul 30, 2024 · 2 comments
Open

pull-components separate files fails with folders #105

reinabo opened this issue Jul 30, 2024 · 2 comments
Labels
bug Something isn't working has-workaround [Issue] Temporary solutions available. p2-edge-case [Priority] Bugs with workarounds or limited impact.

Comments

@reinabo
Copy link

reinabo commented Jul 30, 2024

Current behavior:

storyblok pull-components --separate-files fails when there is a / in the technical name field

reinabo@Reinas-MacBook-Pro AlignableWeb % yarn storyblok pull-components --space 298946 --separate-files
      _                   _     _       _
  ___| |_ ___  _ __ _   _| |__ | | ___ | | __
 / __| __/ _ \| '__| | | | '_ \| |/ _ \| |/ /
 \__ \ || (_) | |  | |_| | |_) | | (_) |   <
 |___/\__\___/|_|   \__, |_.__/|_|\___/|_|\_\
                    |___/


Hi, welcome to the Storyblok CLI

- Executing pull-components task
Error: ENOENT: no such file or directory, open 'marketing/page-298946.json'
    at Object.openSync (node:fs:596:3)
    at NodeFS.openSync (/Users/reinabo/repos/AlignableWeb/.pnp.cjs:54639:24)
    at makeCallSync.subPath.subPath (/Users/reinabo/repos/AlignableWeb/.pnp.cjs:56699:26)
    at ZipOpenFS.makeCallSync (/Users/reinabo/repos/AlignableWeb/.pnp.cjs:57330:14)
    at ZipOpenFS.openSync (/Users/reinabo/repos/AlignableWeb/.pnp.cjs:56698:17)
    at VirtualFS.openSync (/Users/reinabo/repos/AlignableWeb/.pnp.cjs:56286:24)
    at PosixFS.openSync (/Users/reinabo/repos/AlignableWeb/.pnp.cjs:56286:24)
    at NodePathFS.openSync (/Users/reinabo/repos/AlignableWeb/.pnp.cjs:56286:24)
    at Object.writeFileSync (node:fs:2322:35)
    at NodeFS.writeFileSync (/Users/reinabo/repos/AlignableWeb/.pnp.cjs:54857:19) {
  errno: -2,
  syscall: 'open',
  code: 'ENOENT',
  path: 'marketing/page-298946.json'
}
✓ We've saved your components in files with the names of each component

Expected behavior:

It automatically creates the directory required for the files instead of erroring out.

Steps to reproduce:

  1. Create a block in a space with a / in the technical name field. For example marketing/page.
  2. Now, using the storyblok CLI, pull components into separate files storyblok pull-components --space 298946 --separate-files

Example: space #298946 in EU

Other notes
The same occurs with generate-typescript-typedefs when destinationFilePath is in a folder that does not already exist.

@reinabo reinabo added the bug Something isn't working label Jul 30, 2024
@reinabo reinabo changed the title Pull components separate files fails with folders pull components separate files fails with folders Jul 30, 2024
@reinabo reinabo changed the title pull components separate files fails with folders pull-components separate files fails with folders Jul 30, 2024
@alvarosabu alvarosabu added pending-triage [Issue] Ticket is pending to be prioritised and removed bug Something isn't working labels Sep 10, 2024
@alvarosabu
Copy link
Contributor

Hi @reinabo thanks for reporting this.

I just tried the / in the component and it's true that it accepts it although is not a naming convention I have seen before for technical names 😅. I guess a workaround in the meantime we fix this would be to replace it with a -?

marketing/page -> marketing-page or directly use folders as a categorization approach ?

@alvarosabu alvarosabu added bug Something isn't working p2-edge-case [Priority] Bugs with workarounds or limited impact. has-workaround [Issue] Temporary solutions available. and removed pending-triage [Issue] Ticket is pending to be prioritised labels Sep 10, 2024
@reinabo
Copy link
Author

reinabo commented Sep 10, 2024

@alvarosabu, appreciate you taking a look at this!

Yes, there are two workarounds. We can either not use / or create the necessary folders before running pull-components (which imo is a pain, but it works). My team has about 300 blocks named like this, so renaming isn't really a viable option. We are currently using a script to make the folders, then run pull-components.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working has-workaround [Issue] Temporary solutions available. p2-edge-case [Priority] Bugs with workarounds or limited impact.
Projects
None yet
Development

No branches or pull requests

2 participants