@herodevs/cli 1.5.0-beta.1 → 1.5.0-beta.2
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/bin/dev.js +3 -0
- package/dist/api/queries/nes/sbom.js +1 -2
- package/dist/service/eol/eol.svc.d.ts +2 -0
- package/dist/service/eol/eol.svc.js +24 -0
- package/dist/service/nes/nes.svc.js +0 -6
- package/dist/ui/eol.ui.js +15 -3
- package/package.json +9 -5
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@ $ npm install -g @herodevs/cli
|
|
|
16
16
|
$ hd COMMAND
|
|
17
17
|
running command...
|
|
18
18
|
$ hd (--version)
|
|
19
|
-
@herodevs/cli/1.5.0-beta.
|
|
19
|
+
@herodevs/cli/1.5.0-beta.2 linux-x64 node-v22.14.0
|
|
20
20
|
$ hd --help [COMMAND]
|
|
21
21
|
USAGE
|
|
22
22
|
$ hd COMMAND
|
|
@@ -81,7 +81,7 @@ EXAMPLES
|
|
|
81
81
|
$ hd report committers --csv
|
|
82
82
|
```
|
|
83
83
|
|
|
84
|
-
_See code: [src/commands/report/committers.ts](https://github.com/herodevs/cli/blob/v1.5.0-beta.
|
|
84
|
+
_See code: [src/commands/report/committers.ts](https://github.com/herodevs/cli/blob/v1.5.0-beta.2/src/commands/report/committers.ts)_
|
|
85
85
|
|
|
86
86
|
## `hd report purls`
|
|
87
87
|
|
|
@@ -115,7 +115,7 @@ EXAMPLES
|
|
|
115
115
|
$ hd report purls --save --csv
|
|
116
116
|
```
|
|
117
117
|
|
|
118
|
-
_See code: [src/commands/report/purls.ts](https://github.com/herodevs/cli/blob/v1.5.0-beta.
|
|
118
|
+
_See code: [src/commands/report/purls.ts](https://github.com/herodevs/cli/blob/v1.5.0-beta.2/src/commands/report/purls.ts)_
|
|
119
119
|
|
|
120
120
|
## `hd scan eol`
|
|
121
121
|
|
|
@@ -149,7 +149,7 @@ EXAMPLES
|
|
|
149
149
|
$ hd scan eol -a --dir=./my-project
|
|
150
150
|
```
|
|
151
151
|
|
|
152
|
-
_See code: [src/commands/scan/eol.ts](https://github.com/herodevs/cli/blob/v1.5.0-beta.
|
|
152
|
+
_See code: [src/commands/scan/eol.ts](https://github.com/herodevs/cli/blob/v1.5.0-beta.2/src/commands/scan/eol.ts)_
|
|
153
153
|
|
|
154
154
|
## `hd scan sbom`
|
|
155
155
|
|
|
@@ -177,7 +177,7 @@ EXAMPLES
|
|
|
177
177
|
$ hd scan sbom --file=path/to/sbom.json
|
|
178
178
|
```
|
|
179
179
|
|
|
180
|
-
_See code: [src/commands/scan/sbom.ts](https://github.com/herodevs/cli/blob/v1.5.0-beta.
|
|
180
|
+
_See code: [src/commands/scan/sbom.ts](https://github.com/herodevs/cli/blob/v1.5.0-beta.2/src/commands/scan/sbom.ts)_
|
|
181
181
|
|
|
182
182
|
## `hd update [CHANNEL]`
|
|
183
183
|
|
package/bin/dev.js
CHANGED
|
@@ -8,4 +8,7 @@ process.env.GRAPHQL_HOST = 'http://localhost:3000';
|
|
|
8
8
|
// Dev
|
|
9
9
|
// process.env.GRAPHQL_HOST = 'https://api.dev.nes.herodevs.com';
|
|
10
10
|
|
|
11
|
+
// Prod
|
|
12
|
+
// process.env.GRAPHQL_HOST = 'https://api.nes.herodevs.com';
|
|
13
|
+
|
|
11
14
|
await execute({ development: true, dir: import.meta.url });
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { PackageURL } from 'packageurl-js';
|
|
1
2
|
import { type Sbom } from './cdx.svc.ts';
|
|
2
3
|
export interface CdxGenOptions {
|
|
3
4
|
projectType?: string[];
|
|
@@ -10,3 +11,4 @@ export type CdxCreator = (dir: string, opts: CdxGenOptions) => Promise<{
|
|
|
10
11
|
}>;
|
|
11
12
|
export declare function createSbom(directory: string, opts?: ScanOptions): Promise<any>;
|
|
12
13
|
export declare function validateIsCycloneDxSbom(sbom: unknown): asserts sbom is Sbom;
|
|
14
|
+
export declare function resolvePurlPackageName(purl: PackageURL): string;
|
|
@@ -23,3 +23,27 @@ export function validateIsCycloneDxSbom(sbom) {
|
|
|
23
23
|
throw new Error('Invalid SBOM: missing or invalid components array');
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
+
const purlPackageNameRules = {
|
|
27
|
+
npm: (p) => (p.namespace ? `${p.namespace}/${p.name}` : p.name),
|
|
28
|
+
maven: (p) => (p.namespace ? `${p.namespace}:${p.name}` : p.name),
|
|
29
|
+
pypi: (p) => p.name.toLowerCase(),
|
|
30
|
+
nuget: (p) => p.name,
|
|
31
|
+
gem: (p) => p.name,
|
|
32
|
+
composer: (p) => (p.namespace ? `${p.namespace}/${p.name}` : p.name),
|
|
33
|
+
golang: (p) => (p.namespace ? `${p.namespace}/${p.name}` : p.name),
|
|
34
|
+
cargo: (p) => p.name,
|
|
35
|
+
conan: (p) => (p.namespace ? `${p.namespace}/${p.name}` : p.name),
|
|
36
|
+
github: (p) => (p.namespace ? `${p.namespace}/${p.name}` : p.name),
|
|
37
|
+
bitbucket: (p) => (p.namespace ? `${p.namespace}/${p.name}` : p.name),
|
|
38
|
+
docker: (p) => (p.namespace ? `${p.namespace}/${p.name}` : p.name),
|
|
39
|
+
};
|
|
40
|
+
function isKnownEcosystemType(type) {
|
|
41
|
+
return type in purlPackageNameRules;
|
|
42
|
+
}
|
|
43
|
+
export function resolvePurlPackageName(purl) {
|
|
44
|
+
if (!isKnownEcosystemType(purl.type)) {
|
|
45
|
+
debugLogger(`Unsupported package type: ${purl.type}, falling back to name only`);
|
|
46
|
+
return purl.name;
|
|
47
|
+
}
|
|
48
|
+
return purlPackageNameRules[purl.type](purl);
|
|
49
|
+
}
|
|
@@ -3,12 +3,6 @@ import { debugLogger } from "../log.svc.js";
|
|
|
3
3
|
export const buildScanResult = (scan) => {
|
|
4
4
|
const components = new Map();
|
|
5
5
|
for (const c of scan.components) {
|
|
6
|
-
const { status } = c.info;
|
|
7
|
-
// TODO: remove this once backend changes are deployed
|
|
8
|
-
// @ts-expect-error
|
|
9
|
-
if (status === 'LTS') {
|
|
10
|
-
c.info.status = 'SUPPORTED';
|
|
11
|
-
}
|
|
12
6
|
components.set(c.purl, c);
|
|
13
7
|
}
|
|
14
8
|
return {
|
package/dist/ui/eol.ui.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ux } from '@oclif/core';
|
|
2
2
|
import { makeTable } from '@oclif/table';
|
|
3
3
|
import { PackageURL } from 'packageurl-js';
|
|
4
|
+
import { resolvePurlPackageName } from "../service/eol/eol.svc.js";
|
|
4
5
|
import { parseMomentToSimpleDate } from "./date.ui.js";
|
|
5
6
|
import { INDICATORS, MAX_PURL_LENGTH, MAX_TABLE_COLUMN_WIDTH, STATUS_COLORS } from "./shared.ui.js";
|
|
6
7
|
export function truncateString(purl, maxLength) {
|
|
@@ -63,13 +64,24 @@ export function createStatusDisplay(components, all) {
|
|
|
63
64
|
}
|
|
64
65
|
export function createTableForStatus(grouped, status) {
|
|
65
66
|
const data = grouped[status].map((component) => convertComponentToTableRow(component));
|
|
67
|
+
if (status === 'EOL' || status === 'SUPPORTED') {
|
|
68
|
+
return makeTable({
|
|
69
|
+
data,
|
|
70
|
+
columns: [
|
|
71
|
+
{ key: 'name', name: 'NAME', width: MAX_TABLE_COLUMN_WIDTH },
|
|
72
|
+
{ key: 'version', name: 'VERSION', width: 10 },
|
|
73
|
+
{ key: 'eol', name: 'EOL', width: 12 },
|
|
74
|
+
{ key: 'daysEol', name: 'DAYS EOL', width: 10 },
|
|
75
|
+
{ key: 'type', name: 'TYPE', width: 12 },
|
|
76
|
+
{ key: 'vulnCount', name: '# OF VULNS', width: 12 },
|
|
77
|
+
],
|
|
78
|
+
});
|
|
79
|
+
}
|
|
66
80
|
return makeTable({
|
|
67
81
|
data,
|
|
68
82
|
columns: [
|
|
69
83
|
{ key: 'name', name: 'NAME', width: MAX_TABLE_COLUMN_WIDTH },
|
|
70
84
|
{ key: 'version', name: 'VERSION', width: 10 },
|
|
71
|
-
{ key: 'eol', name: 'EOL', width: 12 },
|
|
72
|
-
{ key: 'daysEol', name: 'DAYS EOL', width: 10 },
|
|
73
85
|
{ key: 'type', name: 'TYPE', width: 12 },
|
|
74
86
|
{ key: 'vulnCount', name: '# OF VULNS', width: 12 },
|
|
75
87
|
],
|
|
@@ -79,7 +91,7 @@ export function convertComponentToTableRow(component) {
|
|
|
79
91
|
const purlParts = PackageURL.fromString(component.purl);
|
|
80
92
|
const { eolAt, daysEol, vulnCount } = component.info;
|
|
81
93
|
return {
|
|
82
|
-
name: purlParts
|
|
94
|
+
name: resolvePurlPackageName(purlParts),
|
|
83
95
|
version: purlParts.version ?? '',
|
|
84
96
|
eol: parseMomentToSimpleDate(eolAt),
|
|
85
97
|
daysEol: daysEol,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@herodevs/cli",
|
|
3
|
-
"version": "1.5.0-beta.
|
|
3
|
+
"version": "1.5.0-beta.2",
|
|
4
4
|
"author": "HeroDevs, Inc",
|
|
5
5
|
"bin": {
|
|
6
6
|
"hd": "./bin/run.js"
|
|
@@ -26,10 +26,13 @@
|
|
|
26
26
|
"prepack": "oclif manifest && oclif readme",
|
|
27
27
|
"pretest": "npm run lint && npm run typecheck",
|
|
28
28
|
"readme": "npm run ci:fix && npm run build && npm exec oclif readme",
|
|
29
|
+
"release": "./scripts/release.sh",
|
|
30
|
+
"pre:release:publish": "npm run prepack && git add README.md",
|
|
31
|
+
"release:publish:beta": "npm run release -- --publish",
|
|
32
|
+
"release:publish:latest": "npm run release -- --latest --publish",
|
|
29
33
|
"test": "globstar -- node --import tsx --test \"test/**/*.test.ts\"",
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"test:e2e": "globstar -- node --import tsx --test \"e2e/**/*.test.ts\""
|
|
34
|
+
"test:e2e": "globstar -- node --import tsx --test \"e2e/**/*.test.ts\"",
|
|
35
|
+
"typecheck": "tsc --noEmit"
|
|
33
36
|
},
|
|
34
37
|
"keywords": [
|
|
35
38
|
"herodevs",
|
|
@@ -37,7 +40,7 @@
|
|
|
37
40
|
"herodevs cli"
|
|
38
41
|
],
|
|
39
42
|
"dependencies": {
|
|
40
|
-
"@apollo/client": "^3.13.
|
|
43
|
+
"@apollo/client": "^3.13.8",
|
|
41
44
|
"@cyclonedx/cdxgen": "^11.2.4",
|
|
42
45
|
"@oclif/core": "^4",
|
|
43
46
|
"@oclif/plugin-help": "^6",
|
|
@@ -54,6 +57,7 @@
|
|
|
54
57
|
"@types/node": "^22",
|
|
55
58
|
"@types/sinon": "^17.0.4",
|
|
56
59
|
"@types/update-notifier": "^6.0.8",
|
|
60
|
+
"commit-and-tag-version": "^12.5.1",
|
|
57
61
|
"globstar": "^1.0.0",
|
|
58
62
|
"oclif": "^4",
|
|
59
63
|
"shx": "^0.4.0",
|