Don't run if yarn can run and don't cancel if output error
@@ -46,6 +46,9 @@ class NpmBomTool extends BomTool {
@Autowired
NpmCliDependencyFinder cliDependencyFinder
+ @Autowired
+ YarnBomTool yarnBomTool
+
@Override
public BomToolType getBomToolType() {
BomToolType.NPM
@@ -53,6 +56,10 @@ class NpmBomTool extends BomTool {
@Override
public boolean isBomToolApplicable() {
+ if (yarnBomTool.isBomToolApplicable()) {
+ return false;
+ }
+
boolean containsNodeModules = detectFileManager.containsAllFiles(sourcePath, NODE_MODULES)
boolean containsPackageJson = detectFileManager.containsAllFiles(sourcePath, PACKAGE_JSON)
@@ -73,7 +80,11 @@ class NpmBomTool extends BomTool {
File npmLsErrorFile = detectFileManager.createFile(BomToolType.NPM, NpmBomTool.ERROR_FILE)
executableRunner.runExeToFile(npmExePath, npmLsOutputFile, npmLsErrorFile, 'ls', '-json')
- if (npmLsErrorFile.length() == 0) {
+ if (npmLsErrorFile.length() > 0) {
+ logger.warn("Error when running npm ls -json command\n${npmLsErrorFile.text}")
+ }
+
+ if(npmLsOutputFile.length() > 0) {
if (logger.debugEnabled) {
def npmVersion = executableRunner.runExe(npmExePath, '-version')
}
@@ -82,7 +93,7 @@ class NpmBomTool extends BomTool {
return [detectCodeLocation]
} else {
- logger.error("Error when running npm ls -json command\n${npmLsErrorFile.text}")
+ logger.info("No information after running npm ls -json")
}
[]
