This is an automated email from the ASF dual-hosted git repository.
mridulpathak pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git
The following commit(s) were added to refs/heads/trunk by this push:
new f61726762a Fixed: cleanAll deletes the version-controlled
package-lock.json files (OFBIZ-13695)
f61726762a is described below
commit f61726762aff2c2a79c97eef50d039c2e4dd8b77
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 and rest-api's cleanDocAssets 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 [...]
---
.../src/main/groovy/ofbiz-node-conventions.gradle | 19 ++++++++++---------
framework/rest-api/build.gradle | 2 +-
2 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/buildSrc/src/main/groovy/ofbiz-node-conventions.gradle
b/buildSrc/src/main/groovy/ofbiz-node-conventions.gradle
index 66d623279d..274a76808d 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
}
}
diff --git a/framework/rest-api/build.gradle b/framework/rest-api/build.gradle
index ffaaf0ce19..059bd53abc 100644
--- a/framework/rest-api/build.gradle
+++ b/framework/rest-api/build.gradle
@@ -50,7 +50,7 @@ task prepareDocAssets(dependsOn: [copySwaggerUiAssets,
copyRedocAssets]) {
// would delete the entire 'webapp/docs' into-directory, including the HTML
source files.
task cleanDocAssets(type: Delete, group: 'Cleaning',
description: 'Remove generated API documentation assets (swagger-ui
and redoc files)') {
- dependsOn cleanNpmInstall
+ dependsOn cleanNpm
delete fileTree('webapp/docs') {
include '*.js', '*.js.map', '*.css', '*.css.map',
'favicon-*.png', 'oauth2-redirect.html',