@coana-tech/cli 14.0.7 → 14.0.8
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/cli.js +21 -7
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -193969,7 +193969,7 @@ var require_version = __commonJS({
|
|
|
193969
193969
|
"use strict";
|
|
193970
193970
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
193971
193971
|
exports2.version = void 0;
|
|
193972
|
-
exports2.version = "14.0.
|
|
193972
|
+
exports2.version = "14.0.8";
|
|
193973
193973
|
}
|
|
193974
193974
|
});
|
|
193975
193975
|
|
|
@@ -194033,18 +194033,27 @@ var require_cli_core = __commonJS({
|
|
|
194033
194033
|
logger_singleton_1.logger.warn("--write-report-to-file is deprecated. Please use --output json instead");
|
|
194034
194034
|
}
|
|
194035
194035
|
if (!this.options.offlineDatabase && !this.options.apiKey) {
|
|
194036
|
-
throw new Error("API key is required
|
|
194036
|
+
throw new Error("An API key is required to run the Coana CLI");
|
|
194037
|
+
}
|
|
194038
|
+
if (this.options.apiKey) {
|
|
194039
|
+
const checkIfApiKeyIsEmptyMessage = "You may be trying to provide the API key through an environment variable or CI secret which is either undefined or empty.";
|
|
194040
|
+
if (this.options.apiKey.length < 15 && this.options.apiKey.startsWith("-")) {
|
|
194041
|
+
throw new Error(`The provided API key '${this.options.apiKey}' is invalid. ${checkIfApiKeyIsEmptyMessage}`);
|
|
194042
|
+
}
|
|
194043
|
+
if (this.options.apiKey.length < 20 || this.options.apiKey.length > 21) {
|
|
194044
|
+
throw new Error(`The provided API key is invalid. ${checkIfApiKeyIsEmptyMessage}`);
|
|
194045
|
+
}
|
|
194037
194046
|
}
|
|
194038
194047
|
if (!this.options.repoUrl && !this.options.projectName && !this.options.disableReportSubmission) {
|
|
194039
|
-
throw new Error("Either --repo-url or --project-name is required for dashboard integration. Use --disable-report-submission to skip report submission");
|
|
194048
|
+
throw new Error("Either --repo-url or --project-name is required for dashboard integration. Use --disable-report-submission to skip report submission.");
|
|
194040
194049
|
}
|
|
194041
194050
|
if (this.options.disableReportSubmission && !this.options.outputDir && !this.options.printReport) {
|
|
194042
|
-
throw new Error("Either --output-dir or --print-report is required when --disable-report-submission is used");
|
|
194051
|
+
throw new Error("Either --output-dir or --print-report is required when --disable-report-submission is used.");
|
|
194043
194052
|
}
|
|
194044
194053
|
if (this.options.ecosystems)
|
|
194045
194054
|
this.options.ecosystems.forEach((ecosystem) => {
|
|
194046
194055
|
if (!ecosystem_support_1.ECOSYSTEMS_WITH_TRADITIONAL_SCA_SUPPORT.includes(ecosystem)) {
|
|
194047
|
-
throw new Error(`Invalid ecosystem: ${ecosystem}
|
|
194056
|
+
throw new Error(`Invalid ecosystem: ${ecosystem}.`);
|
|
194048
194057
|
}
|
|
194049
194058
|
});
|
|
194050
194059
|
}
|
|
@@ -194052,7 +194061,12 @@ var require_cli_core = __commonJS({
|
|
|
194052
194061
|
this.coanaLogPath = (0, path_1.join)(await (0, tmp_file_1.createTmpDirectory)("coana-cli-"), "coana-log.txt");
|
|
194053
194062
|
logger_singleton_1.logger.initWinstonLogger(this.options.debug, this.coanaLogPath);
|
|
194054
194063
|
logger_singleton_1.logger.silent = this.options.silent;
|
|
194055
|
-
|
|
194064
|
+
try {
|
|
194065
|
+
await this.initialize();
|
|
194066
|
+
} catch (e) {
|
|
194067
|
+
logger_singleton_1.logger.error(e.message);
|
|
194068
|
+
process.exit(1);
|
|
194069
|
+
}
|
|
194056
194070
|
this.spinner.start();
|
|
194057
194071
|
try {
|
|
194058
194072
|
if (this.shareWithDashboard) {
|
|
@@ -194066,7 +194080,7 @@ var require_cli_core = __commonJS({
|
|
|
194066
194080
|
return report;
|
|
194067
194081
|
} catch (e) {
|
|
194068
194082
|
await this.spinner.fail();
|
|
194069
|
-
logger_singleton_1.logger.error("CLI failed with error:", e);
|
|
194083
|
+
logger_singleton_1.logger.error("CLI failed with error:", e.message);
|
|
194070
194084
|
await this.shareErrorLogWithDashboard(e, true);
|
|
194071
194085
|
throw e;
|
|
194072
194086
|
}
|