Macil / flow-copy-source

Script to copy javascript files and append ".flow" to the filename
MIT License
173 stars 13 forks source link

Ignore flag doesn't work with some glob patterns #32

Closed JoeHart closed 4 years ago

JoeHart commented 4 years ago

Given a file structure of:

src/index.js
src/index.test.js

And the running of the command:

 yarn flow-copy-source -i **/*.test.js src lib

The src/index.test.js file will still be copied.

JoeHart commented 4 years ago

I've fixed this on a local branch by changing the jsAndJsxPattern to: const jsAndJsxPattern = "{**/*.js,**/*.mjs,**.*.jsx}";

With an added test case too, happy to raise a PR if I can get permission @Macil 😄

Macil commented 4 years ago

You might be running into this issue because you're not quoting the glob expression in the ignore parameter:

 yarn flow-copy-source -i '**/*.test.js' src lib

If you don't quote it, then it can be expanded by your shell to "src/index.test.js", and then I think that fails to match because it's compared to just "index.test.js".

I can't reproduce the issue with it quoted like this. (If there is a bug here, then it's probably with the glob dependency, because it's what this package is using for glob handling and file matching.)