Skip to content

Commit

Permalink
chore: Fix Sonar complaint in TaskRunNpmInstall:shouldRunNpmInstall (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Artur- authored May 5, 2021
1 parent c0ce21b commit 872bbf4
Showing 1 changed file with 17 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -302,19 +302,24 @@ private JsonObject readGeneratedDevDependencies(String path)
}

private boolean shouldRunNpmInstall() {
if (packageUpdater.nodeModulesFolder.isDirectory()) {
// Ignore .bin and pnpm folders as those are always installed for
// pnpm execution
File[] installedPackages = packageUpdater.nodeModulesFolder
.listFiles(
(dir, name) -> !ignoredNodeFolders.contains(name));
assert installedPackages != null;
return installedPackages.length == 0
|| (installedPackages.length == 1 && FLOW_NPM_PACKAGE_NAME
.startsWith(installedPackages[0].getName()))
|| (installedPackages.length > 0 && isVaadinHashUpdated());
if (!packageUpdater.nodeModulesFolder.isDirectory()) {
return true;
}
// Ignore .bin and pnpm folders as those are always installed for
// pnpm execution
File[] installedPackages = packageUpdater.nodeModulesFolder
.listFiles((dir, name) -> !ignoredNodeFolders.contains(name));
assert installedPackages != null;
if (installedPackages.length == 0) {
// Nothing installed
return true;
} else if (installedPackages.length == 1 && FLOW_NPM_PACKAGE_NAME
.startsWith(installedPackages[0].getName())) {
// Only flow-frontend installed
return true;
} else {
return isVaadinHashUpdated();
}
return true;
}

private boolean isVaadinHashUpdated() {
Expand Down

0 comments on commit 872bbf4

Please sign in to comment.