Andarist / cherry-pick

🍒⛏📦 Build tool to generate proxy directories.
56 stars 12 forks source link

Add support for glob to create only selected directories #5

Open paldepind opened 5 years ago

paldepind commented 5 years ago

This PR adds support for customizing the glob used to find the files to create and remove proxies for.

I want to use cherry-pick for a project where the source directory contains many files but where I only need a single proxy directory for one of them.

While putting this together I realized that when cherry-pick is being run in the prepublish hook and cherry-pick clean is being run in the postpublish hook and when files in package.json only specifies the desired proxy directories then creating additional ones is almost not an issue. Still, I find it nice to be able to specify only the ones I need. If nothing else it at least makes cherry-picks output a lot cleaner when it doesn't include many unwanted directories.

The PR also adds the Prettier config to package.json so that it can be picked up by editor plugins etc.

Andarist commented 5 years ago

Overally this is a good enhancement, I'm only worried about using user-provided globs atm as we don't support outputting nested directories (which would be another good enhancement to be made, but probably slightly more complex and should be done separately).

Maybe we should just allow for comma-separated entries now? as in --entries file1,file2? This would ensure noone is trying to use globs for nested directories which wouldnt work anyway right now?

paldepind commented 5 years ago

I don't have a strong opinion either way :smile: I implemented the glob as that's what you suggested back in https://github.com/funkia/list/pull/52. But two arguments for keeping globs could be

On the other hand a list of is entries is nice due to its simplicity.

Andarist commented 5 years ago

Let's keep the glob, but would be good to validate against catching nested directories with it - better to fail fast rather than later.

paldepind commented 5 years ago

What about ignoring any matched files in nested directories and additionally logging a warning that they have been ignored?

Andarist commented 5 years ago

Sounds good too 👌

paldepind commented 5 years ago

Great. I'll update the PR later in the week :smile: