-
Notifications
You must be signed in to change notification settings - Fork 4
Conditional pipe execution #38
base: main
Are you sure you want to change the base?
Conversation
|
Thanks for the PR. I've always wanted to add conditional execution of different pipes, similar to what GitHub actions have for their steps, the difficulty in implementing this properly is maintaining compatibility with YAML and JSON configuration for CLI usage where it's impossible to embed lambda functions, such as with JS configs. The regex approach seems interesting, although I imagine that this is only to test that the source filename matches a particular pattern, and doesn't other metadata into account? |
|
Exactly, regex is for filename only. I first wanted to do a glob handling but realized it would require a dependency and I think regexp should be fine. I try to test it on my project today to see if it works, it has been a few weeks since I was working on it and I'm unsure if I missed something (thats why it's still in draft mode :D) |
|
So far this only works for the CLI TypeScript version, I don't use YAML or anything atm, but I guess it shouldn't be an issue to have more advanced handling only for TypeScript CLI atm. |
|
I added input filters, to filter out initial files before the processing starts. |
|
I need some more testing but I noticed somehow that the pipelines are very slow and I'm not sure if it's my logic / chain of multuple sharp commands with toBuffer, etc or if something is slowing it down. Eventually also the amount of file(size) is simply taking that long. |
Checklist
npm run buildandnpm testpassesAffected core subsystem(s)
core & cli
Description of change
Added a test parameter, to allow one CLI execution to handle different files based on conditions.
For example, this allows to use different settings based on filename, etc.
It is a bit old and I'm not sure if I'm feature complete yet, would love to get some feedback and suggestions if I should add something.