Closed guybedford closed 2 years ago
Do you have an example of how this would work, and how it is different from the #
way of doing things? I'm not as familiar with Makefiles, so perhaps there is some domain knowledge missing for me here.
@canadaduane the primary benefit of wildcard targets is where you have a tool that isn't invoked per file but is intead generating many files at once.
For example, tsc
will compile a whole lib folder at once. It's target is thus lib/*.js
, a wildcard target.
On the other hand, Babel can compile an individual file at once - babel in.js -o out.js
. As such, Chomp can then take care of watching, invalidating and mtime checking instead of requiring the compiler to do that itself.
So tsc -w
(watch mode) would be used in the wildcard target case? Or how does chomp know when to re-trigger it?
Right so to support tsc
, either use tsc -w
as a long-running task, or have wildcard deps AND wildcard targets, then the full invocation will be retriggered automatically. Sharing the watcher internals are exactly the issue with why these approaches aren't ideal.
This is why I actually recommend swc for TypeScript as its the fastest and can be done per-file. I'm working on integrating the template for this now.
And by wildcard dependencies I mean https://github.com/guybedford/chomp/issues/1.
I'm going to close this for now, and instead reopen it if it becomes an issue in future.
Now that we have multiple target support, it should be possible to define wildcard targets the target an entire glob pattern. The pattern should have no conflicts or crossover with other targets. Then it can be fully iterated and built like any other target.