Open boris-petrov opened 11 months ago
Absolutely agree, in hindsight we never should have had node_modules
as an output.
If doNotTrackState
had been available in Gradle when I started we likely never would've added it to outputs, but now it's there and breaking backwards compatibility pains me greatly
Good news though, there exists right now a property nodeModulesOutputFilter
which lets you filter what's actually cached from node_modules
There's also this logic that's currently only implemented for npm
but which I assume pnpm
has something similar to https://github.com/node-gradle/gradle-node-plugin/blob/1ea8bf828630c344ac8fc243e01f61c0beb223f4/src/main/kotlin/com/github/gradle/node/NodeExtension.kt#L112-L125
With all the power of hindsight and user feedback, I believe that is the best possible solution for the general case
Why does a breaking change bother you? Just release a new major version and call it a day. :smile: That's what major versions are for. Software has to move forward.
So I could use this nodeModulesOutputFilter
today for my pnpm
tasks?
Yup, you can also use doNotTrackState
to leave it entirely up to pnpm
As for the change, that's already happening, in likely the next major I'll flip the switch and make it the default
Ideally there'd be something similar in yarn
and pnpm
at that point, but I haven't had the time to investigate them (and the current yarn support is lackluster)
pnpm
is pretty fast. Runningpnpm install
generally takes a second or two when all is up-to-date even when there are many things inpackage.json
.On the other hand, Gradle's caches of the
pnpmInstall
task can take quite a while to compute if the task needs rerunning. I would like to remove that and set these tasks to always execute - i.e. depend onpnpm
itself to be clever and not do anything rather than Gradle (which walks the wholenode_modules
to check for changes).I definitely think this will improve the performance of my build. What do you think?