Macil / flow-copy-source

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

Allow comma delimited list of paths for --ignore option #7

Closed jpgorman closed 6 years ago

jpgorman commented 6 years ago

Currently the --ignore param pipes a string straight into the ignore node of the options object. This works well where you want to ignore a single path. However as the ignore property accepts an array for multiple paths, there is no way to pass multiple ignore paths in via the --ignore option.

I've noticed that the babel-cli does allow this behavior via a comma delimited list. It would be great if this behavior was allow in this library as well.

jpgorman commented 6 years ago

Just to be a little clearer, I'm running the following as part of an npm script

./node_modules/.bin/flow-copy-source -v --ignore **/__tests__/**,**/__regression__/** src lib

Which gets translated to the following call to Glob new Glob( '**/*.js', { ignore: "'**/__tests__/**','**/__regression__/**'", <----- currently always a string }, );

However, what you'd really want is:

new Glob( '**/*.js', { ignore: ['**/__tests__/**','**/__regression__/**'], <----- array }, );

Macil commented 6 years ago

Sorry for not taking a look at this much sooner!

It turns out that you can already pass the --ignore option multiple times in order to specify multiple ignore patterns. I've added a bit to the readme pointing this out now.