@cyclonedx/cdxgen 9.11.3 → 9.11.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +8 -23
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -1391,7 +1391,7 @@ export const createJavaBom = async (path, options) => {
1391
1391
  parentComponent = {
1392
1392
  name: rootProject,
1393
1393
  type: "application",
1394
- ...(retMap.metadata || {})
1394
+ ...retMap.metadata
1395
1395
  };
1396
1396
  const parentPurl = new PackageURL(
1397
1397
  "maven",
@@ -1415,7 +1415,7 @@ export const createJavaBom = async (path, options) => {
1415
1415
  name: rspName,
1416
1416
  type: "application",
1417
1417
  qualifiers: { type: "jar" },
1418
- ...(retMap.metadata || {})
1418
+ ...retMap.metadata
1419
1419
  };
1420
1420
  const rootSubProjectPurl = new PackageURL(
1421
1421
  "maven",
@@ -4280,14 +4280,11 @@ export const createRubyBom = async (path, options) => {
4280
4280
  * @param path to the project
4281
4281
  * @param options Parse options from the cli
4282
4282
  */
4283
- export const createCsharpBom = async (
4284
- path,
4285
- options,
4286
- parentComponent = undefined
4287
- ) => {
4283
+ export const createCsharpBom = async (path, options) => {
4288
4284
  let manifestFiles = [];
4289
4285
  let pkgData = undefined;
4290
4286
  let dependencies = [];
4287
+ let parentComponent = createDefaultParentComponent(path, "nuget", options);
4291
4288
  let csProjFiles = getAllFiles(
4292
4289
  path,
4293
4290
  (options.multiProject ? "**/" : "") + "*.csproj",
@@ -4352,7 +4349,7 @@ export const createCsharpBom = async (
4352
4349
  pkgList = pkgList.concat(dlist);
4353
4350
  }
4354
4351
  if (deps && deps.length) {
4355
- dependencies = dependencies.concat(deps);
4352
+ dependencies = mergeDependencies(dependencies, deps, parentComponent);
4356
4353
  }
4357
4354
  }
4358
4355
  } else if (pkgLockFiles.length) {
@@ -4372,14 +4369,7 @@ export const createCsharpBom = async (
4372
4369
  pkgList = pkgList.concat(dlist);
4373
4370
  }
4374
4371
  if (deps && deps.length) {
4375
- dependencies = dependencies.concat(deps);
4376
- }
4377
- if (!parentComponent) {
4378
- parentComponent = createDefaultParentComponent(
4379
- path,
4380
- options.type,
4381
- options
4382
- );
4372
+ dependencies = mergeDependencies(dependencies, deps, parentComponent);
4383
4373
  }
4384
4374
  // Keep track of the direct dependencies so that we can construct one complete
4385
4375
  // list after processing all lock files
@@ -4443,15 +4433,11 @@ export const createCsharpBom = async (
4443
4433
  pkgList = pkgList.concat(dlist);
4444
4434
  }
4445
4435
  if (deps && deps.length) {
4446
- dependencies = dependencies.concat(deps);
4436
+ dependencies = mergeDependencies(dependencies, deps, parentComponent);
4447
4437
  }
4448
4438
  }
4449
4439
  }
4450
- if (!parentComponent) {
4451
- parentComponent = createDefaultParentComponent(path, options.type, options);
4452
- }
4453
4440
  if (pkgList.length) {
4454
- dependencies = mergeDependencies(dependencies, [], parentComponent);
4455
4441
  pkgList = trimComponents(pkgList, "json");
4456
4442
  // Perform deep analysis using dosai
4457
4443
  if (options.deep) {
@@ -4475,7 +4461,6 @@ export const createCsharpBom = async (
4475
4461
  if (retMap.dependencies && retMap.dependencies.length) {
4476
4462
  dependencies = dependencies.concat(retMap.dependencies);
4477
4463
  }
4478
- dependencies = mergeDependencies(dependencies, [], parentComponent);
4479
4464
  pkgList = trimComponents(pkgList, "json");
4480
4465
  }
4481
4466
  return buildBomNSData(options, pkgList, "nuget", {
@@ -4833,7 +4818,7 @@ export const createMultiXBom = async (pathList, options) => {
4833
4818
  listComponents(options, {}, bomData.bomJson.components, "gem", "xml")
4834
4819
  );
4835
4820
  }
4836
- bomData = await createCsharpBom(path, options, parentComponent);
4821
+ bomData = await createCsharpBom(path, options);
4837
4822
  if (
4838
4823
  bomData &&
4839
4824
  bomData.bomJson &&
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cyclonedx/cdxgen",
3
- "version": "9.11.3",
3
+ "version": "9.11.4",
4
4
  "description": "Creates CycloneDX Software Bill of Materials (SBOM) from source or container image",
5
5
  "homepage": "http://github.com/cyclonedx/cdxgen",
6
6
  "author": "Prabhu Subramanian <prabhu@appthreat.com>",