storyblok-cli icon indicating copy to clipboard operation
storyblok-cli copied to clipboard

`pull-components` separate files fails with folders

Open reinabo opened this issue 6 months ago • 2 comments

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 avatar Jul 30 '24 18:07 reinabo