node-gradle / gradle-node-plugin

Gradle plugin for integrating NodeJS in your build. :rocket:
Apache License 2.0
603 stars 118 forks source link

Support gradle clean task #219

Open solonovamax opened 2 years ago

solonovamax commented 2 years ago

Currently, when using the gradle node plugin, the following directories are created during the build:

The base gradle plugin provides a task named clean. This task is used to clean up all build time files, as well as anything that doesn't need to be committed to VCS. I would really appreciate if support could be added to delete those files in the clean task.

An alternative to this would be to to provide an additional task: nodeClean, which would delete the node_modules, .gradle/npm, and .gradle/nodejs directories. It would be of the same type as the clean task: the Delete class.

In the base gradle plugin, there exists a task named clean. This is used to delete all build artifacts, etc.

It would be great if support for the clean task could be added, so that it deleted those directories.

deepy commented 2 years ago

This is unfortunately a bit tricky, since for some teams npmInstall is the majority of their build process and adding node_modules to clean would mean that some teams that I know would be running npmInstall all the time.

The folders in .gradle on the other hand is something it could be added to, but again, every clean would mean reinstalling these and normally you wouldn't need to re-install the tools between runs, sort of like how the the java toolchains work in Gradle (although those install in your home folder by default, but writing similar support is on the TODO list).

With that said, if this fits into your build then adding these folders to the clean task is highly recommended!

solonovamax commented 2 years ago

This is unfortunately a bit tricky, since for some teams npmInstall is the majority of their build process and adding node_modules to clean would mean that some teams that I know would be running npmInstall all the time.

I did partially consider this, which is why I proposed adding another task, nodeClean instead of integrating it into the main clean task