@nodesecure/rc 1.0.0 → 1.2.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 +19 -2
- package/dist/constants.d.ts +1 -0
- package/dist/constants.js +1 -0
- package/dist/constants.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- 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 +11 -27
- package/dist/rc.js +17 -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 +39 -0
- package/package.json +69 -67
package/README.md
CHANGED
|
@@ -111,6 +111,16 @@ export interface writePartialPayload {
|
|
|
111
111
|
export type writeOptions = writeCompletePayload | writePartialPayload;
|
|
112
112
|
```
|
|
113
113
|
|
|
114
|
+
### homedir(): string
|
|
115
|
+
|
|
116
|
+
Dedicated directory for NodeSecure to store the configuration in the os HOME directory.
|
|
117
|
+
|
|
118
|
+
```ts
|
|
119
|
+
import * as RC from "@nodesecure/rc";
|
|
120
|
+
|
|
121
|
+
const homedir = RC.homedir();
|
|
122
|
+
```
|
|
123
|
+
|
|
114
124
|
### CONSTANTS
|
|
115
125
|
|
|
116
126
|
```ts
|
|
@@ -125,7 +135,7 @@ assert.strictEqual(RC.CONSTANTS.CONFIGURATION_NAME, ".nodesecurerc");
|
|
|
125
135
|
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
136
|
|
|
127
137
|
```ts
|
|
128
|
-
export type RCGenerationMode = "minimal" | "ci" | "complete";
|
|
138
|
+
export type RCGenerationMode = "minimal" | "ci" | "report" | "complete";
|
|
129
139
|
```
|
|
130
140
|
|
|
131
141
|
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 +145,7 @@ Note that you can combine several modes:
|
|
|
135
145
|
```ts
|
|
136
146
|
import * as RC from "@nodesecure/rc";
|
|
137
147
|
|
|
138
|
-
await RC.read(void 0, { createMode: ["ci", "
|
|
148
|
+
await RC.read(void 0, { createMode: ["ci", "report"] })
|
|
139
149
|
```
|
|
140
150
|
|
|
141
151
|
## JSON Schema
|
|
@@ -160,6 +170,13 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
|
|
|
160
170
|
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
|
|
161
171
|
<!-- prettier-ignore-start -->
|
|
162
172
|
<!-- markdownlint-disable -->
|
|
173
|
+
<table>
|
|
174
|
+
<tr>
|
|
175
|
+
<td align="center"><a href="https://www.linkedin.com/in/thomas-gentilhomme/"><img src="https://avatars.githubusercontent.com/u/4438263?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Gentilhomme</b></sub></a><br /><a href="https://github.com/NodeSecure/rc/commits?author=fraxken" title="Code">💻</a> <a href="https://github.com/NodeSecure/rc/issues?q=author%3Afraxken" title="Bug reports">🐛</a> <a href="https://github.com/NodeSecure/rc/pulls?q=is%3Apr+reviewed-by%3Afraxken" title="Reviewed Pull Requests">👀</a> <a href="https://github.com/NodeSecure/rc/commits?author=fraxken" title="Documentation">📖</a> <a href="#security-fraxken" title="Security">🛡️</a></td>
|
|
176
|
+
<td align="center"><a href="https://dev.to/antoinecoulon"><img src="https://avatars.githubusercontent.com/u/43391199?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Antoine Coulon</b></sub></a><br /><a href="https://github.com/NodeSecure/rc/commits?author=antoine-coulon" title="Code">💻</a> <a href="https://github.com/NodeSecure/rc/issues?q=author%3Aantoine-coulon" title="Bug reports">🐛</a> <a href="https://github.com/NodeSecure/rc/pulls?q=is%3Apr+reviewed-by%3Aantoine-coulon" title="Reviewed Pull Requests">👀</a></td>
|
|
177
|
+
<td align="center"><a href="https://github.com/PierreDemailly"><img src="https://avatars.githubusercontent.com/u/39910767?v=4?s=100" width="100px;" alt=""/><br /><sub><b>PierreD</b></sub></a><br /><a href="https://github.com/NodeSecure/rc/commits?author=PierreDemailly" title="Code">💻</a></td>
|
|
178
|
+
</tr>
|
|
179
|
+
</table>
|
|
163
180
|
|
|
164
181
|
<!-- markdownlint-restore -->
|
|
165
182
|
<!-- prettier-ignore-end -->
|
package/dist/constants.d.ts
CHANGED
package/dist/constants.js
CHANGED
package/dist/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,kBAAkB,GAAG,eAAe,CAAC;AAClD,MAAM,CAAC,MAAM,8BAA8B,GAAG,YAAY,CAAC"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAC;AAE5C,OAAO,EAAM,UAAU,EAAE,MAAM,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAC;AAE5C,OAAO,EAAM,UAAU,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -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.WarningName, 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,18 @@ 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
|
+
/**
|
|
37
|
+
* Dedicated directory for NodeSecure to store the configuration in the os HOME directory.
|
|
38
|
+
*/
|
|
39
|
+
export declare function homedir(): string;
|
|
40
|
+
export { generateCIConfiguration, CiConfiguration, CiWarnings, generateReportConfiguration, ReportConfiguration, ReportChart };
|
package/dist/rc.js
CHANGED
|
@@ -1,21 +1,17 @@
|
|
|
1
|
+
// Import Node.js Dependencies
|
|
2
|
+
import os from "node:os";
|
|
3
|
+
import path from "node:path";
|
|
1
4
|
// Import Internal Dependencies
|
|
2
|
-
import {
|
|
5
|
+
import { GLOBAL_CONFIGURATION_DIRECTORY } from "./constants.js";
|
|
6
|
+
import { loadJSONSchemaSync } from "./schema/loader.js";
|
|
7
|
+
import { generateCIConfiguration } from "./projects/ci.js";
|
|
8
|
+
import { generateReportConfiguration } from "./projects/report.js";
|
|
3
9
|
// 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
|
-
}
|
|
10
|
+
export const JSONSchema = loadJSONSchemaSync();
|
|
15
11
|
/**
|
|
16
12
|
* @example
|
|
17
13
|
* generateDefaultRC("complete");
|
|
18
|
-
* generateDefaultRC(["ci", "
|
|
14
|
+
* generateDefaultRC(["ci", "report"]); // minimal + ci + report
|
|
19
15
|
*/
|
|
20
16
|
export function generateDefaultRC(mode = "minimal") {
|
|
21
17
|
const modes = new Set(typeof mode === "string" ? [mode] : mode);
|
|
@@ -25,6 +21,13 @@ export function generateDefaultRC(mode = "minimal") {
|
|
|
25
21
|
strategy: "npm"
|
|
26
22
|
};
|
|
27
23
|
const complete = modes.has("complete");
|
|
28
|
-
return Object.assign(minimalRC, complete || modes.has("ci") ? generateCIConfiguration() : {});
|
|
24
|
+
return Object.assign(minimalRC, complete || modes.has("ci") ? generateCIConfiguration() : {}, complete || modes.has("report") ? generateReportConfiguration() : {});
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Dedicated directory for NodeSecure to store the configuration in the os HOME directory.
|
|
28
|
+
*/
|
|
29
|
+
export function homedir() {
|
|
30
|
+
return path.join(os.homedir(), GLOBAL_CONFIGURATION_DIRECTORY);
|
|
29
31
|
}
|
|
32
|
+
export { generateCIConfiguration, generateReportConfiguration };
|
|
30
33
|
//# 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":"AAAA,8BAA8B;AAC9B,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAM7B,+BAA+B;AAC/B,OAAO,EAAE,8BAA8B,EAAE,MAAM,gBAAgB,CAAC;AAChE,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;;GAEG;AACH,MAAM,UAAU,OAAO;IACrB,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,8BAA8B,CAAC,CAAC;AACjE,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"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "object",
|
|
3
|
+
"properties": {
|
|
4
|
+
"version": {
|
|
5
|
+
"type": "string",
|
|
6
|
+
"description": "version of the rc package used to generate the nodesecurerc file"
|
|
7
|
+
},
|
|
8
|
+
"i18n": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"enum": [
|
|
11
|
+
"french",
|
|
12
|
+
"english"
|
|
13
|
+
],
|
|
14
|
+
"default": "english",
|
|
15
|
+
"description": "Language to use for i18n"
|
|
16
|
+
},
|
|
17
|
+
"strategy": {
|
|
18
|
+
"type": "string",
|
|
19
|
+
"enum": [
|
|
20
|
+
"npm",
|
|
21
|
+
"node",
|
|
22
|
+
"snyk",
|
|
23
|
+
"none"
|
|
24
|
+
],
|
|
25
|
+
"default": "npm",
|
|
26
|
+
"description": "Vulnerability strategy to use"
|
|
27
|
+
},
|
|
28
|
+
"ci": {
|
|
29
|
+
"$ref": "#/$defs/ci"
|
|
30
|
+
},
|
|
31
|
+
"report": {
|
|
32
|
+
"$ref": "#/$defs/report"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"required": [
|
|
36
|
+
"version"
|
|
37
|
+
],
|
|
38
|
+
"additionalProperties": false
|
|
39
|
+
}
|
package/package.json
CHANGED
|
@@ -1,67 +1,69 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@nodesecure/rc",
|
|
3
|
-
"version": "1.
|
|
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.
|
|
39
|
-
"@types/chai": "^4.3.
|
|
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.2.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.4.1",
|
|
39
|
+
"@types/chai": "^4.3.1",
|
|
40
|
+
"@types/lodash.merge": "^4.6.7",
|
|
41
|
+
"@types/mocha": "^9.1.1",
|
|
42
|
+
"@types/node": "^18.0.0",
|
|
43
|
+
"@types/zen-observable": "^0.8.3",
|
|
44
|
+
"ajv": "^8.11.0",
|
|
45
|
+
"c8": "^7.11.3",
|
|
46
|
+
"chai": "^4.3.6",
|
|
47
|
+
"eslint": "^8.18.0",
|
|
48
|
+
"lodash.merge": "^4.6.2",
|
|
49
|
+
"mocha": "^9.2.2",
|
|
50
|
+
"tape": "^5.5.3",
|
|
51
|
+
"ts-node": "^10.8.1",
|
|
52
|
+
"tsd": "^0.21.0",
|
|
53
|
+
"typescript": "^4.7.4"
|
|
54
|
+
},
|
|
55
|
+
"dependencies": {
|
|
56
|
+
"@nodesecure/i18n": "^1.5.0",
|
|
57
|
+
"@nodesecure/js-x-ray": "^5.0.1",
|
|
58
|
+
"@nodesecure/vuln": "^1.7.0",
|
|
59
|
+
"@slimio/config": "^1.0.1",
|
|
60
|
+
"ts-results": "^3.3.0",
|
|
61
|
+
"type-fest": "^2.13.1"
|
|
62
|
+
},
|
|
63
|
+
"tsd": {
|
|
64
|
+
"directory": "test/types",
|
|
65
|
+
"compilerOptions": {
|
|
66
|
+
"esModuleInterop": true
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|