gradle-node-plugin
gradle-node-plugin copied to clipboard
Support running Node tools in the Configuration Phase, and multiple tools per task by providing ValueSource implementations
Feature Request: Provide ValueSource implementations for running Node tools
Summary
Currently Gradle Plugin for Node has a 'task based' approach for running Node tools. One task can run one Node tool a single time. This is good for simple projects.
However, I would like to use Node tools in more advanced use cases:
-
Use Node tools before task execution, during the configuration phase.
As part of #81 I proposed a way to make npm install cacheable, but this would require running npm in the configuration phase (to manually add dependencies to the cache). Using a ValueSource would make this trivial.
-
Support executing the same tool multiple times with different arguments or running different tools sequentially in the same task.
Proposal
Provide implementations of ValueSource so users can run node tools on-demand.
The existing task-based execution approach would still work as-is, but to avoid duplication it would be best to re-write the internal implementation to use a 'ValueSource first' approach. The existing tasks will have the same API surface (so there is no change for users), but internally they will use ValueSources.
We can break up the implementation into smaller steps by migrating each Node tool individually.
I'd be happy to make a PR.