Skip to content

Commit

Permalink
fix: Only write package.json if something actually changed (#11848)
Browse files Browse the repository at this point in the history
Flag update of vaadin version as an addition
also and only write the package.json if
thee was an actual change in content.

Fixes #11259
  • Loading branch information
caalador authored and vaadin-bot committed Sep 14, 2021
1 parent e037475 commit 740fe90
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down

0 comments on commit 740fe90

Please sign in to comment.