use of com.synopsys.integration.detectable.detectables.npm.lockfile.NpmDependencyConverter in project synopsys-detect by blackducksoftware.
the class NpmLockfilePackager method parseAndTransform.
public NpmPackagerResult parseAndTransform(@Nullable String packageJsonText, String lockFileText, List<NameVersion> externalDependencies) {
PackageJson packageJson = Optional.ofNullable(packageJsonText).map(content -> gson.fromJson(content, PackageJson.class)).orElse(null);
PackageLock packageLock = gson.fromJson(lockFileText, PackageLock.class);
NpmDependencyConverter dependencyConverter = new NpmDependencyConverter(externalIdFactory);
NpmProject project = dependencyConverter.convertLockFile(packageLock, packageJson);
DependencyGraph dependencyGraph = graphTransformer.transform(packageLock, project, externalDependencies);
ExternalId projectId = projectIdTransformer.transform(packageJson, packageLock);
CodeLocation codeLocation = new CodeLocation(dependencyGraph, projectId);
return new NpmPackagerResult(projectId.getName(), projectId.getVersion(), codeLocation);
}
Aggregations