Rework ComponentDetectionClass
This commit is contained in:
+4
-16
@@ -78,7 +78,7 @@ export default class ComponentDetection {
|
||||
|
||||
// Set the transitive dependencies
|
||||
packages.forEach(async (pkg: ComponentDetectionPackage) => {
|
||||
pkg.toplevelReferrers.forEach(async (referrer: any) => {
|
||||
pkg.topLevelReferrers.forEach(async (referrer: any) => {
|
||||
const referrerPackage = packageCache.lookupPackage(ComponentDetection.makePackageUrl(referrer.packageUrl));
|
||||
if (referrerPackage) {
|
||||
referrerPackage.dependsOn(pkg);
|
||||
@@ -97,7 +97,7 @@ export default class ComponentDetection {
|
||||
const manifest = new Manifest(location.filePath, location.filePath);
|
||||
manifests.push(manifest);
|
||||
}
|
||||
if (pkg.toplevelReferrers.length == 0) {
|
||||
if (pkg.topLevelReferrers.length == 0) {
|
||||
manifests.find((manifest: Manifest) => manifest.file == location.filePath)?.addDirectDependency(pkg, ComponentDetection.getDependencyScope(pkg));
|
||||
} else {
|
||||
manifests.find((manifest: Manifest) => manifest.file == location.filePath)?.addIndirectDependency(pkg, ComponentDetection.getDependencyScope(pkg)); }
|
||||
@@ -153,22 +153,10 @@ export default class ComponentDetection {
|
||||
|
||||
class ComponentDetectionPackage extends Package {
|
||||
|
||||
constructor(packageUrl: string, id: string, isDevelopmentDependency:boolean, topLevelReferrers: [],
|
||||
locationsFoundAt: [], containerDetailIds: [], containerLayerIds: []) {
|
||||
constructor(packageUrl: string, public id: string, public isDevelopmentDependency:boolean, public topLevelReferrers: [],
|
||||
public locationsFoundAt: [], public containerDetailIds: [], public containerLayerIds: []) {
|
||||
super(packageUrl);
|
||||
this.id = id;
|
||||
this.isDevelopmentDependency = isDevelopmentDependency;
|
||||
this.toplevelReferrers = topLevelReferrers;
|
||||
this.locationsFoundAt = locationsFoundAt;
|
||||
this.containerDetailIds = containerDetailIds;
|
||||
this.containerLayerIds = containerLayerIds;
|
||||
}
|
||||
id: string;
|
||||
isDevelopmentDependency: boolean;
|
||||
toplevelReferrers: [];
|
||||
locationsFoundAt: [];
|
||||
containerDetailIds: [];
|
||||
containerLayerIds: [];
|
||||
}
|
||||
|
||||
|
||||
|
||||
-7
@@ -1,7 +0,0 @@
|
||||
import { Manifest } from '@github/dependency-submission-toolkit';
|
||||
export default class CondaParser {
|
||||
static searchFiles(filePath?: string, filePattern?: string): string[];
|
||||
static getManifestsFromEnvironmentFiles(files: string[]): any[];
|
||||
static getManifestFromYaml(yaml: any, filePath: string): Manifest;
|
||||
static getPurlFromDependency(dependency: string, ecosystem: string): string;
|
||||
}
|
||||
+3
-3
@@ -23799,7 +23799,7 @@ class ComponentDetection {
|
||||
}));
|
||||
// Set the transitive dependencies
|
||||
packages.forEach((pkg) => __awaiter(this, void 0, void 0, function* () {
|
||||
pkg.toplevelReferrers.forEach((referrer) => __awaiter(this, void 0, void 0, function* () {
|
||||
pkg.topLevelReferrers.forEach((referrer) => __awaiter(this, void 0, void 0, function* () {
|
||||
const referrerPackage = packageCache.lookupPackage(ComponentDetection.makePackageUrl(referrer.packageUrl));
|
||||
if (referrerPackage) {
|
||||
referrerPackage.dependsOn(pkg);
|
||||
@@ -23817,7 +23817,7 @@ class ComponentDetection {
|
||||
const manifest = new dependency_submission_toolkit_1.Manifest(location.filePath, location.filePath);
|
||||
manifests.push(manifest);
|
||||
}
|
||||
if (pkg.toplevelReferrers.length == 0) {
|
||||
if (pkg.topLevelReferrers.length == 0) {
|
||||
(_a = manifests.find((manifest) => manifest.file == location.filePath)) === null || _a === void 0 ? void 0 : _a.addDirectDependency(pkg, ComponentDetection.getDependencyScope(pkg));
|
||||
}
|
||||
else {
|
||||
@@ -23878,7 +23878,7 @@ class ComponentDetectionPackage extends dependency_submission_toolkit_1.Package
|
||||
super(packageUrl);
|
||||
this.id = id;
|
||||
this.isDevelopmentDependency = isDevelopmentDependency;
|
||||
this.toplevelReferrers = topLevelReferrers;
|
||||
this.topLevelReferrers = topLevelReferrers;
|
||||
this.locationsFoundAt = locationsFoundAt;
|
||||
this.containerDetailIds = containerDetailIds;
|
||||
this.containerLayerIds = containerLayerIds;
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user