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

CLI: Unable to specify multiple globs #92

Open
simonflk opened this issue Mar 4, 2022 · 2 comments
Open

CLI: Unable to specify multiple globs #92

simonflk opened this issue Mar 4, 2022 · 2 comments
Labels
enhancement New feature or request

Comments

@simonflk
Copy link

simonflk commented Mar 4, 2022

Hi,

Great work on the CLI, I'm really excited to use this, and this will help me finally get my typegen PR merged.

I just tried it out and ran into a couple of issues:


  1. This is minor, but I could not get the example in the docs to work:
xstate typegen "src/**/*.tsx?"

I believe it needs to change to:

xstate typegen "src/**/*.ts?(x)"

  1. Excessive logging

It logs out ${file} - success for every matching file - even if the file does not contain any machines.


  1. I cannot specify multiple globs

I have a monorepo situation, and I want to be able to run typegen across the "apps" folder, and also the "libs" folder. I was trying this:

xstate typegen "apps/**/*.ts" "libs/**/*.ts"

However, only the 'apps' folder is touched.

I also tried brace expansion:

xstate typegen "{apps,libs}/**/*.ts"

but this is not supported by picomatch (used by chokidar)

I also tried

xstate typegen "**/*.ts"

however, this traverses everything, including node_modules.

@Andarist
Copy link
Member

Andarist commented Mar 4, 2022

Do you have an example of some other CLI that accepts multiple globs? I rarely need such a thing and would like to take a look at the prior art.

@simonflk
Copy link
Author

simonflk commented Mar 4, 2022

Do you have an example of some other CLI that accepts multiple globs? I rarely need such a thing and would like to take a look at the prior art.

Good question. In most cases CLIs I use just accept a list of filenames and you can use multiple globs which will be resolved by your shell . E.g. git add *json *ts

But I think an example of a CLI that accepts and interprets multiple globs itself would be prettier

Edit: babel CLI also accepts multiple globs as patterns to excludes

@mattpocock mattpocock changed the title CLI: Unable to specify multiple globs, and excessive logging CLI: Unable to specify multiple globs Mar 11, 2022
@mattpocock mattpocock added the enhancement New feature or request label Mar 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants