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

Feature: Add Glob Patterns to Typedefs Generation #104

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

chimp1nski
Copy link

Pull request type

  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Other (please describe):

How to test this PR

  1. Create a folder for your components in a frontend project
    ./storyblok/components
  2. Pull components from a space into separate files
    storyblok --space <SPACE-ID> pull-components --sf -p ./storyblok/components/
  3. Generate types for all components in the directory with provided glop pattern string "./storyblok/components/*"
    storyblok --space <SPACE-ID> generate-typescript-typedefs --source './storyblok/components/*' --target ./storyblok/storyblok-types.d.ts

What is the new behavior?

You can now provide a glob pattern string to the generate-typescript-typedefs command to allow for advanced file matching (e.g.: all files within a directory) while maintaining backwards compatibility.

Other information

This proposal stems from a problem I am currently facing where I want to generate types for specific components only without having to add each one of them separately to an npm script.

More Context

In a storyblok project I am currently working on we have separate teams for the creation of the bloks in the blok library and the development of the components in the frontend. Since the blok library team is constantly creating new bloks – primarily to try things out – the generated types in the frontend get littered with "test" components and types.

I now want to be able to pull all of the components with one command, only commit those I need to the codebase (folder) and then generate the types only for the components in that folder.

Thanks for your time and have a great weekend :)

@chimp1nski
Copy link
Author

You might want to ignore commit 25f237c for review since those are only formatting fixes.

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.

1 participant