Increasing npm logs.
package com.blackducksoftware.integration.hub.detect.bomtool.npm;
import org.codehaus.plexus.util.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import com.blackducksoftware.integration.hub.bdio.graph.DependencyGraph;
import com.blackducksoftware.integration.hub.bdio.graph.builder.LazyExternalIdDependencyGraphBuilder;
@@ -39,6 +41,7 @@ import com.blackducksoftware.integration.hub.detect.workflow.codelocation.Detect
import com.google.gson.Gson;
public class NpmLockfilePackager {
+ private final Logger logger = LoggerFactory.getLogger(NpmLockfilePackager.class);
private final Gson gson;
private final ExternalIdFactory externalIdFactory;
@@ -49,9 +52,13 @@ public class NpmLockfilePackager {
public NpmParseResult parse(final BomToolType bomToolType, final String sourcePath, final String lockFileText, final boolean includeDevDependencies) {
final LazyExternalIdDependencyGraphBuilder lazyBuilder = new LazyExternalIdDependencyGraphBuilder();
+ logger.info("Parsing lock file text: ");
+ logger.debug(lockFileText);
final NpmProject npmProject = gson.fromJson(lockFileText, NpmProject.class);
+ logger.info("Processing project.");
if (npmProject.dependencies != null) {
+ logger.info(String.format("Found %d dependencies.", npmProject.dependencies.size()));
npmProject.dependencies.forEach((name, npmDependency) -> {
if (shouldInclude(npmDependency, includeDevDependencies)) {
final DependencyId dependency = createDependencyId(name, npmDependency.version);
@@ -66,8 +73,10 @@ public class NpmLockfilePackager {
}
}
});
+ } else {
+ logger.info("Lock file did not have a 'dependencies' section.");
}
-
+ logger.info("Finished processing.");
final DependencyGraph graph = lazyBuilder.build();
final ExternalId projectId = externalIdFactory.createNameVersionExternalId(Forge.NPM, npmProject.name, npmProject.version);
final DetectCodeLocation codeLocation = new DetectCodeLocation.Builder(BomToolGroupType.NPM, bomToolType, sourcePath, projectId, graph).build();
