@nodesecure/rc 1.0.1 → 1.1.0
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 +2 -2
- package/dist/projects/ci.d.ts +25 -0
- package/dist/projects/ci.js +11 -0
- package/dist/projects/ci.js.map +1 -0
- package/dist/projects/report.d.ts +69 -0
- package/dist/projects/report.js +33 -0
- package/dist/projects/report.js.map +1 -0
- package/dist/rc.d.ts +7 -27
- package/dist/rc.js +7 -14
- package/dist/rc.js.map +1 -1
- package/dist/schema/defs/ci.json +58 -0
- package/dist/schema/defs/ciWarnings.json +8 -0
- package/dist/schema/defs/report.json +98 -0
- package/dist/schema/defs/reportChart.json +27 -0
- package/dist/schema/loader.d.ts +1 -0
- package/dist/schema/loader.js +20 -0
- package/dist/schema/loader.js.map +1 -0
- package/dist/schema/nodesecurerc.json +17 -52
- package/package.json +69 -67
package/README.md
CHANGED
|
@@ -125,7 +125,7 @@ assert.strictEqual(RC.CONSTANTS.CONFIGURATION_NAME, ".nodesecurerc");
|
|
|
125
125
|
We provide by default a configuration generation that we consider `minimal`. On the contrary, a `complete` value will indicate the generation with all possible default keys.
|
|
126
126
|
|
|
127
127
|
```ts
|
|
128
|
-
export type RCGenerationMode = "minimal" | "ci" | "complete";
|
|
128
|
+
export type RCGenerationMode = "minimal" | "ci" | "report" | "complete";
|
|
129
129
|
```
|
|
130
130
|
|
|
131
131
|
However, depending on the NodeSecure tool you are working on, it can be interesting to generate a configuration with some property sets specific to your needs.
|
|
@@ -135,7 +135,7 @@ Note that you can combine several modes:
|
|
|
135
135
|
```ts
|
|
136
136
|
import * as RC from "@nodesecure/rc";
|
|
137
137
|
|
|
138
|
-
await RC.read(void 0, { createMode: ["ci", "
|
|
138
|
+
await RC.read(void 0, { createMode: ["ci", "report"] })
|
|
139
139
|
```
|
|
140
140
|
|
|
141
141
|
## JSON Schema
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as jsxray from "@nodesecure/js-x-ray";
|
|
2
|
+
/**
|
|
3
|
+
* Configuration dedicated for NodeSecure CI (or nsci)
|
|
4
|
+
* @see https://github.com/NodeSecure/ci
|
|
5
|
+
* @see https://github.com/NodeSecure/ci-action
|
|
6
|
+
*/
|
|
7
|
+
export interface CiConfiguration {
|
|
8
|
+
/**
|
|
9
|
+
* List of enabled reporters
|
|
10
|
+
* @see https://github.com/NodeSecure/ci#reporters
|
|
11
|
+
*/
|
|
12
|
+
reporters?: ("console" | "html")[];
|
|
13
|
+
vulnerabilities?: {
|
|
14
|
+
severity?: "medium" | "high" | "critical" | "all";
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* JS-X-Ray warnings configuration
|
|
18
|
+
* @see https://github.com/NodeSecure/js-x-ray#warnings-legends-v20
|
|
19
|
+
*/
|
|
20
|
+
warnings?: CiWarnings | Record<jsxray.kindWithValue | "unsafe-import", CiWarnings>;
|
|
21
|
+
}
|
|
22
|
+
export declare type CiWarnings = "off" | "error" | "warning";
|
|
23
|
+
export declare function generateCIConfiguration(): {
|
|
24
|
+
ci: CiConfiguration;
|
|
25
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ci.js","sourceRoot":"","sources":["../../src/projects/ci.ts"],"names":[],"mappings":"AAyBA,MAAM,UAAU,uBAAuB;IACrC,MAAM,EAAE,GAAoB;QAC1B,SAAS,EAAE,CAAC,SAAS,CAAC;QACtB,eAAe,EAAE;YACf,QAAQ,EAAE,QAAQ;SACnB;QACD,QAAQ,EAAE,OAAO;KAClB,CAAC;IAEF,OAAO,EAAE,EAAE,EAAE,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration dedicated for NodeSecure Report
|
|
3
|
+
* @see https://github.com/NodeSecure/report
|
|
4
|
+
*/
|
|
5
|
+
export interface ReportConfiguration {
|
|
6
|
+
/**
|
|
7
|
+
* @default `light`
|
|
8
|
+
*/
|
|
9
|
+
theme?: "light" | "dark";
|
|
10
|
+
title: string;
|
|
11
|
+
/**
|
|
12
|
+
* URL to a logo to show on the final HTML/PDF Report
|
|
13
|
+
*/
|
|
14
|
+
logoUrl: string;
|
|
15
|
+
/**
|
|
16
|
+
* Show/categorize internal dependencies as transitive
|
|
17
|
+
* @default false
|
|
18
|
+
*/
|
|
19
|
+
includeTransitiveInternal?: boolean;
|
|
20
|
+
npm?: {
|
|
21
|
+
/**
|
|
22
|
+
* NPM organization prefix starting with @
|
|
23
|
+
* @example `@nodesecure`
|
|
24
|
+
*/
|
|
25
|
+
organizationPrefix: string;
|
|
26
|
+
packages: string[];
|
|
27
|
+
};
|
|
28
|
+
git?: {
|
|
29
|
+
/**
|
|
30
|
+
* GitHub organization URL
|
|
31
|
+
* @example `https://github.com/NodeSecure`
|
|
32
|
+
*/
|
|
33
|
+
organizationUrl: string;
|
|
34
|
+
/**
|
|
35
|
+
* List of repositories (name are enough, no need to provide .git url or any equivalent)
|
|
36
|
+
*/
|
|
37
|
+
repositories: string[];
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* @default html,pdf
|
|
41
|
+
*/
|
|
42
|
+
reporters?: ("html" | "pdf")[];
|
|
43
|
+
charts?: ReportChart[];
|
|
44
|
+
}
|
|
45
|
+
export interface ReportChart {
|
|
46
|
+
/**
|
|
47
|
+
* List of available charts.
|
|
48
|
+
*/
|
|
49
|
+
name: "Extensions" | "Licenses" | "Warnings" | "Flags";
|
|
50
|
+
/**
|
|
51
|
+
* @default true
|
|
52
|
+
*/
|
|
53
|
+
display?: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Chart.js chart type.
|
|
56
|
+
*
|
|
57
|
+
* @see https://www.chartjs.org/docs/latest/charts
|
|
58
|
+
* @default `bar`
|
|
59
|
+
*/
|
|
60
|
+
type?: "bar" | "horizontalBar" | "polarArea" | "doughnut";
|
|
61
|
+
/**
|
|
62
|
+
* D3 Interpolation color. Will be picked randomly by default if not provided.
|
|
63
|
+
* @see https://github.com/d3/d3-scale-chromatic/blob/main/README.md
|
|
64
|
+
*/
|
|
65
|
+
interpolation?: string;
|
|
66
|
+
}
|
|
67
|
+
export declare function generateReportConfiguration(): {
|
|
68
|
+
report: Partial<ReportConfiguration>;
|
|
69
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export function generateReportConfiguration() {
|
|
2
|
+
const report = {
|
|
3
|
+
theme: "light",
|
|
4
|
+
includeTransitiveInternal: false,
|
|
5
|
+
reporters: ["html", "pdf"],
|
|
6
|
+
charts: [
|
|
7
|
+
{
|
|
8
|
+
name: "Extensions",
|
|
9
|
+
display: true,
|
|
10
|
+
interpolation: "d3.interpolateRainbow"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
name: "Licenses",
|
|
14
|
+
display: true,
|
|
15
|
+
interpolation: "d3.interpolateCool"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
name: "Warnings",
|
|
19
|
+
display: true,
|
|
20
|
+
type: "horizontalBar",
|
|
21
|
+
interpolation: "d3.interpolateInferno"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
name: "Flags",
|
|
25
|
+
display: true,
|
|
26
|
+
type: "horizontalBar",
|
|
27
|
+
interpolation: "d3.interpolateSinebow"
|
|
28
|
+
}
|
|
29
|
+
]
|
|
30
|
+
};
|
|
31
|
+
return { report };
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=report.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"report.js","sourceRoot":"","sources":["../../src/projects/report.ts"],"names":[],"mappings":"AAqEA,MAAM,UAAU,2BAA2B;IACzC,MAAM,MAAM,GAAiC;QAC3C,KAAK,EAAE,OAAgB;QACvB,yBAAyB,EAAE,KAAK;QAChC,SAAS,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC;QAC1B,MAAM,EAAE;YACN;gBACE,IAAI,EAAE,YAAqB;gBAC3B,OAAO,EAAE,IAAI;gBACb,aAAa,EAAE,uBAAuB;aACvC;YACD;gBACE,IAAI,EAAE,UAAmB;gBACzB,OAAO,EAAE,IAAI;gBACb,aAAa,EAAE,oBAAoB;aACpC;YACD;gBACE,IAAI,EAAE,UAAmB;gBACzB,OAAO,EAAE,IAAI;gBACb,IAAI,EAAE,eAAwB;gBAC9B,aAAa,EAAE,uBAAuB;aACvC;YACD;gBACE,IAAI,EAAE,OAAgB;gBACtB,OAAO,EAAE,IAAI;gBACb,IAAI,EAAE,eAAwB;gBAC9B,aAAa,EAAE,uBAAuB;aACvC;SACF;KACF,CAAC;IAEF,OAAO,EAAE,MAAM,EAAE,CAAC;AACpB,CAAC"}
|
package/dist/rc.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import i18n from "@nodesecure/i18n";
|
|
2
2
|
import * as vuln from "@nodesecure/vuln";
|
|
3
|
-
import
|
|
3
|
+
import { generateCIConfiguration, CiConfiguration, CiWarnings } from "./projects/ci.js";
|
|
4
|
+
import { generateReportConfiguration, ReportConfiguration, ReportChart } from "./projects/report.js";
|
|
4
5
|
export declare const JSONSchema: any;
|
|
5
6
|
export interface RC {
|
|
6
7
|
/** version of the rc package used to generate the nodesecurerc file */
|
|
@@ -22,35 +23,14 @@ export interface RC {
|
|
|
22
23
|
strategy?: vuln.Strategy.Kind;
|
|
23
24
|
/** NodeSecure ci Object configuration */
|
|
24
25
|
ci?: CiConfiguration;
|
|
26
|
+
/** NodeSecure report Object configuration */
|
|
27
|
+
report?: ReportConfiguration;
|
|
25
28
|
}
|
|
26
|
-
|
|
27
|
-
* Configuration dedicated for NodeSecure CI (or nsci)
|
|
28
|
-
* @see https://github.com/NodeSecure/ci
|
|
29
|
-
* @see https://github.com/NodeSecure/ci-action
|
|
30
|
-
*/
|
|
31
|
-
export interface CiConfiguration {
|
|
32
|
-
/**
|
|
33
|
-
* List of enabled reporters
|
|
34
|
-
* @see https://github.com/NodeSecure/ci#reporters
|
|
35
|
-
*/
|
|
36
|
-
reporters?: ("console" | "html")[];
|
|
37
|
-
vulnerabilities?: {
|
|
38
|
-
severity?: "medium" | "high" | "critical" | "all";
|
|
39
|
-
};
|
|
40
|
-
/**
|
|
41
|
-
* JS-X-Ray warnings configuration
|
|
42
|
-
* @see https://github.com/NodeSecure/js-x-ray#warnings-legends-v20
|
|
43
|
-
*/
|
|
44
|
-
warnings?: CiWarnings | Record<jsxray.kindWithValue | "unsafe-import", CiWarnings>;
|
|
45
|
-
}
|
|
46
|
-
export declare type CiWarnings = "off" | "error" | "warning";
|
|
47
|
-
export declare function generateCIConfiguration(): {
|
|
48
|
-
ci: CiConfiguration;
|
|
49
|
-
};
|
|
50
|
-
export declare type RCGenerationMode = "minimal" | "ci" | "complete";
|
|
29
|
+
export declare type RCGenerationMode = "minimal" | "ci" | "report" | "complete";
|
|
51
30
|
/**
|
|
52
31
|
* @example
|
|
53
32
|
* generateDefaultRC("complete");
|
|
54
|
-
* generateDefaultRC(["ci", "
|
|
33
|
+
* generateDefaultRC(["ci", "report"]); // minimal + ci + report
|
|
55
34
|
*/
|
|
56
35
|
export declare function generateDefaultRC(mode?: RCGenerationMode | RCGenerationMode[]): RC;
|
|
36
|
+
export { generateCIConfiguration, CiConfiguration, CiWarnings, generateReportConfiguration, ReportConfiguration, ReportChart };
|
package/dist/rc.js
CHANGED
|
@@ -1,21 +1,13 @@
|
|
|
1
1
|
// Import Internal Dependencies
|
|
2
|
-
import {
|
|
2
|
+
import { loadJSONSchemaSync } from "./schema/loader.js";
|
|
3
|
+
import { generateCIConfiguration } from "./projects/ci.js";
|
|
4
|
+
import { generateReportConfiguration } from "./projects/report.js";
|
|
3
5
|
// CONSTANTS
|
|
4
|
-
export const JSONSchema =
|
|
5
|
-
export function generateCIConfiguration() {
|
|
6
|
-
const ci = {
|
|
7
|
-
reporters: ["console"],
|
|
8
|
-
vulnerabilities: {
|
|
9
|
-
severity: "medium"
|
|
10
|
-
},
|
|
11
|
-
warnings: "error"
|
|
12
|
-
};
|
|
13
|
-
return { ci };
|
|
14
|
-
}
|
|
6
|
+
export const JSONSchema = loadJSONSchemaSync();
|
|
15
7
|
/**
|
|
16
8
|
* @example
|
|
17
9
|
* generateDefaultRC("complete");
|
|
18
|
-
* generateDefaultRC(["ci", "
|
|
10
|
+
* generateDefaultRC(["ci", "report"]); // minimal + ci + report
|
|
19
11
|
*/
|
|
20
12
|
export function generateDefaultRC(mode = "minimal") {
|
|
21
13
|
const modes = new Set(typeof mode === "string" ? [mode] : mode);
|
|
@@ -25,6 +17,7 @@ export function generateDefaultRC(mode = "minimal") {
|
|
|
25
17
|
strategy: "npm"
|
|
26
18
|
};
|
|
27
19
|
const complete = modes.has("complete");
|
|
28
|
-
return Object.assign(minimalRC, complete || modes.has("ci") ? generateCIConfiguration() : {});
|
|
20
|
+
return Object.assign(minimalRC, complete || modes.has("ci") ? generateCIConfiguration() : {}, complete || modes.has("report") ? generateReportConfiguration() : {});
|
|
29
21
|
}
|
|
22
|
+
export { generateCIConfiguration, generateReportConfiguration };
|
|
30
23
|
//# sourceMappingURL=rc.js.map
|
package/dist/rc.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rc.js","sourceRoot":"","sources":["../src/rc.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"rc.js","sourceRoot":"","sources":["../src/rc.ts"],"names":[],"mappings":"AAIA,+BAA+B;AAC/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,uBAAuB,EAA+B,MAAM,kBAAkB,CAAC;AACxF,OAAO,EAAE,2BAA2B,EAAoC,MAAM,sBAAsB,CAAC;AAErG,YAAY;AACZ,MAAM,CAAC,MAAM,UAAU,GAAG,kBAAkB,EAAE,CAAC;AA4B/C;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAAC,OAA8C,SAAS;IACvF,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IAEhE,MAAM,SAAS,GAAG;QAChB,OAAO,EAAE,OAAO;QAChB,IAAI,EAAE,SAAkB;QACxB,QAAQ,EAAE,KAAc;KACzB,CAAC;IACF,MAAM,QAAQ,GAAG,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IAEvC,OAAO,MAAM,CAAC,MAAM,CAClB,SAAS,EACT,QAAQ,IAAI,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,uBAAuB,EAAE,CAAC,CAAC,CAAC,EAAE,EAC5D,QAAQ,IAAI,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,2BAA2B,EAAE,CAAC,CAAC,CAAC,EAAE,CACrE,CAAC;AACJ,CAAC;AAED,OAAO,EACL,uBAAuB,EAIvB,2BAA2B,EAG5B,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "object",
|
|
3
|
+
"properties": {
|
|
4
|
+
"reporters": {
|
|
5
|
+
"type": "array",
|
|
6
|
+
"uniqueItems": true,
|
|
7
|
+
"items": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"enum": [
|
|
10
|
+
"html",
|
|
11
|
+
"console"
|
|
12
|
+
]
|
|
13
|
+
},
|
|
14
|
+
"default": [
|
|
15
|
+
"console"
|
|
16
|
+
]
|
|
17
|
+
},
|
|
18
|
+
"vulnerabilities": {
|
|
19
|
+
"type": "object",
|
|
20
|
+
"properties": {
|
|
21
|
+
"severity": {
|
|
22
|
+
"type": "string",
|
|
23
|
+
"enum": [
|
|
24
|
+
"medium",
|
|
25
|
+
"high",
|
|
26
|
+
"critical",
|
|
27
|
+
"all"
|
|
28
|
+
],
|
|
29
|
+
"default": "all"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"additionalProperties": false
|
|
33
|
+
},
|
|
34
|
+
"warnings": {
|
|
35
|
+
"default": "off",
|
|
36
|
+
"description": "JS-X-Ray warnings configuration",
|
|
37
|
+
"oneOf": [
|
|
38
|
+
{
|
|
39
|
+
"$ref": "#/$defs/ciWarnings"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"type": "object",
|
|
43
|
+
"minProperties": 1,
|
|
44
|
+
"patternProperties": {
|
|
45
|
+
"^[A-Za-z-]+$": {
|
|
46
|
+
"$ref": "#/$defs/ciWarnings"
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
]
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
"required": [
|
|
54
|
+
"reporters",
|
|
55
|
+
"warnings"
|
|
56
|
+
],
|
|
57
|
+
"additionalProperties": false
|
|
58
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
{
|
|
2
|
+
"title": "Report configuration",
|
|
3
|
+
"type": "object",
|
|
4
|
+
"additionalProperties": false,
|
|
5
|
+
"required": [
|
|
6
|
+
"title",
|
|
7
|
+
"logoUrl"
|
|
8
|
+
],
|
|
9
|
+
"properties": {
|
|
10
|
+
"theme": {
|
|
11
|
+
"type": "string",
|
|
12
|
+
"enum": [
|
|
13
|
+
"light",
|
|
14
|
+
"dark"
|
|
15
|
+
],
|
|
16
|
+
"default": "light"
|
|
17
|
+
},
|
|
18
|
+
"title": {
|
|
19
|
+
"type": "string",
|
|
20
|
+
"description": "Report title",
|
|
21
|
+
"default": "Default report title"
|
|
22
|
+
},
|
|
23
|
+
"logoUrl": {
|
|
24
|
+
"type": "string",
|
|
25
|
+
"description": "Logo",
|
|
26
|
+
"default": "https://avatars0.githubusercontent.com/u/29552883?s=200&v=4"
|
|
27
|
+
},
|
|
28
|
+
"includeTransitiveInternal": {
|
|
29
|
+
"type": "boolean",
|
|
30
|
+
"default": false,
|
|
31
|
+
"description": "Show/categorize internal dependencies as transitive"
|
|
32
|
+
},
|
|
33
|
+
"npm": {
|
|
34
|
+
"type": "object",
|
|
35
|
+
"additionalProperties": false,
|
|
36
|
+
"required": [
|
|
37
|
+
"organizationPrefix",
|
|
38
|
+
"packages"
|
|
39
|
+
],
|
|
40
|
+
"properties": {
|
|
41
|
+
"organizationPrefix": {
|
|
42
|
+
"type": "string",
|
|
43
|
+
"description": "NPM organization prefix starting with @"
|
|
44
|
+
},
|
|
45
|
+
"packages": {
|
|
46
|
+
"type": "array",
|
|
47
|
+
"items": {
|
|
48
|
+
"type": "string"
|
|
49
|
+
},
|
|
50
|
+
"uniqueItems": true
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
"git": {
|
|
55
|
+
"type": "object",
|
|
56
|
+
"additionalProperties": false,
|
|
57
|
+
"required": [
|
|
58
|
+
"organizationUrl",
|
|
59
|
+
"repositories"
|
|
60
|
+
],
|
|
61
|
+
"properties": {
|
|
62
|
+
"organizationUrl": {
|
|
63
|
+
"type": "string",
|
|
64
|
+
"description": "GitHub organization URL"
|
|
65
|
+
},
|
|
66
|
+
"repositories": {
|
|
67
|
+
"type": "array",
|
|
68
|
+
"description": "List of repositories (name are enough, no need to provide .git url or any equivalent)",
|
|
69
|
+
"items": {
|
|
70
|
+
"type": "string"
|
|
71
|
+
},
|
|
72
|
+
"uniqueItems": true
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
"reporters": {
|
|
77
|
+
"type": "array",
|
|
78
|
+
"uniqueItems": true,
|
|
79
|
+
"items": {
|
|
80
|
+
"type": "string",
|
|
81
|
+
"enum": [
|
|
82
|
+
"html",
|
|
83
|
+
"pdf"
|
|
84
|
+
]
|
|
85
|
+
},
|
|
86
|
+
"default": [
|
|
87
|
+
"html",
|
|
88
|
+
"pdf"
|
|
89
|
+
]
|
|
90
|
+
},
|
|
91
|
+
"charts": {
|
|
92
|
+
"type": "array",
|
|
93
|
+
"items": {
|
|
94
|
+
"$ref": "#/$defs/reportChart"
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "object",
|
|
3
|
+
"additionalProperties": false,
|
|
4
|
+
"required": [
|
|
5
|
+
"name"
|
|
6
|
+
],
|
|
7
|
+
"properties": {
|
|
8
|
+
"name": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"enum": ["Extensions", "Licenses", "Warnings", "Flags"]
|
|
11
|
+
},
|
|
12
|
+
"display": {
|
|
13
|
+
"type": "boolean",
|
|
14
|
+
"default": true
|
|
15
|
+
},
|
|
16
|
+
"type": {
|
|
17
|
+
"type": "string",
|
|
18
|
+
"enum": ["bar", "horizontalBar", "polarArea", "doughnut"],
|
|
19
|
+
"default": "bar",
|
|
20
|
+
"description": "Chart.js chart type."
|
|
21
|
+
},
|
|
22
|
+
"interpolation": {
|
|
23
|
+
"type": "string",
|
|
24
|
+
"description": "D3.js chromatic interpolation set of colors"
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function loadJSONSchemaSync(): any;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// Import Node.js Dependencies
|
|
2
|
+
import { readdirSync } from "node:fs";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
// Import Internal Dependencies
|
|
5
|
+
import { readJSONSync } from "../utils/index.js";
|
|
6
|
+
// CONSTANTS
|
|
7
|
+
const kDefsDirectory = new URL("./defs", import.meta.url);
|
|
8
|
+
function loadJSONSchemaDefinition($defs, fileName) {
|
|
9
|
+
const defName = path.basename(fileName, ".json");
|
|
10
|
+
const jsonSchema = readJSONSync(`./defs/${fileName}`, import.meta.url);
|
|
11
|
+
return { ...$defs, [defName]: jsonSchema };
|
|
12
|
+
}
|
|
13
|
+
export function loadJSONSchemaSync() {
|
|
14
|
+
const mainSchema = readJSONSync("./nodesecurerc.json", import.meta.url);
|
|
15
|
+
const $defs = readdirSync(kDefsDirectory)
|
|
16
|
+
.filter((fileName) => path.extname(fileName) === ".json")
|
|
17
|
+
.reduce(loadJSONSchemaDefinition, {});
|
|
18
|
+
return Object.assign(mainSchema, { $defs });
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=loader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loader.js","sourceRoot":"","sources":["../../src/schema/loader.ts"],"names":[],"mappings":"AAAA,8BAA8B;AAC9B,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,+BAA+B;AAC/B,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,YAAY;AACZ,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAE1D,SAAS,wBAAwB,CAAC,KAA0B,EAAE,QAAgB;IAC5E,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IACjD,MAAM,UAAU,GAAG,YAAY,CAAC,UAAU,QAAQ,EAAE,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAEvE,OAAO,EAAE,GAAG,KAAK,EAAE,CAAC,OAAO,CAAC,EAAE,UAAU,EAAE,CAAC;AAC7C,CAAC;AAED,MAAM,UAAU,kBAAkB;IAChC,MAAM,UAAU,GAAG,YAAY,CAAC,qBAAqB,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACxE,MAAM,KAAK,GAAG,WAAW,CAAC,cAAc,CAAC;SACtC,MAAM,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,OAAO,CAAC;SACxD,MAAM,CAAC,wBAAwB,EAAE,EAAE,CAAC,CAAC;IAExC,OAAO,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;AAC9C,CAAC"}
|
|
@@ -7,68 +7,33 @@
|
|
|
7
7
|
},
|
|
8
8
|
"i18n": {
|
|
9
9
|
"type": "string",
|
|
10
|
-
"enum": [
|
|
10
|
+
"enum": [
|
|
11
|
+
"french",
|
|
12
|
+
"english"
|
|
13
|
+
],
|
|
11
14
|
"default": "english",
|
|
12
15
|
"description": "Language to use for i18n"
|
|
13
16
|
},
|
|
14
17
|
"strategy": {
|
|
15
18
|
"type": "string",
|
|
16
|
-
"enum": [
|
|
19
|
+
"enum": [
|
|
20
|
+
"npm",
|
|
21
|
+
"node",
|
|
22
|
+
"snyk",
|
|
23
|
+
"none"
|
|
24
|
+
],
|
|
17
25
|
"default": "npm",
|
|
18
26
|
"description": "Vulnerability strategy to use"
|
|
19
27
|
},
|
|
20
28
|
"ci": {
|
|
21
29
|
"$ref": "#/$defs/ci"
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
"required": ["version"],
|
|
25
|
-
"additionalProperties": false,
|
|
26
|
-
"$defs": {
|
|
27
|
-
"ci": {
|
|
28
|
-
"type": "object",
|
|
29
|
-
"properties": {
|
|
30
|
-
"reporters": {
|
|
31
|
-
"type": "array",
|
|
32
|
-
"minItems": 1,
|
|
33
|
-
"maxItems": 2,
|
|
34
|
-
"items": {
|
|
35
|
-
"type": "string",
|
|
36
|
-
"enum": ["html", "console"]
|
|
37
|
-
},
|
|
38
|
-
"default": ["console"]
|
|
39
|
-
},
|
|
40
|
-
"vulnerabilities": {
|
|
41
|
-
"type": "object",
|
|
42
|
-
"properties": {
|
|
43
|
-
"severity": {
|
|
44
|
-
"type": "string",
|
|
45
|
-
"enum": ["medium", "high", "critical", "all"],
|
|
46
|
-
"default": "all"
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
"additionalProperties": false
|
|
50
|
-
},
|
|
51
|
-
"warnings": {
|
|
52
|
-
"default": "off",
|
|
53
|
-
"description": "JS-X-Ray warnings configuration",
|
|
54
|
-
"oneOf": [
|
|
55
|
-
{ "$ref": "#/$defs/ciWarnings" },
|
|
56
|
-
{
|
|
57
|
-
"type": "object",
|
|
58
|
-
"minProperties": 1,
|
|
59
|
-
"patternProperties": {
|
|
60
|
-
"^[A-Za-z-]+$": { "$ref": "#/$defs/ciWarnings" }
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
]
|
|
64
|
-
}
|
|
65
|
-
},
|
|
66
|
-
"required": ["reporters", "warnings"],
|
|
67
|
-
"additionalProperties": false
|
|
68
30
|
},
|
|
69
|
-
"
|
|
70
|
-
"
|
|
71
|
-
"enum": ["off", "error", "warning"]
|
|
31
|
+
"report": {
|
|
32
|
+
"$ref": "#/$defs/report"
|
|
72
33
|
}
|
|
73
|
-
}
|
|
34
|
+
},
|
|
35
|
+
"required": [
|
|
36
|
+
"version"
|
|
37
|
+
],
|
|
38
|
+
"additionalProperties": false
|
|
74
39
|
}
|
package/package.json
CHANGED
|
@@ -1,67 +1,69 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@nodesecure/rc",
|
|
3
|
-
"version": "1.0
|
|
4
|
-
"description": "NodeSecure runtime configuration",
|
|
5
|
-
"exports": "./dist/index.js",
|
|
6
|
-
"type": "module",
|
|
7
|
-
"types": "./dist/index.d.ts",
|
|
8
|
-
"engines": {
|
|
9
|
-
"node": ">=16"
|
|
10
|
-
},
|
|
11
|
-
"scripts": {
|
|
12
|
-
"build": "tsc",
|
|
13
|
-
"prepublishOnly": "npm run build",
|
|
14
|
-
"test": "mocha --parallel && npm run test:tsd",
|
|
15
|
-
"test:tsd": "npm run build && tsd",
|
|
16
|
-
"coverage": "c8 -r html npm test",
|
|
17
|
-
"lint": "cross-env eslint src/*.ts"
|
|
18
|
-
},
|
|
19
|
-
"repository": {
|
|
20
|
-
"type": "git",
|
|
21
|
-
"url": "git+https://github.com/NodeSecure/rc.git"
|
|
22
|
-
},
|
|
23
|
-
"files": [
|
|
24
|
-
"dist"
|
|
25
|
-
],
|
|
26
|
-
"keywords": [
|
|
27
|
-
"rc",
|
|
28
|
-
"config",
|
|
29
|
-
"configuration"
|
|
30
|
-
],
|
|
31
|
-
"author": "GENTILHOMME Thomas <gentilhomme.thomas@gmail.com>",
|
|
32
|
-
"license": "MIT",
|
|
33
|
-
"bugs": {
|
|
34
|
-
"url": "https://github.com/NodeSecure/rc/issues"
|
|
35
|
-
},
|
|
36
|
-
"homepage": "https://github.com/NodeSecure/rc#readme",
|
|
37
|
-
"devDependencies": {
|
|
38
|
-
"@nodesecure/eslint-config": "^1.3.1",
|
|
39
|
-
"@types/chai": "^4.3.0",
|
|
40
|
-
"@types/
|
|
41
|
-
"@types/
|
|
42
|
-
"@types/
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
"@nodesecure/
|
|
57
|
-
"@
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@nodesecure/rc",
|
|
3
|
+
"version": "1.1.0",
|
|
4
|
+
"description": "NodeSecure runtime configuration",
|
|
5
|
+
"exports": "./dist/index.js",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"engines": {
|
|
9
|
+
"node": ">=16"
|
|
10
|
+
},
|
|
11
|
+
"scripts": {
|
|
12
|
+
"build": "tsc",
|
|
13
|
+
"prepublishOnly": "npm run build",
|
|
14
|
+
"test": "mocha --parallel && npm run test:tsd",
|
|
15
|
+
"test:tsd": "npm run build && tsd",
|
|
16
|
+
"coverage": "c8 -r html npm test",
|
|
17
|
+
"lint": "cross-env eslint src/*.ts"
|
|
18
|
+
},
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "git+https://github.com/NodeSecure/rc.git"
|
|
22
|
+
},
|
|
23
|
+
"files": [
|
|
24
|
+
"dist"
|
|
25
|
+
],
|
|
26
|
+
"keywords": [
|
|
27
|
+
"rc",
|
|
28
|
+
"config",
|
|
29
|
+
"configuration"
|
|
30
|
+
],
|
|
31
|
+
"author": "GENTILHOMME Thomas <gentilhomme.thomas@gmail.com>",
|
|
32
|
+
"license": "MIT",
|
|
33
|
+
"bugs": {
|
|
34
|
+
"url": "https://github.com/NodeSecure/rc/issues"
|
|
35
|
+
},
|
|
36
|
+
"homepage": "https://github.com/NodeSecure/rc#readme",
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"@nodesecure/eslint-config": "^1.3.1",
|
|
39
|
+
"@types/chai": "^4.3.0",
|
|
40
|
+
"@types/lodash.merge": "^4.6.6",
|
|
41
|
+
"@types/mocha": "^9.1.0",
|
|
42
|
+
"@types/node": "^17.0.13",
|
|
43
|
+
"@types/zen-observable": "^0.8.3",
|
|
44
|
+
"ajv": "^8.9.0",
|
|
45
|
+
"c8": "^7.11.0",
|
|
46
|
+
"chai": "^4.3.6",
|
|
47
|
+
"eslint": "^8.7.0",
|
|
48
|
+
"lodash.merge": "^4.6.2",
|
|
49
|
+
"mocha": "^9.2.0",
|
|
50
|
+
"tape": "^5.5.0",
|
|
51
|
+
"ts-node": "^10.4.0",
|
|
52
|
+
"tsd": "^0.19.1",
|
|
53
|
+
"typescript": "^4.5.5"
|
|
54
|
+
},
|
|
55
|
+
"dependencies": {
|
|
56
|
+
"@nodesecure/i18n": "^1.2.1",
|
|
57
|
+
"@nodesecure/js-x-ray": "^4.2.1",
|
|
58
|
+
"@nodesecure/vuln": "^1.5.0",
|
|
59
|
+
"@slimio/config": "^1.0.1",
|
|
60
|
+
"ts-results": "^3.3.0",
|
|
61
|
+
"type-fest": "^2.11.0"
|
|
62
|
+
},
|
|
63
|
+
"tsd": {
|
|
64
|
+
"directory": "test/types",
|
|
65
|
+
"compilerOptions": {
|
|
66
|
+
"esModuleInterop": true
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|