guybedford / chomp

'JS Make' - parallel task runner for the frontend ecosystem with a JS extension system.
https://chompbuild.com
Apache License 2.0
138 stars 7 forks source link

Template task reductions #34

Closed guybedford closed 2 years ago

guybedford commented 2 years ago

The npm install task currently initiates a new install operation per package being installed. Ideally we could merge all of these install tasks into one so there is one npm install call despite it being generated from many different templates.

This is a kind of stateful reduction of a template over many invocations. One model to handle this could be to maintain a shared state object as the second argument to all hooks of a given template, with its state maintained successively over each call. Then a new template hook - completion would be able to output a list of tasks on completion with this object as its argument. This way the template could compile shared state as it runs through each template invocation, then finally output a single reduction task in completion (the combined npm install operation in this case).

guybedford commented 2 years ago

The full task reduction batching has been implemented, and the npm install contention issues are now resolved.