This is an automated email from the ASF dual-hosted git repository.

mridulpathak pushed a commit to branch release24.09
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git


The following commit(s) were added to refs/heads/release24.09 by this push:
     new 8560a95ef0 Fixed: cleanAll deletes the version-controlled 
package-lock.json files (OFBIZ-13695)
8560a95ef0 is described below

commit 8560a95ef0a4c25a097097ab04cd09c8054a4d90
Author: Mridul Pathak <[email protected]>
AuthorDate: Sun Oct 18 00:10:48 2026 +0530

    Fixed: cleanAll deletes the version-controlled package-lock.json files 
(OFBIZ-13695)
    
    cleanAll depended on cleanNpmInstall, the Gradle clean<TaskName> rule for 
npmInstall, which deletes every output of the task, including 
package-lock.json. Running cleanAll therefore removed the committed lockfiles 
and npm re-resolved all dependencies from scratch, which currently breaks 
npmInstall on release24.09 (npm 10.8.2 fails with "Cannot read properties of 
null (reading 'edgesOut')"). cleanNpm is now a Delete task that removes only 
node_modules, and cleanAll depends on it instea [...]
---
 .../src/main/groovy/ofbiz-node-conventions.gradle     | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/buildSrc/src/main/groovy/ofbiz-node-conventions.gradle 
b/buildSrc/src/main/groovy/ofbiz-node-conventions.gradle
index 26a578404f..5372efea08 100644
--- a/buildSrc/src/main/groovy/ofbiz-node-conventions.gradle
+++ b/buildSrc/src/main/groovy/ofbiz-node-conventions.gradle
@@ -20,8 +20,8 @@
 /*
  * This plugin defines usage of the node-gradle plugin for OFBiz sub-projects.
  *
- * NPM Install (or ci) will be run as a dependency of the classes task. The 
output from NPM Install will be cleaned
- * up as part of the parent project's cleanAll task.
+ * NPM Install (or ci) will be run as a dependency of the classes task. The 
node modules installed by NPM Install will
+ * be cleaned up as part of the parent project's cleanAll task.
  *
  * Sub projects should apply this plugin and then configure the node block 
with the path to the directory containing
  * the package.json file. Example:
@@ -36,7 +36,7 @@
  */
 
 plugins {
-    id 'base'  // Provides the clean<TaskName> rule for the cleanNpmInstall 
task.
+    id 'base'  // Provides the clean<TaskName> rule used by sub-projects (e.g. 
cleanBuildReactApp).
     id 'com.github.node-gradle.node'
 }
 
@@ -56,15 +56,16 @@ if (!project.rootProject.hasProperty('skipNpmInstall')) {
     project.rootProject.tasks.getByName('classes').dependsOn npmInstall
 }
 
-// Task to clean up the output from npmInstall.
-task cleanNpm(group: 'Cleaning', description: 'Clean installed node modules') {
-    dependsOn cleanNpmInstall
+// Task to clean up the node modules installed by npmInstall. The 
clean<TaskName> rule (cleanNpmInstall) is not
+// used because it deletes every output of npmInstall, including the 
version-controlled package-lock.json.
+task cleanNpm(type: Delete, group: 'Cleaning', description: 'Clean installed 
node modules') {
+    delete node.nodeProjectDir.dir('node_modules')
 }
 
-// Hook into the root project's cleanAll task to clean up the output from the
-// npmInstall task.
+// Hook into the root project's cleanAll task to clean up the node modules
+// installed by the npmInstall task.
 project.rootProject.tasks.whenTaskAdded { task ->
     if (task.name == 'cleanAll') {
-        task.dependsOn cleanNpmInstall
+        task.dependsOn cleanNpm
     }
 }

Reply via email to