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).
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 incompletion
(the combined npm install operation in this case).