audit-notes-cli 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +17 -4
- package/package.json +3 -2
package/dist/cli.js
CHANGED
|
@@ -16,6 +16,10 @@ const sarif_1 = require("./report/sarif");
|
|
|
16
16
|
const profiles_1 = require("./profiles/profiles");
|
|
17
17
|
const recommendations_1 = require("./paid/recommendations");
|
|
18
18
|
const fixHints_1 = require("./paid/fixHints");
|
|
19
|
+
/* ===================== VERSION ===================== */
|
|
20
|
+
const pkg = JSON.parse(fs_1.default.readFileSync(path_1.default.join(__dirname, "../package.json"), "utf8"));
|
|
21
|
+
const VERSION = pkg.version;
|
|
22
|
+
/* ===================== CLI ARGS ===================== */
|
|
19
23
|
const args = process.argv.slice(2);
|
|
20
24
|
const cmd = args[0] ?? "run";
|
|
21
25
|
const useSarif = args.includes("--sarif");
|
|
@@ -36,6 +40,7 @@ function getProfile() {
|
|
|
36
40
|
}
|
|
37
41
|
return p;
|
|
38
42
|
}
|
|
43
|
+
/* ===================== CORE ===================== */
|
|
39
44
|
async function run() {
|
|
40
45
|
if (wantRecommendations || wantFixHints) {
|
|
41
46
|
(0, license_1.validateLicense)();
|
|
@@ -76,12 +81,20 @@ async function run() {
|
|
|
76
81
|
fs_1.default.writeFileSync("output/fix-hints.json", JSON.stringify((0, fixHints_1.generateFixHints)(current), null, 2));
|
|
77
82
|
}
|
|
78
83
|
}
|
|
84
|
+
/* ===================== ENTRY ===================== */
|
|
79
85
|
async function main() {
|
|
80
|
-
if (
|
|
86
|
+
if (args.includes("--version") || args.includes("-v")) {
|
|
87
|
+
console.log(`audit-notes v${VERSION}`);
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
if (cmd === "run") {
|
|
81
91
|
await run();
|
|
82
|
-
|
|
92
|
+
}
|
|
93
|
+
else if (cmd === "check") {
|
|
83
94
|
(0, license_1.validateLicense)();
|
|
84
|
-
|
|
85
|
-
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
console.log(`audit-notes v${VERSION}`);
|
|
98
|
+
}
|
|
86
99
|
}
|
|
87
100
|
main();
|
package/package.json
CHANGED