diff --git a/flow-server/src/main/java/com/vaadin/flow/server/frontend/NodeUpdater.java b/flow-server/src/main/java/com/vaadin/flow/server/frontend/NodeUpdater.java index 0f95e48ecd0..52d51225759 100644 --- a/flow-server/src/main/java/com/vaadin/flow/server/frontend/NodeUpdater.java +++ b/flow-server/src/main/java/com/vaadin/flow/server/frontend/NodeUpdater.java @@ -385,6 +385,10 @@ private int handleExistingVaadinDep(JsonObject json, String pkg, if (added) { log().debug("Added \"{}\": \"{}\" line.", pkg, version); + } else { + // we made a change to the package json vaadin defaults + // even if we didn't add to the dependencies. + added = !vaadinVersion.isEqualTo(newVersion); } return added ? 1 : 0; } diff --git a/flow-server/src/main/java/com/vaadin/flow/server/frontend/TaskCreatePackageJson.java b/flow-server/src/main/java/com/vaadin/flow/server/frontend/TaskCreatePackageJson.java index 1c434ccc5a6..6044145ddb5 100644 --- a/flow-server/src/main/java/com/vaadin/flow/server/frontend/TaskCreatePackageJson.java +++ b/flow-server/src/main/java/com/vaadin/flow/server/frontend/TaskCreatePackageJson.java @@ -48,7 +48,9 @@ public void execute() { modified = false; JsonObject mainContent = getPackageJson(); modified = updateDefaultDependencies(mainContent); - writePackageFile(mainContent); + if(modified) { + writePackageFile(mainContent); + } } catch (IOException e) { throw new UncheckedIOException(e); } diff --git a/flow-server/src/test/java/com/vaadin/flow/server/frontend/AbstractNodeUpdatePackagesTest.java b/flow-server/src/test/java/com/vaadin/flow/server/frontend/AbstractNodeUpdatePackagesTest.java index 75691b7e93a..a5adc1c4c2d 100644 --- a/flow-server/src/test/java/com/vaadin/flow/server/frontend/AbstractNodeUpdatePackagesTest.java +++ b/flow-server/src/test/java/com/vaadin/flow/server/frontend/AbstractNodeUpdatePackagesTest.java @@ -293,7 +293,7 @@ public void oldVaadinDevDependency_missmatchWithDevDependency_vaadinDependencyIs final String version = packageUpdater.getDefaultDevDependencies() .get(key); json.getObject(VAADIN_DEP_KEY).getObject(DEV_DEPENDENCIES) - .put(key, "4.42.0"); + .put(key, "3.42.0"); json.getObject(DEV_DEPENDENCIES).put(key, version); Files.write(packageJson.toPath(),