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

feat!: generated file naming syntax #135

Merged
merged 6 commits into from
Dec 2, 2024

Conversation

alvarosabu
Copy link
Contributor

The current implementation applies the flags --filename differently and has different naming conventions for generated files depending on the command

This PR introduces another breaking change requested by clients which solves the situation by establishing a common format for generated files:

<filename>.<suffix>.<extension>

Where:

  • <filename> is the name of the file. Customizable by the user with the --filename flag
  • <suffix> is an optional suffix to differentiate the files. By default is going to be the spaceId and is customizable by the user with the --suffix flag
  • <extension> is the file extension. By default is json (Not configurable)

Example:

storyblok pull-languages --space=12345 --filename=my-languages --suffix=dev

Will generate the languages in the following path .storyblok/languages/my-languages.dev.json

If you would like to use a timestamp as the suffix you can use:

storyblok pull-languages --space=12345 --filename=my-languages --suffix="$(date +%s)"

Warning

The --filename will be ignored in the case that --separate-files is used on the commands that supports it.

BREAKING CHANGE: Generated files will no longer be saved on the root of the project by default, they will be encapsulated inside of a `.storyblok` folder.
BREAKING CHANGE: generated file naming syntax is now standard between all the commands, following the structure `<filename>.<suffix>.json`. Both filename and suffix are customizable and by default would be the command name and the spaceId respectively. Ex: `components.12345.json`
@alvarosabu alvarosabu self-assigned this Nov 13, 2024
@alvarosabu alvarosabu added feature [Issue] New feature or request breaking-change Changes that cause backward compatibility issues and will require a major version. labels Nov 13, 2024
src/commands/pull-languages/index.ts Outdated Show resolved Hide resolved
src/utils/filesystem.ts Outdated Show resolved Hide resolved
src/utils/filesystem.ts Outdated Show resolved Hide resolved
@alvarosabu alvarosabu requested a review from edodusi November 27, 2024 17:35
src/utils/filesystem.ts Outdated Show resolved Hide resolved
@alvarosabu alvarosabu requested a review from edodusi November 29, 2024 16:24
@alvarosabu alvarosabu merged commit 16c91fc into next Dec 2, 2024
3 checks passed
@edodusi edodusi deleted the feature/generated-file-naming-syntax branch December 2, 2024 10:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change Changes that cause backward compatibility issues and will require a major version. feature [Issue] New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants