@cyclonedx/cdxgen 10.9.7 → 10.9.9
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.
- package/README.md +5 -5
- package/analyzer.js +6 -4
- package/docker.js +9 -3
- package/envcontext.js +91 -2
- package/envcontext.test.js +33 -1
- package/evinser.js +3 -3
- package/index.js +3 -2
- package/package.json +1 -1
- package/postgen.js +2 -2
- package/pregen.js +147 -3
- package/types/analyzer.d.ts.map +1 -1
- package/types/docker.d.ts.map +1 -1
- package/types/envcontext.d.ts +21 -1
- package/types/envcontext.d.ts.map +1 -1
- package/types/evinser.d.ts +3 -3
- package/types/evinser.d.ts.map +1 -1
- package/types/index.d.ts +1 -1
- package/types/index.d.ts.map +1 -1
- package/types/postgen.d.ts +2 -2
- package/types/postgen.d.ts.map +1 -1
- package/types/pregen.d.ts +25 -1
- package/types/pregen.d.ts.map +1 -1
- package/types/utils.d.ts +4 -3
- package/types/utils.d.ts.map +1 -1
- package/utils.js +18 -10
- package/utils.test.js +30 -10
- package/validator.js +1 -1
package/README.md
CHANGED
|
@@ -55,7 +55,7 @@ Sections include:
|
|
|
55
55
|
## Installing
|
|
56
56
|
|
|
57
57
|
```shell
|
|
58
|
-
npm install -g @cyclonedx/cdxgen@10.9.
|
|
58
|
+
npm install -g @cyclonedx/cdxgen@10.9.9
|
|
59
59
|
```
|
|
60
60
|
|
|
61
61
|
If you are a [Homebrew][homebrew-homepage] user, you can also install [cdxgen][homebrew-cdxgen] via:
|
|
@@ -75,19 +75,19 @@ You can also use the cdxgen container image with node, deno, or bun runtime vers
|
|
|
75
75
|
The default version uses Node.js 22
|
|
76
76
|
|
|
77
77
|
```bash
|
|
78
|
-
docker run --rm -v /tmp:/tmp -v $(pwd):/app:rw -t ghcr.io/cyclonedx/cdxgen:master -r /app -o /app/bom.json
|
|
78
|
+
docker run --rm -e CDXGEN_DEBUG_MODE=debug -v /tmp:/tmp -v $(pwd):/app:rw -t ghcr.io/cyclonedx/cdxgen:master -r /app -o /app/bom.json
|
|
79
79
|
```
|
|
80
80
|
|
|
81
81
|
To use the deno version, use `ghcr.io/cyclonedx/cdxgen-deno` as the image name.
|
|
82
82
|
|
|
83
83
|
```bash
|
|
84
|
-
docker run --rm -v /tmp:/tmp -v $(pwd):/app:rw -t ghcr.io/cyclonedx/cdxgen-deno:master -r /app -o /app/bom.json
|
|
84
|
+
docker run --rm -e CDXGEN_DEBUG_MODE=debug -v /tmp:/tmp -v $(pwd):/app:rw -t ghcr.io/cyclonedx/cdxgen-deno:master -r /app -o /app/bom.json
|
|
85
85
|
```
|
|
86
86
|
|
|
87
87
|
For the bun version, use `ghcr.io/cyclonedx/cdxgen-bun` as the image name.
|
|
88
88
|
|
|
89
89
|
```bash
|
|
90
|
-
docker run --rm -v /tmp:/tmp -v $(pwd):/app:rw -t ghcr.io/cyclonedx/cdxgen-bun:master -r /app -o /app/bom.json
|
|
90
|
+
docker run --rm -e CDXGEN_DEBUG_MODE=debug -v /tmp:/tmp -v $(pwd):/app:rw -t ghcr.io/cyclonedx/cdxgen-bun:master -r /app -o /app/bom.json
|
|
91
91
|
```
|
|
92
92
|
|
|
93
93
|
In deno applications, cdxgen could be directly imported without any conversion. Please see the section on [integration as a library](#integration-as-library)
|
|
@@ -403,7 +403,7 @@ To generate test public/private key pairs, you can run cdxgen by passing the arg
|
|
|
403
403
|
Use the bundled `cdx-verify` command, which supports verifying a single signature added at the bom level.
|
|
404
404
|
|
|
405
405
|
```shell
|
|
406
|
-
npm install -g @cyclonedx/cdxgen@10.9.
|
|
406
|
+
npm install -g @cyclonedx/cdxgen@10.9.9
|
|
407
407
|
cdx-verify -i bom.json --public-key public.key
|
|
408
408
|
```
|
|
409
409
|
|
package/analyzer.js
CHANGED
|
@@ -73,7 +73,9 @@ const getAllFiles = (deep, dir, extn, files, result, regex) => {
|
|
|
73
73
|
result,
|
|
74
74
|
regex,
|
|
75
75
|
);
|
|
76
|
-
} catch (error) {
|
|
76
|
+
} catch (error) {
|
|
77
|
+
// ignore
|
|
78
|
+
}
|
|
77
79
|
} else {
|
|
78
80
|
if (regex.test(file)) {
|
|
79
81
|
result.push(file);
|
|
@@ -197,16 +199,16 @@ const fileToParseableCode = (file) => {
|
|
|
197
199
|
)
|
|
198
200
|
.replace(
|
|
199
201
|
vueBindRegex,
|
|
200
|
-
(
|
|
202
|
+
(_match, grA, grB, grC) =>
|
|
201
203
|
grA.replaceAll(/\S/g, " ") + grB + grC.replaceAll(/\S/g, " "),
|
|
202
204
|
)
|
|
203
205
|
.replace(
|
|
204
206
|
vuePropRegex,
|
|
205
|
-
(
|
|
207
|
+
(_match, grA, grB) => ` ${grA.replace(/[.:@]/g, " ")}${grB}`,
|
|
206
208
|
)
|
|
207
209
|
.replace(
|
|
208
210
|
vueTemplateRegex,
|
|
209
|
-
(
|
|
211
|
+
(_match, grA, grB, grC) =>
|
|
210
212
|
grA + grB.replaceAll("{{", "{ ").replaceAll("}}", " }") + grC,
|
|
211
213
|
);
|
|
212
214
|
}
|
package/docker.js
CHANGED
|
@@ -760,7 +760,9 @@ export const extractTar = async (fullImageName, dir) => {
|
|
|
760
760
|
strict: true,
|
|
761
761
|
C: dir,
|
|
762
762
|
portable: true,
|
|
763
|
-
onwarn: () => {
|
|
763
|
+
onwarn: () => {
|
|
764
|
+
// ignore
|
|
765
|
+
},
|
|
764
766
|
filter: (path, entry) => {
|
|
765
767
|
// Some files are known to cause issues with extract
|
|
766
768
|
if (
|
|
@@ -1078,7 +1080,9 @@ export const exportImage = async (fullImageName) => {
|
|
|
1078
1080
|
strict: true,
|
|
1079
1081
|
C: tempDir,
|
|
1080
1082
|
portable: true,
|
|
1081
|
-
onwarn: () => {
|
|
1083
|
+
onwarn: () => {
|
|
1084
|
+
// ignore
|
|
1085
|
+
},
|
|
1082
1086
|
}),
|
|
1083
1087
|
);
|
|
1084
1088
|
} catch (err) {
|
|
@@ -1095,7 +1099,9 @@ export const exportImage = async (fullImageName) => {
|
|
|
1095
1099
|
strict: true,
|
|
1096
1100
|
C: tempDir,
|
|
1097
1101
|
portable: true,
|
|
1098
|
-
onwarn: () => {
|
|
1102
|
+
onwarn: () => {
|
|
1103
|
+
// ignore
|
|
1104
|
+
},
|
|
1099
1105
|
}),
|
|
1100
1106
|
);
|
|
1101
1107
|
} catch (err) {
|
package/envcontext.js
CHANGED
|
@@ -2,7 +2,7 @@ import { Buffer } from "node:buffer";
|
|
|
2
2
|
import { spawnSync } from "node:child_process";
|
|
3
3
|
import { existsSync } from "node:fs";
|
|
4
4
|
import { homedir } from "node:os";
|
|
5
|
-
import { delimiter, join } from "node:path";
|
|
5
|
+
import { delimiter, dirname, join } from "node:path";
|
|
6
6
|
import process from "node:process";
|
|
7
7
|
import {
|
|
8
8
|
CARGO_CMD,
|
|
@@ -57,7 +57,7 @@ export function getOriginUrl(dir) {
|
|
|
57
57
|
*
|
|
58
58
|
* @returns Output from git config or undefined
|
|
59
59
|
*/
|
|
60
|
-
export function getBranch(
|
|
60
|
+
export function getBranch(_configKey, dir) {
|
|
61
61
|
return execGitCommand(dir, ["rev-parse", "--abbrev-ref", "HEAD"]);
|
|
62
62
|
}
|
|
63
63
|
|
|
@@ -362,6 +362,21 @@ export function isSdkmanAvailable() {
|
|
|
362
362
|
return isSdkmanSetup;
|
|
363
363
|
}
|
|
364
364
|
|
|
365
|
+
/**
|
|
366
|
+
* Method to check if nvm is available.
|
|
367
|
+
*/
|
|
368
|
+
export function isNvmAvailable() {
|
|
369
|
+
let isNvmSetup = false;
|
|
370
|
+
const result = spawnSync(process.env.SHELL || "bash", ["-i", "-c", "nvm"], {
|
|
371
|
+
encoding: "utf-8",
|
|
372
|
+
shell: process.env.SHELL || true,
|
|
373
|
+
});
|
|
374
|
+
if (result.status === 0) {
|
|
375
|
+
isNvmSetup = true;
|
|
376
|
+
}
|
|
377
|
+
return isNvmSetup;
|
|
378
|
+
}
|
|
379
|
+
|
|
365
380
|
/**
|
|
366
381
|
* Method to check if a given sdkman tool is installed and available.
|
|
367
382
|
*
|
|
@@ -491,6 +506,80 @@ export function installSdkmanTool(toolType, toolName) {
|
|
|
491
506
|
return true;
|
|
492
507
|
}
|
|
493
508
|
|
|
509
|
+
/**
|
|
510
|
+
* Method to check if a given nvm tool is installed and available.
|
|
511
|
+
*
|
|
512
|
+
* @param {String} toolName Tool name with version. Eg: 22.0.2-tem
|
|
513
|
+
*
|
|
514
|
+
* @returns {String} path of nvm if present, otherwise false
|
|
515
|
+
*/
|
|
516
|
+
export function getNvmToolDirectory(toolName) {
|
|
517
|
+
const resultWhichNode = spawnSync(
|
|
518
|
+
process.env.SHELL || "bash",
|
|
519
|
+
["-i", "-c", `"nvm which ${toolName}"`],
|
|
520
|
+
{
|
|
521
|
+
encoding: "utf-8",
|
|
522
|
+
shell: process.env.SHELL || true,
|
|
523
|
+
},
|
|
524
|
+
);
|
|
525
|
+
if (DEBUG_MODE) {
|
|
526
|
+
if (console.stdout) {
|
|
527
|
+
console.log(resultWhichNode.stdout);
|
|
528
|
+
}
|
|
529
|
+
if (console.stderr) {
|
|
530
|
+
console.log(resultWhichNode.stderr);
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
if (resultWhichNode.status !== 0 || resultWhichNode.stderr) {
|
|
534
|
+
return;
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
return dirname(resultWhichNode.stdout.trim());
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
/**
|
|
541
|
+
* Method to return nvm tool path
|
|
542
|
+
*
|
|
543
|
+
* @param {String} toolVersion Tool name with version. Eg: 22.0.2-tem
|
|
544
|
+
*
|
|
545
|
+
* @returns {String} path of the tool if not found installs and then returns paths. false if encounters an error.
|
|
546
|
+
*/
|
|
547
|
+
export function getOrInstallNvmTool(toolVersion) {
|
|
548
|
+
const nvmNodePath = getNvmToolDirectory(toolVersion);
|
|
549
|
+
if (!nvmNodePath) {
|
|
550
|
+
// nvm couldn't directly use toolName so maybe needs to be installed
|
|
551
|
+
const resultInstall = spawnSync(
|
|
552
|
+
process.env.SHELL || "bash",
|
|
553
|
+
["-i", "-c", `"nvm install ${toolVersion}"`],
|
|
554
|
+
{
|
|
555
|
+
encoding: "utf-8",
|
|
556
|
+
shell: process.env.SHELL || true,
|
|
557
|
+
},
|
|
558
|
+
);
|
|
559
|
+
|
|
560
|
+
if (DEBUG_MODE) {
|
|
561
|
+
if (console.stdout) {
|
|
562
|
+
console.log(resultInstall.stdout);
|
|
563
|
+
}
|
|
564
|
+
if (console.stderr) {
|
|
565
|
+
console.log(resultInstall.stderr);
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
if (resultInstall.status !== 0) {
|
|
570
|
+
// There was some problem install the tool
|
|
571
|
+
// output has already been printed out
|
|
572
|
+
return false;
|
|
573
|
+
}
|
|
574
|
+
const nvmNodePath = getNvmToolDirectory(toolVersion);
|
|
575
|
+
if (nvmNodePath) {
|
|
576
|
+
return nvmNodePath;
|
|
577
|
+
}
|
|
578
|
+
return false;
|
|
579
|
+
}
|
|
580
|
+
return nvmNodePath;
|
|
581
|
+
}
|
|
582
|
+
|
|
494
583
|
/**
|
|
495
584
|
* Retrieve sdkman tool full name
|
|
496
585
|
*/
|
package/envcontext.test.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { spawnSync } from "node:child_process";
|
|
1
2
|
import process from "node:process";
|
|
2
3
|
import { expect, test } from "@jest/globals";
|
|
3
|
-
|
|
4
4
|
import {
|
|
5
5
|
collectDotnetInfo,
|
|
6
6
|
collectGccInfo,
|
|
@@ -10,7 +10,10 @@ import {
|
|
|
10
10
|
collectPythonInfo,
|
|
11
11
|
collectRustInfo,
|
|
12
12
|
getBranch,
|
|
13
|
+
getNvmToolDirectory,
|
|
14
|
+
getOrInstallNvmTool,
|
|
13
15
|
getOriginUrl,
|
|
16
|
+
isNvmAvailable,
|
|
14
17
|
isSdkmanAvailable,
|
|
15
18
|
isSdkmanToolAvailable,
|
|
16
19
|
listFiles,
|
|
@@ -39,3 +42,32 @@ test("sdkman tests", () => {
|
|
|
39
42
|
expect(isSdkmanToolAvailable("java", "22.0.1-tem")).toBeTruthy();
|
|
40
43
|
}
|
|
41
44
|
});
|
|
45
|
+
|
|
46
|
+
test("nvm tests", () => {
|
|
47
|
+
if (process.env?.NVM_DIR) {
|
|
48
|
+
if (isNvmAvailable()) {
|
|
49
|
+
// try to remove nodejs 14 before testing below
|
|
50
|
+
const removeNode14 = spawnSync(
|
|
51
|
+
process.env.SHELL || "bash",
|
|
52
|
+
["-i", "-c", `"nvm uninstall 14"`],
|
|
53
|
+
{
|
|
54
|
+
encoding: "utf-8",
|
|
55
|
+
shell: process.env.SHELL || true,
|
|
56
|
+
},
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
// expected to be run in CircleCi, where node version is 22.8.0
|
|
60
|
+
// as defined in our Dockerfile
|
|
61
|
+
expect(getNvmToolDirectory(22)).toBeTruthy();
|
|
62
|
+
expect(getNvmToolDirectory(14)).toBeFalsy();
|
|
63
|
+
|
|
64
|
+
// now we install nvm tool for a specific verison
|
|
65
|
+
expect(getOrInstallNvmTool(14)).toBeTruthy();
|
|
66
|
+
expect(getNvmToolDirectory(14)).toBeTruthy();
|
|
67
|
+
} else {
|
|
68
|
+
// if this test is failing it would be due to an error in isNvmAvailable()
|
|
69
|
+
expect(getNvmToolDirectory(22)).toBeFalsy();
|
|
70
|
+
expect(getOrInstallNvmTool(14)).toBeFalsy();
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
});
|
package/evinser.js
CHANGED
|
@@ -915,7 +915,7 @@ export const detectServicesFromUDT = (
|
|
|
915
915
|
}
|
|
916
916
|
};
|
|
917
917
|
|
|
918
|
-
export const constructServiceName = (
|
|
918
|
+
export const constructServiceName = (_language, slice) => {
|
|
919
919
|
let serviceName = "service";
|
|
920
920
|
if (slice?.fullName) {
|
|
921
921
|
serviceName = slice.fullName.split(":")[0].replace(/\./g, "-");
|
|
@@ -1149,7 +1149,7 @@ export const collectDataFlowFrames = async (
|
|
|
1149
1149
|
userDefinedTypesMap,
|
|
1150
1150
|
dataFlowSlice,
|
|
1151
1151
|
dbObjMap,
|
|
1152
|
-
|
|
1152
|
+
_purlLocationMap,
|
|
1153
1153
|
purlImportsMap,
|
|
1154
1154
|
) => {
|
|
1155
1155
|
const nodes = dataFlowSlice?.graph?.nodes || [];
|
|
@@ -1268,7 +1268,7 @@ export const collectDataFlowFrames = async (
|
|
|
1268
1268
|
* @param {string} language Application language
|
|
1269
1269
|
* @param {Object} reachablesSlice Reachables slice object from atom
|
|
1270
1270
|
*/
|
|
1271
|
-
export const collectReachableFrames = (
|
|
1271
|
+
export const collectReachableFrames = (_language, reachablesSlice) => {
|
|
1272
1272
|
const reachableNodes = reachablesSlice?.reachables || [];
|
|
1273
1273
|
// purl key and an array of frames array
|
|
1274
1274
|
// CycloneDX 1.5 currently accepts only 1 frame as evidence
|
package/index.js
CHANGED
|
@@ -55,6 +55,7 @@ import {
|
|
|
55
55
|
executeParallelGradleProperties,
|
|
56
56
|
extractJarArchive,
|
|
57
57
|
frameworksList,
|
|
58
|
+
generatePixiLockFile,
|
|
58
59
|
getAllFiles,
|
|
59
60
|
getCppModules,
|
|
60
61
|
getGradleCommand,
|
|
@@ -3187,7 +3188,7 @@ export async function createPythonBom(path, options) {
|
|
|
3187
3188
|
if (
|
|
3188
3189
|
isFeatureEnabled(options, "safe-pip-install") &&
|
|
3189
3190
|
pkgList.length &&
|
|
3190
|
-
isPartialTree(dependencies)
|
|
3191
|
+
isPartialTree(dependencies, pkgList.length)
|
|
3191
3192
|
) {
|
|
3192
3193
|
// Trim the current package list first
|
|
3193
3194
|
pkgList = trimComponents(pkgList);
|
|
@@ -4268,7 +4269,7 @@ export function createCloudBuildBom(path, options) {
|
|
|
4268
4269
|
* @param {string} path to the project
|
|
4269
4270
|
* @param {Object} options Parse options from the cli
|
|
4270
4271
|
*/
|
|
4271
|
-
export function createOSBom(
|
|
4272
|
+
export function createOSBom(_path, options) {
|
|
4272
4273
|
console.warn(
|
|
4273
4274
|
"About to generate OBOM for the current OS installation. This will take several minutes ...",
|
|
4274
4275
|
);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cyclonedx/cdxgen",
|
|
3
|
-
"version": "10.9.
|
|
3
|
+
"version": "10.9.9",
|
|
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>",
|
package/postgen.js
CHANGED
|
@@ -37,7 +37,7 @@ export function postProcess(bomNSData, options) {
|
|
|
37
37
|
*
|
|
38
38
|
* @returns {Object} Filtered BOM JSON
|
|
39
39
|
*/
|
|
40
|
-
export function applyMetadata(bomJson,
|
|
40
|
+
export function applyMetadata(bomJson, _options) {
|
|
41
41
|
if (!bomJson?.components) {
|
|
42
42
|
return bomJson;
|
|
43
43
|
}
|
|
@@ -265,7 +265,7 @@ export function filterBom(bomJson, options) {
|
|
|
265
265
|
/**
|
|
266
266
|
* Clean up
|
|
267
267
|
*/
|
|
268
|
-
export function cleanupEnv(
|
|
268
|
+
export function cleanupEnv(_options) {
|
|
269
269
|
if (process.env?.PIP_TARGET?.startsWith(tmpdir())) {
|
|
270
270
|
rmSync(process.env.PIP_TARGET, { recursive: true, force: true });
|
|
271
271
|
}
|
package/pregen.js
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { spawnSync } from "node:child_process";
|
|
2
|
+
import { mkdtempSync, readdirSync } from "node:fs";
|
|
2
3
|
import { arch, platform, tmpdir } from "node:os";
|
|
3
|
-
import { join } from "node:path";
|
|
4
|
+
import { delimiter, join } from "node:path";
|
|
4
5
|
import {
|
|
5
6
|
SDKMAN_TOOL_ALIASES,
|
|
7
|
+
getOrInstallNvmTool,
|
|
6
8
|
installSdkmanTool,
|
|
9
|
+
isNvmAvailable,
|
|
7
10
|
isSdkmanAvailable,
|
|
8
11
|
} from "./envcontext.js";
|
|
9
12
|
import { DEBUG_MODE, hasAnyProjectType } from "./utils.js";
|
|
@@ -26,6 +29,7 @@ export function prepareEnv(filePath, options) {
|
|
|
26
29
|
}
|
|
27
30
|
// Check the pre-requisites for python
|
|
28
31
|
preparePythonEnv(filePath, options);
|
|
32
|
+
prepareNodeEnv(filePath, options);
|
|
29
33
|
}
|
|
30
34
|
|
|
31
35
|
/**
|
|
@@ -50,7 +54,7 @@ export function prepareSdkmanBuild(projectType) {
|
|
|
50
54
|
* @param {String} filePath Path
|
|
51
55
|
* @param {Object} options CLI Options
|
|
52
56
|
*/
|
|
53
|
-
export function preparePythonEnv(
|
|
57
|
+
export function preparePythonEnv(_filePath, options) {
|
|
54
58
|
if (hasAnyProjectType("python", options, false)) {
|
|
55
59
|
if (arch() !== "x64") {
|
|
56
60
|
console.log(
|
|
@@ -91,3 +95,143 @@ export function preparePythonEnv(filePath, options) {
|
|
|
91
95
|
}
|
|
92
96
|
}
|
|
93
97
|
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Method to check and prepare the environment for node
|
|
101
|
+
*
|
|
102
|
+
* @param {String} filePath Path
|
|
103
|
+
* @param {Object} options CLI Options
|
|
104
|
+
*/
|
|
105
|
+
export function prepareNodeEnv(filePath, options) {
|
|
106
|
+
// check tool for windows
|
|
107
|
+
for (const pt of options.projectType) {
|
|
108
|
+
const nodeVersion = pt.replace(/\D/g, "");
|
|
109
|
+
if (
|
|
110
|
+
pt.startsWith("nodejs") &&
|
|
111
|
+
nodeVersion &&
|
|
112
|
+
!process.env.NODE_INSTALL_ARGS
|
|
113
|
+
) {
|
|
114
|
+
if (!isNvmAvailable()) {
|
|
115
|
+
if (process.env.NVM_DIR) {
|
|
116
|
+
// for scenarios where nvm is not present, but
|
|
117
|
+
// we have $NVM_DIR
|
|
118
|
+
// custom logic to find nvmNodePath
|
|
119
|
+
let nvmNodePath;
|
|
120
|
+
const possibleNodeDir = join(process.env.NVM_DIR, "versions", "node");
|
|
121
|
+
|
|
122
|
+
if (!tryLoadNvmAndInstallTool(nodeVersion)) {
|
|
123
|
+
console.log(
|
|
124
|
+
`Could not install Nodejs${nodeVersion}. There is a problem with loading nvm from ${process.env.NVM_DIR}`,
|
|
125
|
+
);
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
const nodeVersionArray = readdirSync(possibleNodeDir, {
|
|
130
|
+
withFileTypes: true,
|
|
131
|
+
});
|
|
132
|
+
const nodeRe = new RegExp(`^v${nodeVersion}.`);
|
|
133
|
+
for (const nodeVersionsIter of nodeVersionArray) {
|
|
134
|
+
const fullPath = join(possibleNodeDir, nodeVersionsIter.name);
|
|
135
|
+
if (
|
|
136
|
+
nodeVersionsIter.isDirectory() &&
|
|
137
|
+
nodeRe.test(nodeVersionsIter.name)
|
|
138
|
+
) {
|
|
139
|
+
nvmNodePath = join(fullPath, "bin");
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
if (nvmNodePath) {
|
|
143
|
+
doNpmInstall(filePath, nvmNodePath);
|
|
144
|
+
} else {
|
|
145
|
+
console.log(
|
|
146
|
+
`"node version ${nodeVersion} was not found. Please install it with 'nvm install ${nodeVersion}"`,
|
|
147
|
+
);
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
} else {
|
|
151
|
+
console.log(
|
|
152
|
+
"Install nvm by following the instructions at https://github.com/nvm-sh/nvm",
|
|
153
|
+
);
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
// set path instead of nvm use
|
|
158
|
+
const nvmNodePath = getOrInstallNvmTool(nodeVersion);
|
|
159
|
+
doNpmInstall(filePath, nvmNodePath);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* If NVM_DIR is in path, however nvm command is not loaded.
|
|
166
|
+
* it is possible that required nodeVersion is not installed.
|
|
167
|
+
* This function loads nvm and install the nodeVersion
|
|
168
|
+
*
|
|
169
|
+
* @param {String} nodeVersion required version number
|
|
170
|
+
*
|
|
171
|
+
* @returns {Boolean} true if successful, otherwise false
|
|
172
|
+
*/
|
|
173
|
+
export function tryLoadNvmAndInstallTool(nodeVersion) {
|
|
174
|
+
const NVM_DIR = process.env.NVM_DIR;
|
|
175
|
+
|
|
176
|
+
const command = `
|
|
177
|
+
if [ -f ${NVM_DIR}/nvm.sh ]; then
|
|
178
|
+
. ${NVM_DIR}/nvm.sh
|
|
179
|
+
nvm install ${nodeVersion}
|
|
180
|
+
else
|
|
181
|
+
echo "NVM script not found at ${NVM_DIR}/nvm.sh"
|
|
182
|
+
exit 1
|
|
183
|
+
fi
|
|
184
|
+
`;
|
|
185
|
+
|
|
186
|
+
const result = spawnSync(process.env.SHELL || "bash", ["-c", command], {
|
|
187
|
+
encoding: "utf-8",
|
|
188
|
+
shell: process.env.SHELL || true,
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
return result.status === 0;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* This method installs and create package-lock.json
|
|
196
|
+
*
|
|
197
|
+
* @param {String} filePath Path
|
|
198
|
+
* @param {String} nvmNodePath Path to node version in nvm
|
|
199
|
+
*/
|
|
200
|
+
export function doNpmInstall(filePath, nvmNodePath) {
|
|
201
|
+
// we do not install if INSTALL_ARGS set false
|
|
202
|
+
if (process.env.NODE_INSTALL_ARGS === false) {
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
const newPath = `${nvmNodePath}${delimiter}${process.env.PATH}`;
|
|
207
|
+
|
|
208
|
+
const resultNpmInstall = spawnSync(
|
|
209
|
+
process.env.SHELL || "bash",
|
|
210
|
+
[
|
|
211
|
+
"-i",
|
|
212
|
+
"-c",
|
|
213
|
+
`export PATH='${nvmNodePath}${delimiter}$PATH' && npm install --package-lock-only`,
|
|
214
|
+
],
|
|
215
|
+
{
|
|
216
|
+
encoding: "utf-8",
|
|
217
|
+
shell: process.env.SHELL || true,
|
|
218
|
+
cwd: filePath,
|
|
219
|
+
env: {
|
|
220
|
+
...process.env,
|
|
221
|
+
PATH: newPath,
|
|
222
|
+
},
|
|
223
|
+
},
|
|
224
|
+
);
|
|
225
|
+
|
|
226
|
+
if (resultNpmInstall.status !== 0 || resultNpmInstall.stderr) {
|
|
227
|
+
// There was some problem with NpmInstall
|
|
228
|
+
if (DEBUG_MODE) {
|
|
229
|
+
if (console.stdout) {
|
|
230
|
+
console.log(resultNpmInstall.stdout);
|
|
231
|
+
}
|
|
232
|
+
if (console.stderr) {
|
|
233
|
+
console.log(resultNpmInstall.stderr);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
}
|
package/types/analyzer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analyzer.d.ts","sourceRoot":"","sources":["../analyzer.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"analyzer.d.ts","sourceRoot":"","sources":["../analyzer.js"],"names":[],"mappings":"AAkSO;;;GAkBN"}
|
package/types/docker.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docker.d.ts","sourceRoot":"","sources":["../docker.js"],"names":[],"mappings":"AAoDA;;GAEG;AACH,4CA6CC;AAxED,4BAA6C;AAC7C,8CAA+C;AAkFxC,iCAHI,MAAM,WACN,MAAM,iDAehB;AAqBM,6DAmBN;AAgLM,4EAwGN;AAEM,oFAwBN;AAUM;;;;;;;;EAwEN;AAsBM,2DA8KN;AAEM,
|
|
1
|
+
{"version":3,"file":"docker.d.ts","sourceRoot":"","sources":["../docker.js"],"names":[],"mappings":"AAoDA;;GAEG;AACH,4CA6CC;AAxED,4BAA6C;AAC7C,8CAA+C;AAkFxC,iCAHI,MAAM,WACN,MAAM,iDAehB;AAqBM,6DAmBN;AAgLM,4EAwGN;AAEM,oFAwBN;AAUM;;;;;;;;EAwEN;AAsBM,2DA8KN;AAEM,2EAwFN;AAMM;;;;;;;;;;;;;GAqDN;AAEM;;;;;;;GAqGN;AAMM,8DAqIN;AAKM,4EAmGN;AAEM,+EAMN;AAEM,4EAyCN;AAEM,iFA0BN"}
|
package/types/envcontext.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ export function getOriginUrl(dir: string): any;
|
|
|
20
20
|
*
|
|
21
21
|
* @returns Output from git config or undefined
|
|
22
22
|
*/
|
|
23
|
-
export function getBranch(
|
|
23
|
+
export function getBranch(_configKey: any, dir: string): any;
|
|
24
24
|
/**
|
|
25
25
|
* Retrieves the tree and parent hash for a git repo
|
|
26
26
|
* @param {string} dir repo directory
|
|
@@ -145,6 +145,10 @@ export function collectEnvInfo(dir: any): {
|
|
|
145
145
|
* Method to check if sdkman is available.
|
|
146
146
|
*/
|
|
147
147
|
export function isSdkmanAvailable(): boolean;
|
|
148
|
+
/**
|
|
149
|
+
* Method to check if nvm is available.
|
|
150
|
+
*/
|
|
151
|
+
export function isNvmAvailable(): boolean;
|
|
148
152
|
/**
|
|
149
153
|
* Method to check if a given sdkman tool is installed and available.
|
|
150
154
|
*
|
|
@@ -163,6 +167,22 @@ export function isSdkmanToolAvailable(toolType: string, toolName: string): boole
|
|
|
163
167
|
* @returns {Boolean} true if the tool is available. false otherwise.
|
|
164
168
|
*/
|
|
165
169
|
export function installSdkmanTool(toolType: string, toolName: string): boolean;
|
|
170
|
+
/**
|
|
171
|
+
* Method to check if a given nvm tool is installed and available.
|
|
172
|
+
*
|
|
173
|
+
* @param {String} toolName Tool name with version. Eg: 22.0.2-tem
|
|
174
|
+
*
|
|
175
|
+
* @returns {String} path of nvm if present, otherwise false
|
|
176
|
+
*/
|
|
177
|
+
export function getNvmToolDirectory(toolName: string): string;
|
|
178
|
+
/**
|
|
179
|
+
* Method to return nvm tool path
|
|
180
|
+
*
|
|
181
|
+
* @param {String} toolVersion Tool name with version. Eg: 22.0.2-tem
|
|
182
|
+
*
|
|
183
|
+
* @returns {String} path of the tool if not found installs and then returns paths. false if encounters an error.
|
|
184
|
+
*/
|
|
185
|
+
export function getOrInstallNvmTool(toolVersion: string): string;
|
|
166
186
|
export const GIT_COMMAND: any;
|
|
167
187
|
export namespace SDKMAN_TOOL_ALIASES {
|
|
168
188
|
let java8: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"envcontext.d.ts","sourceRoot":"","sources":["../envcontext.js"],"names":[],"mappings":"AA+BA;;;;;;GAMG;AACH,wCALW,MAAM,OACN,MAAM,OAMhB;AAED;;;;;GAKG;AACH,kCAJW,MAAM,OAMhB;AAED;;;;;;GAMG;AACH,
|
|
1
|
+
{"version":3,"file":"envcontext.d.ts","sourceRoot":"","sources":["../envcontext.js"],"names":[],"mappings":"AA+BA;;;;;;GAMG;AACH,wCALW,MAAM,OACN,MAAM,OAMhB;AAED;;;;;GAKG;AACH,kCAJW,MAAM,OAMhB;AAED;;;;;;GAMG;AACH,gDAJW,MAAM,OAMhB;AAED;;;;;GAKG;AACH,mCAJW,MAAM,MAsBhB;AAED;;;;;GAKG;AACH,+BAJW,MAAM,SAgChB;AAED;;;;;;;GAOG;AACH,oCALW,MAAM,oBAOhB;AAED;;;;;GAKG;AACH,qCAHW,MAAM;;;;;;;;;EAsBhB;AAED;;;;;GAKG;AACH,uCAHW,MAAM;;;;;EAgBhB;AAED;;;;;GAKG;AACH,uCAHW,MAAM;;;;;EAgBhB;AAED;;;;;GAKG;AACH,qCAHW,MAAM;;;;;EAkBhB;AAED;;;;;GAKG;AACH,oCAHW,MAAM;;;;;EAehB;AAED;;;;;GAKG;AACH,qCAHW,MAAM;;;;;EAehB;AAED;;;;;GAKG;AACH,mCAHW,MAAM;;;;EAahB;AAED;;;;;;;;;IA+BC;AA0BD;;GAEG;AACH,6CAeC;AAED;;GAEG;AACH,0CAUC;AAED;;;;;;;GAOG;AACH,mFAqBC;AAED;;;;;;;GAOG;AACH,+EAwFC;AAED;;;;;;GAMG;AACH,8DAsBC;AAED;;;;;;GAMG;AACH,iEAkCC;AAhjBD,8BAAwD"}
|
package/types/evinser.d.ts
CHANGED
|
@@ -581,11 +581,11 @@ export function parseSliceUsages(language: string, userDefinedTypesMap: any, sli
|
|
|
581
581
|
export function isFilterableType(language: any, userDefinedTypesMap: any, typeFullName: any): boolean;
|
|
582
582
|
export function detectServicesFromUsages(language: string, slice: any, servicesMap?: any): any[];
|
|
583
583
|
export function detectServicesFromUDT(language: string, userDefinedTypes: any[], servicesMap: any): void;
|
|
584
|
-
export function constructServiceName(
|
|
584
|
+
export function constructServiceName(_language: any, slice: any): string;
|
|
585
585
|
export function extractEndpoints(language: any, code: any): any;
|
|
586
586
|
export function createEvinseFile(sliceArtefacts: any, options: any): any;
|
|
587
|
-
export function collectDataFlowFrames(language: string, userDefinedTypesMap: any, dataFlowSlice: any, dbObjMap: any,
|
|
588
|
-
export function collectReachableFrames(
|
|
587
|
+
export function collectDataFlowFrames(language: string, userDefinedTypesMap: any, dataFlowSlice: any, dbObjMap: any, _purlLocationMap: any, purlImportsMap: any): Promise<{}>;
|
|
588
|
+
export function collectReachableFrames(_language: any, reachablesSlice: any): {
|
|
589
589
|
dataFlowFrames: {};
|
|
590
590
|
cryptoComponents: {
|
|
591
591
|
type: string;
|
package/types/evinser.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"evinser.d.ts","sourceRoot":"","sources":["../evinser.js"],"names":[],"mappings":"AA0BO;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"evinser.d.ts","sourceRoot":"","sources":["../evinser.js"],"names":[],"mappings":"AA0BO;;;;;;;;;;;;;qBAs4CgxlD,CAAC;qBAAgB,CAAC;;;qBAA4F,CAAC;qBAAgB,CAAC;;;qBAAkE,CAAC;qBAAgB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wGAAr3wC,QAAa;;;;;;;;;;;;;;sHAAq3M,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BN;AAQM;;;;;;;;;;;;GAkHN;AAEM,2JA4CN;AAcM,2CARI,MAAM,iHAkNhB;AAEM,sGAqEN;AASM,mDAJI,MAAM,wCA6DhB;AASM,gDAJI,MAAM,mDA8DhB;AAEM,yEAWN;AAEM,gEAmDN;AASM,yEA+IN;AAaM,gDAPI,MAAM,wHAyHhB;AAUM;;;;;;;;;;;;;EAwFN;AAQM,kDAaN;AAQM,2CAHI,MAAM,UAKhB;AAEM,oFAyCN"}
|
package/types/index.d.ts
CHANGED
|
@@ -141,7 +141,7 @@ export function createCloudBuildBom(path: string, options: any): any;
|
|
|
141
141
|
* @param {string} path to the project
|
|
142
142
|
* @param {Object} options Parse options from the cli
|
|
143
143
|
*/
|
|
144
|
-
export function createOSBom(
|
|
144
|
+
export function createOSBom(_path: any, options: any): Promise<any>;
|
|
145
145
|
/**
|
|
146
146
|
* Function to create bom string for Jenkins plugins
|
|
147
147
|
*
|
package/types/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.js"],"names":[],"mappings":"AA8vBA;;;;;;;;GAQG;AACH,gFAFW,MAAM,SAchB;AAyUD;;;;;;;GAOG;AACH,mCALW,MAAM,qBAiEhB;AAED;;;;;GAKG;AACH,uCAHW,MAAM;;;;EAKhB;AAED;;;;;GAKG;AACH,sCAHW,MAAM;;;;EAkBhB;AAED;;;;;GAKG;AACH,oCAHW,MAAM,8BA8/BhB;AAED;;;;;GAKG;AACH,sCAHW,MAAM,8BA2chB;AAED;;;;;;;;;;GAUG;AACH,+DAyEC;AAED;;;;;GAKG;AACH,sCAHW,MAAM,8BA2bhB;AAED;;;;;GAKG;AACH,kCAHW,MAAM,8BA6YhB;AAED;;;;;GAKG;AACH,oCAHW,MAAM,8BAqIhB;AAED;;;;;GAKG;AACH,oCAHW,MAAM,8BAiDhB;AAED;;;;;GAKG;AACH,mCAHW,MAAM,qBA+KhB;AAED;;;;;GAKG;AACH,uCAHW,MAAM,qBAsHhB;AAED;;;;;GAKG;AACH,uCAHW,MAAM,qBA2BhB;AAED;;;;;GAKG;AACH,sCAHW,MAAM,qBA2BhB;AAED;;;;;GAKG;AACH,sCAHW,MAAM,qBA2BhB;AAED;;;;;GAKG;AACH,0CAHW,MAAM,qBAuBhB;AAED;;;;;GAKG;AACH,oEAkDC;AAED;;;;;GAKG;AACH,uCAHW,MAAM,8BA4ChB;AAED;;;;;GAKG;AACH,oCAHW,MAAM,qBA2BhB;AAED;;;;;GAKG;AACH,qCAHW,MAAM,8BAwFhB;AAED;;;;;GAKG;AACH,iDAHW,MAAM,qBAiUhB;AAED;;;;;GAKG;AACH,mCAHW,MAAM,qBAwJhB;AAED;;;;;GAKG;AACH,oCAHW,MAAM,8BAmFhB;AAED;;;;;GAKG;AACH,sCAHW,MAAM,8BA6XhB;AAED;;;;;GAKG;AACH,2CAHW,MAAM;;;;;;;;;;;;;;;;;;;;GAoChB;AAED;;;;;;;;KA+DC;AAED;;;;;;GAMG;AACH,yDA2CC;AAED;;;;;;;;;GASG;AACH,2GA6BC;AAED;;;;;GAKG;AACH,0CAHW,MAAM,EAAE,8BAmclB;AAED;;;;;GAKG;AACH,iCAHW,MAAM,8BAiUhB;AAED;;;;;GAKG;AACH,gCAHW,MAAM,qBAsOhB;AAED;;;;;;GAMG;AACH,wDAFY,OAAO,CAAC;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,MAAM,EAAE,MAAM,EAAE,CAAA;CAAE,GAAG,SAAS,CAAC,CAwHxE"}
|
package/types/postgen.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export function postProcess(bomNSData: any, options: any): any;
|
|
|
15
15
|
*
|
|
16
16
|
* @returns {Object} Filtered BOM JSON
|
|
17
17
|
*/
|
|
18
|
-
export function applyMetadata(bomJson: any,
|
|
18
|
+
export function applyMetadata(bomJson: any, _options: any): any;
|
|
19
19
|
/**
|
|
20
20
|
* Apply definitions.standards based on options
|
|
21
21
|
*
|
|
@@ -37,5 +37,5 @@ export function filterBom(bomJson: any, options: any): any;
|
|
|
37
37
|
/**
|
|
38
38
|
* Clean up
|
|
39
39
|
*/
|
|
40
|
-
export function cleanupEnv(
|
|
40
|
+
export function cleanupEnv(_options: any): void;
|
|
41
41
|
//# sourceMappingURL=postgen.d.ts.map
|
package/types/postgen.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"postgen.d.ts","sourceRoot":"","sources":["../postgen.js"],"names":[],"mappings":"AAOA;;;;;;;GAOG;AACH,+DAcC;AAED;;;;;;;GAOG;AACH
|
|
1
|
+
{"version":3,"file":"postgen.d.ts","sourceRoot":"","sources":["../postgen.js"],"names":[],"mappings":"AAOA;;;;;;;GAOG;AACH,+DAcC;AAED;;;;;;;GAOG;AACH,gEAqCC;AAED;;;;;;;GAOG;AACH,gEA+BC;AAED;;;;;;;GAOG;AACH,2DAuIC;AAED;;GAEG;AACH,gDAIC"}
|
package/types/pregen.d.ts
CHANGED
|
@@ -17,5 +17,29 @@ export function prepareSdkmanBuild(projectType: string): boolean;
|
|
|
17
17
|
* @param {String} filePath Path
|
|
18
18
|
* @param {Object} options CLI Options
|
|
19
19
|
*/
|
|
20
|
-
export function preparePythonEnv(
|
|
20
|
+
export function preparePythonEnv(_filePath: any, options: any): void;
|
|
21
|
+
/**
|
|
22
|
+
* Method to check and prepare the environment for node
|
|
23
|
+
*
|
|
24
|
+
* @param {String} filePath Path
|
|
25
|
+
* @param {Object} options CLI Options
|
|
26
|
+
*/
|
|
27
|
+
export function prepareNodeEnv(filePath: string, options: any): void;
|
|
28
|
+
/**
|
|
29
|
+
* If NVM_DIR is in path, however nvm command is not loaded.
|
|
30
|
+
* it is possible that required nodeVersion is not installed.
|
|
31
|
+
* This function loads nvm and install the nodeVersion
|
|
32
|
+
*
|
|
33
|
+
* @param {String} nodeVersion required version number
|
|
34
|
+
*
|
|
35
|
+
* @returns {Boolean} true if successful, otherwise false
|
|
36
|
+
*/
|
|
37
|
+
export function tryLoadNvmAndInstallTool(nodeVersion: string): boolean;
|
|
38
|
+
/**
|
|
39
|
+
* This method installs and create package-lock.json
|
|
40
|
+
*
|
|
41
|
+
* @param {String} filePath Path
|
|
42
|
+
* @param {String} nvmNodePath Path to node version in nvm
|
|
43
|
+
*/
|
|
44
|
+
export function doNpmInstall(filePath: string, nvmNodePath: string): void;
|
|
21
45
|
//# sourceMappingURL=pregen.d.ts.map
|
package/types/pregen.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pregen.d.ts","sourceRoot":"","sources":["../pregen.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"pregen.d.ts","sourceRoot":"","sources":["../pregen.js"],"names":[],"mappings":"AAaA;;;;;GAKG;AACH,iEAaC;AAED;;;;GAIG;AACH,iEASC;AAED;;;;;GAKG;AACH,qEAwCC;AAED;;;;;GAKG;AACH,qEAyDC;AAED;;;;;;;;GAQG;AACH,uEAmBC;AAED;;;;;GAKG;AACH,0EAqCC"}
|
package/types/utils.d.ts
CHANGED
|
@@ -493,7 +493,7 @@ export function repoMetadataToGitHubApiUrl(repoMetadata: any): string | undefine
|
|
|
493
493
|
*
|
|
494
494
|
*
|
|
495
495
|
*/
|
|
496
|
-
export function generatePixiLockFile(
|
|
496
|
+
export function generatePixiLockFile(_path: any): void;
|
|
497
497
|
/**
|
|
498
498
|
* Method to split GitHub url into its parts
|
|
499
499
|
* @param {String} repoUrl Repository url
|
|
@@ -921,7 +921,7 @@ export function parseSwiftResolved(resolvedFile: string): {
|
|
|
921
921
|
* @param {boolean} includeCacheDir Include maven and gradle cache directories
|
|
922
922
|
*/
|
|
923
923
|
export function collectMvnDependencies(mavenCmd: string, basePath: string, cleanup?: boolean, includeCacheDir?: boolean): Promise<{}>;
|
|
924
|
-
export function collectGradleDependencies(
|
|
924
|
+
export function collectGradleDependencies(_gradleCmd: any, _basePath: any, _cleanup?: boolean, _includeCacheDir?: boolean): Promise<{}>;
|
|
925
925
|
/**
|
|
926
926
|
* Method to collect class names from all jars in a directory
|
|
927
927
|
*
|
|
@@ -1267,9 +1267,10 @@ export function isValidIriReference(iri: string): boolean;
|
|
|
1267
1267
|
* Method to check if a given dependency tree is partial or not.
|
|
1268
1268
|
*
|
|
1269
1269
|
* @param {Array} dependencies List of dependencies
|
|
1270
|
+
* @param {Number} componentsCount Number of components
|
|
1270
1271
|
* @returns {Boolean} True if the dependency tree lacks any non-root parents without children. False otherwise.
|
|
1271
1272
|
*/
|
|
1272
|
-
export function isPartialTree(dependencies: any[]): boolean;
|
|
1273
|
+
export function isPartialTree(dependencies: any[], componentsCount?: number): boolean;
|
|
1273
1274
|
/**
|
|
1274
1275
|
* Re-compute and set the scope based on the dependency tree
|
|
1275
1276
|
*
|
package/types/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../utils.js"],"names":[],"mappings":"AA2JA,yCAYC;AAED,2CAQC;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../utils.js"],"names":[],"mappings":"AA2JA,yCAYC;AAED,2CAQC;AA8KD;;;;;;;GAOG;AACH,4EAoBC;AAED;;;;;;GAMG;AACH,mGAkDC;AAED;;;;;;;;GAQG;AACH,yGASC;AAgBD;;;;;GAKG;AACH,qCAHW,MAAM,WACN,MAAM,0BAqBhB;AAED;;;;;;GAMG;AACH,+CAJW,MAAM,WACN,MAAM,+BAoBhB;AAYD;;;;GAIG;AACH,gCAFa,MAAM,CAIlB;AAED;;;;;;IAMI;AACJ,iDAJW,MAAM,GACJ,OAAO,CAiBnB;AAED;;;;;;;;;GASG;AACH,iEA2BC;AAED;;;;;GAKG;AACH,6CAqDC;AAED;;;;;;GAMG;AACH,sEA0DC;AAED;;;;GAIG;AACH,4EAoCC;AAED;;;GAGG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EA4KhB;AAGD;;;;;EAmBC;AAED;;;;;;GAMG;AACH,kEAHW,MAAM,cACN,MAAM,6BA0IhB;AAED,qDASC;AAED;;;;;;;EA2GC;AAED;;;EA6PC;AAED,sEA6BC;AAED;;;;;;;GAOG;AACH,mCALW,MAAM,WACN,MAAM;;;;;;;EAuQhB;AAED;;;;;;GAMG;AACH,2CAHW,MAAM,OAKhB;AAED,qDA0CC;AA8HD;;;;GAIG;AACH;;;GAkHC;AAED,yEA0GC;AAED;;;;;;GAMG;AACH,mDAkBC;AAED;;;;;;;;;;GAUG;AACH,0DAqBC;AAED;;;;;;GAMG;AACH,sFAWC;AAED;;;;;;;GAOG;AACH,2EAgCC;AA16XD,gCAAgF;AAChF,4BAA4C;AAC5C,4BAA6C;AAC7C,2BAAmE;AAsBnE,iCAEE;AAqBF,iCAIyC;AAGzC,gCACmE;AAGnE,gCACsE;AAGtE,8BAA+B;AAK/B,4CAEmE;AAGnE,6CAE6D;AAG7D,oCAEoD;AAGpD,uCAEuD;AAYvD,8BAAyC;AAczC,gCAA6C;AAU7C,8BAAiC;AAIjC,4BAA6B;AAI7B,2BAA2B;AAI3B,4BAA6B;AAI7B,2BAA2B;AAI3B,6BAA+B;AAI/B,0BAAyB;AAIzB,6BAA+B;AAM/B,2BAA2B;AAK3B,4BAA6B;AAK7B,6BAA+B;AAM/B,kDAWE;AAGF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsGE;;;;AAwHF,8BAQG;AAqqJH,8CAUE"}
|
package/utils.js
CHANGED
|
@@ -268,6 +268,14 @@ export const PROJECT_TYPE_ALIASES = {
|
|
|
268
268
|
"npm",
|
|
269
269
|
"pnpm",
|
|
270
270
|
"nodejs",
|
|
271
|
+
"nodejs8",
|
|
272
|
+
"nodejs10",
|
|
273
|
+
"nodejs12",
|
|
274
|
+
"nodejs14",
|
|
275
|
+
"nodejs16",
|
|
276
|
+
"nodejs18",
|
|
277
|
+
"nodejs20",
|
|
278
|
+
"nodejs22",
|
|
271
279
|
"js",
|
|
272
280
|
"javascript",
|
|
273
281
|
"typescript",
|
|
@@ -2880,7 +2888,7 @@ export function parseGradleProperties(rawOutput) {
|
|
|
2880
2888
|
*/
|
|
2881
2889
|
export function executeParallelGradleProperties(dir, rootPath, allProjectsStr) {
|
|
2882
2890
|
const defaultProps = {
|
|
2883
|
-
rootProject:
|
|
2891
|
+
rootProject: "root",
|
|
2884
2892
|
projects: [],
|
|
2885
2893
|
metadata: {
|
|
2886
2894
|
version: "latest",
|
|
@@ -4497,7 +4505,7 @@ export function repoMetadataToGitHubApiUrl(repoMetadata) {
|
|
|
4497
4505
|
*
|
|
4498
4506
|
*
|
|
4499
4507
|
*/
|
|
4500
|
-
export function generatePixiLockFile(
|
|
4508
|
+
export function generatePixiLockFile(_path) {
|
|
4501
4509
|
const result = spawnSync("pixi", ["install"], {
|
|
4502
4510
|
encoding: "utf-8",
|
|
4503
4511
|
});
|
|
@@ -9018,10 +9026,10 @@ export async function collectMvnDependencies(
|
|
|
9018
9026
|
}
|
|
9019
9027
|
|
|
9020
9028
|
export async function collectGradleDependencies(
|
|
9021
|
-
|
|
9022
|
-
|
|
9023
|
-
|
|
9024
|
-
|
|
9029
|
+
_gradleCmd,
|
|
9030
|
+
_basePath,
|
|
9031
|
+
_cleanup = true, // eslint-disable-line no-unused-vars
|
|
9032
|
+
_includeCacheDir = false, // eslint-disable-line no-unused-vars
|
|
9025
9033
|
) {
|
|
9026
9034
|
// HELP WANTED: We need an init script that mimics maven copy-dependencies that only collects the project specific jars and poms
|
|
9027
9035
|
// Construct gradle cache directory
|
|
@@ -9874,7 +9882,6 @@ export async function getJarClasses(jarFile) {
|
|
|
9874
9882
|
"is not recognized as an internal or external command",
|
|
9875
9883
|
)
|
|
9876
9884
|
) {
|
|
9877
|
-
jarCommandAvailable = false;
|
|
9878
9885
|
return retList;
|
|
9879
9886
|
}
|
|
9880
9887
|
const consolelines = (jarResult.stdout || "").split("\n");
|
|
@@ -10517,7 +10524,7 @@ export function getPipFrozenTree(
|
|
|
10517
10524
|
);
|
|
10518
10525
|
} else {
|
|
10519
10526
|
console.log(
|
|
10520
|
-
"The version or the version specifiers used for a dependency is invalid.
|
|
10527
|
+
"The version or the version specifiers used for a dependency is invalid. Try with a different python type such as -t python310 or -t python39.\nOriginal error from pip:\n",
|
|
10521
10528
|
);
|
|
10522
10529
|
}
|
|
10523
10530
|
console.log(result.stderr);
|
|
@@ -12194,9 +12201,10 @@ export function isValidIriReference(iri) {
|
|
|
12194
12201
|
* Method to check if a given dependency tree is partial or not.
|
|
12195
12202
|
*
|
|
12196
12203
|
* @param {Array} dependencies List of dependencies
|
|
12204
|
+
* @param {Number} componentsCount Number of components
|
|
12197
12205
|
* @returns {Boolean} True if the dependency tree lacks any non-root parents without children. False otherwise.
|
|
12198
12206
|
*/
|
|
12199
|
-
export function isPartialTree(dependencies) {
|
|
12207
|
+
export function isPartialTree(dependencies, componentsCount = 1) {
|
|
12200
12208
|
if (dependencies?.length <= 1) {
|
|
12201
12209
|
return true;
|
|
12202
12210
|
}
|
|
@@ -12206,7 +12214,7 @@ export function isPartialTree(dependencies) {
|
|
|
12206
12214
|
parentsWithChildsCount++;
|
|
12207
12215
|
}
|
|
12208
12216
|
}
|
|
12209
|
-
return parentsWithChildsCount <= 1;
|
|
12217
|
+
return parentsWithChildsCount <= Math.max(Math.round(componentsCount / 3), 1);
|
|
12210
12218
|
}
|
|
12211
12219
|
|
|
12212
12220
|
/**
|
package/utils.test.js
CHANGED
|
@@ -3199,7 +3199,9 @@ test("parseYarnLock", async () => {
|
|
|
3199
3199
|
parsedList = await parseYarnLock("./test/data/yarn_locks/yarn-multi.lock");
|
|
3200
3200
|
expect(parsedList.pkgList.length).toEqual(1909);
|
|
3201
3201
|
expect(parsedList.dependenciesList.length).toEqual(1909);
|
|
3202
|
-
expect(
|
|
3202
|
+
expect(
|
|
3203
|
+
isPartialTree(parsedList.dependenciesList, parsedList.pkgList.length),
|
|
3204
|
+
).toBeFalsy();
|
|
3203
3205
|
expect(parsedList.pkgList[0]).toEqual({
|
|
3204
3206
|
_integrity:
|
|
3205
3207
|
"sha512-zpruxnFMz6K94gs2pqc3sidzFDbQpKT5D6P/J/I9s8ekHZ5eczgnRp6pqXC86Bh7+44j/btpmOT0kwiboyqTnA==",
|
|
@@ -3232,7 +3234,9 @@ test("parseYarnLock", async () => {
|
|
|
3232
3234
|
parsedList = await parseYarnLock("./test/data/yarn_locks/yarn-light.lock");
|
|
3233
3235
|
expect(parsedList.pkgList.length).toEqual(315);
|
|
3234
3236
|
expect(parsedList.dependenciesList.length).toEqual(315);
|
|
3235
|
-
expect(
|
|
3237
|
+
expect(
|
|
3238
|
+
isPartialTree(parsedList.dependenciesList, parsedList.pkgList.length),
|
|
3239
|
+
).toBeFalsy();
|
|
3236
3240
|
expect(parsedList.pkgList[0]).toEqual({
|
|
3237
3241
|
_integrity:
|
|
3238
3242
|
"sha512-rZ1k9kQvJX21Vwgx1L6kSQ6yeXo9cCMyqURSnjG+MRoJn+Mr3LblxmVdzScHXRzv0N9yzy49oG7Bqxp9Knyv/g==",
|
|
@@ -3265,7 +3269,9 @@ test("parseYarnLock", async () => {
|
|
|
3265
3269
|
parsedList = await parseYarnLock("./test/data/yarn_locks/yarn3.lock");
|
|
3266
3270
|
expect(parsedList.pkgList.length).toEqual(5);
|
|
3267
3271
|
expect(parsedList.dependenciesList.length).toEqual(5);
|
|
3268
|
-
expect(
|
|
3272
|
+
expect(
|
|
3273
|
+
isPartialTree(parsedList.dependenciesList, parsedList.pkgList.length),
|
|
3274
|
+
).toBeFalsy();
|
|
3269
3275
|
expect(parsedList.pkgList[1]).toEqual({
|
|
3270
3276
|
_integrity:
|
|
3271
3277
|
"sha512-+X9Jn4mPI+RYV0ITiiLyJSYlT9um111BocJSaztsxXR+9ZxWErpzdfQqyk+EYZUOklugjJkerQZRtJGLfJeClw==",
|
|
@@ -3298,7 +3304,9 @@ test("parseYarnLock", async () => {
|
|
|
3298
3304
|
parsedList = await parseYarnLock("./test/data/yarn_locks/yarnv2.lock");
|
|
3299
3305
|
expect(parsedList.pkgList.length).toEqual(1088);
|
|
3300
3306
|
expect(parsedList.dependenciesList.length).toEqual(1088);
|
|
3301
|
-
expect(
|
|
3307
|
+
expect(
|
|
3308
|
+
isPartialTree(parsedList.dependenciesList, parsedList.pkgList.length),
|
|
3309
|
+
).toBeFalsy();
|
|
3302
3310
|
expect(parsedList.pkgList[0]).toEqual({
|
|
3303
3311
|
_integrity:
|
|
3304
3312
|
"sha512-G0U5NjBUYIs39l1J1ckgpVfVX2IxpzRAIT4/2An86O2Mcri3k5xNu7/RRkfObo12wN9s7BmnREAMhH7252oZiA==",
|
|
@@ -3330,7 +3338,9 @@ test("parseYarnLock", async () => {
|
|
|
3330
3338
|
parsedList = await parseYarnLock("./test/data/yarn_locks/yarnv3.lock");
|
|
3331
3339
|
expect(parsedList.pkgList.length).toEqual(363);
|
|
3332
3340
|
expect(parsedList.dependenciesList.length).toEqual(363);
|
|
3333
|
-
expect(
|
|
3341
|
+
expect(
|
|
3342
|
+
isPartialTree(parsedList.dependenciesList, parsedList.pkgList.length),
|
|
3343
|
+
).toBeFalsy();
|
|
3334
3344
|
expect(parsedList.pkgList[0]).toEqual({
|
|
3335
3345
|
_integrity:
|
|
3336
3346
|
"sha512-vtU+q0TmdIDmezU7lKub73vObN6nmd3lkcKWz7R9hyNI8gz5o7grDb+FML9nykOLW+09gGIup2xyJ86j5vBKpg==",
|
|
@@ -3362,7 +3372,9 @@ test("parseYarnLock", async () => {
|
|
|
3362
3372
|
parsedList = await parseYarnLock("./test/data/yarn_locks/yarn4.lock");
|
|
3363
3373
|
expect(parsedList.pkgList.length).toEqual(1);
|
|
3364
3374
|
expect(parsedList.dependenciesList.length).toEqual(1);
|
|
3365
|
-
expect(
|
|
3375
|
+
expect(
|
|
3376
|
+
isPartialTree(parsedList.dependenciesList, parsedList.pkgList.length),
|
|
3377
|
+
).toBeTruthy();
|
|
3366
3378
|
parsedList = await parseYarnLock("./test/data/yarn_locks/yarn-at.lock");
|
|
3367
3379
|
expect(parsedList.pkgList.length).toEqual(4);
|
|
3368
3380
|
expect(parsedList.dependenciesList.length).toEqual(4);
|
|
@@ -3394,7 +3406,9 @@ test("parseYarnLock", async () => {
|
|
|
3394
3406
|
parsedList = await parseYarnLock("./test/data/yarn_locks/yarn5.lock");
|
|
3395
3407
|
expect(parsedList.pkgList.length).toEqual(1962);
|
|
3396
3408
|
expect(parsedList.dependenciesList.length).toEqual(1962);
|
|
3397
|
-
expect(
|
|
3409
|
+
expect(
|
|
3410
|
+
isPartialTree(parsedList.dependenciesList, parsedList.pkgList.length),
|
|
3411
|
+
).toBeFalsy();
|
|
3398
3412
|
expect(parsedList.pkgList[0].purl).toEqual(
|
|
3399
3413
|
"pkg:npm/%40ampproject/remapping@2.2.0",
|
|
3400
3414
|
);
|
|
@@ -3408,7 +3422,9 @@ test("parseYarnLock", async () => {
|
|
|
3408
3422
|
parsedList = await parseYarnLock("./test/data/yarn_locks/yarn6.lock");
|
|
3409
3423
|
expect(parsedList.pkgList.length).toEqual(1472);
|
|
3410
3424
|
expect(parsedList.dependenciesList.length).toEqual(1472);
|
|
3411
|
-
expect(
|
|
3425
|
+
expect(
|
|
3426
|
+
isPartialTree(parsedList.dependenciesList, parsedList.pkgList.length),
|
|
3427
|
+
).toBeFalsy();
|
|
3412
3428
|
expect(parsedList.pkgList[0].purl).toEqual(
|
|
3413
3429
|
"pkg:npm/%40aashutoshrathi/word-wrap@1.2.6",
|
|
3414
3430
|
);
|
|
@@ -3425,7 +3441,9 @@ test("parseYarnLock", async () => {
|
|
|
3425
3441
|
parsedList = await parseYarnLock("./test/data/yarn_locks/yarn7.lock");
|
|
3426
3442
|
expect(parsedList.pkgList.length).toEqual(1350);
|
|
3427
3443
|
expect(parsedList.dependenciesList.length).toEqual(1347);
|
|
3428
|
-
expect(
|
|
3444
|
+
expect(
|
|
3445
|
+
isPartialTree(parsedList.dependenciesList, parsedList.pkgList.length),
|
|
3446
|
+
).toBeFalsy();
|
|
3429
3447
|
expect(parsedList.pkgList[0].purl).toEqual(
|
|
3430
3448
|
"pkg:npm/%40aashutoshrathi/word-wrap@1.2.6",
|
|
3431
3449
|
);
|
|
@@ -3478,7 +3496,9 @@ test("parseYarnLock", async () => {
|
|
|
3478
3496
|
parsedList = await parseYarnLock("./test/data/yarn_locks/yarnv1-empty.lock");
|
|
3479
3497
|
expect(parsedList.pkgList.length).toEqual(770);
|
|
3480
3498
|
expect(parsedList.dependenciesList.length).toEqual(770);
|
|
3481
|
-
expect(
|
|
3499
|
+
expect(
|
|
3500
|
+
isPartialTree(parsedList.dependenciesList, parsedList.pkgList.length),
|
|
3501
|
+
).toBeFalsy();
|
|
3482
3502
|
expect(parsedList.pkgList[0].purl).toEqual(
|
|
3483
3503
|
"pkg:npm/%40ampproject/remapping@2.2.0",
|
|
3484
3504
|
);
|
package/validator.js
CHANGED
|
@@ -221,7 +221,7 @@ export const validateRefs = (bomJson) => {
|
|
|
221
221
|
const warningsList = [];
|
|
222
222
|
const refMap = buildRefs(bomJson);
|
|
223
223
|
if (bomJson?.dependencies) {
|
|
224
|
-
if (isPartialTree(bomJson.dependencies)) {
|
|
224
|
+
if (isPartialTree(bomJson.dependencies, bomJson?.components?.length)) {
|
|
225
225
|
warningsList.push("Dependency tree is partial lacking child nodes.");
|
|
226
226
|
}
|
|
227
227
|
for (const dep of bomJson.dependencies) {
|