@coana-tech/cli 13.17.9 → 13.17.11

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.
Files changed (2) hide show
  1. package/cli.js +28 -15
  2. package/package.json +5 -2
package/cli.js CHANGED
@@ -125406,6 +125406,7 @@ async function createReport(repoUrl, projectName, cliVersion, commitSha, branchN
125406
125406
  )).data.id;
125407
125407
  }
125408
125408
  async function submitSubprojects(subprojects, reportId, apiKey) {
125409
+ if (!reportId) return;
125409
125410
  try {
125410
125411
  await sendPostRequest(`${coanaAPIUrls.REPORT_SUBPROJECTS.replace(":reportId", reportId)}`, apiKey, {}, subprojects);
125411
125412
  } catch (e) {
@@ -125414,6 +125415,7 @@ async function submitSubprojects(subprojects, reportId, apiKey) {
125414
125415
  }
125415
125416
  }
125416
125417
  async function createAnalysisMetadata(subprojectPath, workspacePath, ecosystem, analysisMetadata, reportId, apiKey) {
125418
+ if (!reportId) return;
125417
125419
  try {
125418
125420
  await sendPostRequest(
125419
125421
  coanaAPIUrls.CREATE_ANALYSIS_METADATA.replace(":reportId", reportId),
@@ -125426,6 +125428,7 @@ async function createAnalysisMetadata(subprojectPath, workspacePath, ecosystem,
125426
125428
  }
125427
125429
  }
125428
125430
  async function getBucketsForLastReport(subprojectPath, workspacePath, newReportId, apiKey) {
125431
+ if (!newReportId) return;
125429
125432
  try {
125430
125433
  return (await axios_default.get(coanaAPIUrls.GET_LATEST_BUCKETS, {
125431
125434
  headers: {
@@ -125446,6 +125449,7 @@ async function getBucketsForLastReport(subprojectPath, workspacePath, newReportI
125446
125449
  }
125447
125450
  }
125448
125451
  async function getPreviousAnalysisResults(subprojectPath, workspacePath, newReportId, apiKey) {
125452
+ if (!newReportId) return;
125449
125453
  try {
125450
125454
  return (await axios_default.get(coanaAPIUrls.GET_LATEST_RESULTS, {
125451
125455
  headers: {
@@ -125462,10 +125466,14 @@ async function getPreviousAnalysisResults(subprojectPath, workspacePath, newRepo
125462
125466
  newReportId,
125463
125467
  apiKey
125464
125468
  );
125465
- logger.warn("Unable to fetch cached configurations from previous runs - Analysis will continue without cache:", e.message);
125469
+ logger.warn(
125470
+ "Unable to fetch cached configurations from previous runs - Analysis will continue without cache:",
125471
+ e.message
125472
+ );
125466
125473
  }
125467
125474
  }
125468
125475
  async function sendRegressionsToDashboard(regressions, subprojectPath, workspacePath, reportId, apiKey) {
125476
+ if (!reportId) return;
125469
125477
  try {
125470
125478
  await sendPostRequest(
125471
125479
  coanaAPIUrls.CREATE_REGRESSIONS.replace(":reportId", reportId),
@@ -125481,10 +125489,14 @@ async function sendRegressionsToDashboard(regressions, subprojectPath, workspace
125481
125489
  reportId,
125482
125490
  apiKey
125483
125491
  );
125484
- logger.warn("Unable to send regressions from experimental runs to Coana - The analysis will continue with non-experimental scans:", e.message);
125492
+ logger.warn(
125493
+ "Unable to send regressions from experimental runs to Coana - The analysis will continue with non-experimental scans:",
125494
+ e.message
125495
+ );
125485
125496
  }
125486
125497
  }
125487
125498
  async function getExperimentName(subprojectPath, workspacePath, ecosystem, reportId, apiKey) {
125499
+ if (!reportId) return;
125488
125500
  try {
125489
125501
  return (await axios_default.get(coanaAPIUrls.GET_EXPERIMENT_NAME, {
125490
125502
  headers: {
@@ -125504,6 +125516,7 @@ async function getExperimentName(subprojectPath, workspacePath, ecosystem, repor
125504
125516
  }
125505
125517
  }
125506
125518
  async function sendCLIProgressToDashboard(cliProgressEvent, isStartEvent, reportId, apiKey) {
125519
+ if (!reportId) return;
125507
125520
  try {
125508
125521
  await sendPostRequest(
125509
125522
  coanaAPIUrls.REPORT_CLI_PROGRESS.replace(":reportId", reportId),
@@ -125516,6 +125529,7 @@ async function sendCLIProgressToDashboard(cliProgressEvent, isStartEvent, report
125516
125529
  }
125517
125530
  }
125518
125531
  async function sendWarningToDashboard(message2, data2, additionalData, reportId, apiKey) {
125532
+ if (!reportId) return;
125519
125533
  try {
125520
125534
  await sendPostRequest(coanaAPIUrls.REPORT_WARNING, apiKey, { reportId }, { message: message2, data: data2, additionalData });
125521
125535
  } catch (error) {
@@ -185152,7 +185166,7 @@ var require_version = __commonJS({
185152
185166
  "use strict";
185153
185167
  Object.defineProperty(exports2, "__esModule", { value: true });
185154
185168
  exports2.version = void 0;
185155
- exports2.version = "13.17.9";
185169
+ exports2.version = "13.17.11";
185156
185170
  }
185157
185171
  });
185158
185172
 
@@ -185165,6 +185179,7 @@ var require_cli_core = __commonJS({
185165
185179
  };
185166
185180
  Object.defineProperty(exports2, "__esModule", { value: true });
185167
185181
  exports2.CliCore = void 0;
185182
+ var os_1 = __importDefault2(require("os"));
185168
185183
  var fs_1 = require("fs");
185169
185184
  var promises_12 = require("fs/promises");
185170
185185
  var kleur_1 = __importDefault2(require_kleur());
@@ -185306,11 +185321,10 @@ var require_cli_core = __commonJS({
185306
185321
  const manager = await project_manager_1.ProjectManager.create(this.rootWorkingDirectory, otherModulesCommunicator, this.options.ecosystems, this.options.includeDirs, this.options.excludeDirs, this.options.changedFiles);
185307
185322
  this.sendProgress("CREATE_PROJECT_MANAGER", false);
185308
185323
  const { reachabilitySupport, traditionalScaSupport, noSupport } = manager.getSubprojectsWithWorkspacePaths();
185309
- if (this.shareWithDashboard)
185310
- (0, dashboard_integration_1.submitSubprojects)([...reachabilitySupport, ...traditionalScaSupport, ...noSupport].map((sp) => ({
185311
- ...sp,
185312
- subprojectPath: (0, path_1.relative)(this.rootWorkingDirectory, sp.subprojectPath) || "."
185313
- })), this.reportId, this.options.apiKey);
185324
+ (0, dashboard_integration_1.submitSubprojects)([...reachabilitySupport, ...traditionalScaSupport, ...noSupport].map((sp) => ({
185325
+ ...sp,
185326
+ subprojectPath: (0, path_1.relative)(this.rootWorkingDirectory, sp.subprojectPath) || "."
185327
+ })), this.reportId, this.options.apiKey);
185314
185328
  for (const unsupported of noSupport)
185315
185329
  logger_singleton_1.logger.warn(unsupported.unsupportedMsg);
185316
185330
  const includeScaOnlyMsg = `Coana found some projects where it supports traditional SCA, but the reachability analysis is not yet supported. Use --include-projects-with-no-reachability-support to conduct traditional SCA on these projects`;
@@ -185375,6 +185389,7 @@ var require_cli_core = __commonJS({
185375
185389
  "concurrency",
185376
185390
  "excludeDirs"
185377
185391
  ]), null, 2));
185392
+ logger_singleton_1.logger.info("available memory: %i MiB", os_1.default.freemem() / (1024 * 1024));
185378
185393
  }
185379
185394
  async createMetadataForReport(manager, startTime) {
185380
185395
  const metadata = {
@@ -185478,13 +185493,11 @@ var require_cli_core = __commonJS({
185478
185493
  return res;
185479
185494
  }
185480
185495
  async sendProgress(type, isStartEvent, subprojectPath, workspacePath) {
185481
- if (this.shareWithDashboard) {
185482
- await (0, dashboard_integration_1.sendCLIProgressToDashboard)({
185483
- type,
185484
- ...subprojectPath ? { subprojectPath: (0, path_1.relative)(this.rootWorkingDirectory, subprojectPath) || "." } : {},
185485
- ...workspacePath ? { workspacePath } : {}
185486
- }, isStartEvent, this.reportId, this.options.apiKey);
185487
- }
185496
+ await (0, dashboard_integration_1.sendCLIProgressToDashboard)({
185497
+ type,
185498
+ ...subprojectPath ? { subprojectPath: (0, path_1.relative)(this.rootWorkingDirectory, subprojectPath) || "." } : {},
185499
+ ...workspacePath ? { workspacePath } : {}
185500
+ }, isStartEvent, this.reportId, this.options.apiKey);
185488
185501
  }
185489
185502
  };
185490
185503
  exports2.CliCore = CliCore;
package/package.json CHANGED
@@ -1,8 +1,11 @@
1
1
  {
2
2
  "name": "@coana-tech/cli",
3
- "version": "13.17.9",
3
+ "version": "13.17.11",
4
4
  "description": "Coana CLI",
5
- "main": "cli.js",
5
+ "bin": {
6
+ "@coana-tech/cli": "./cli.js"
7
+ },
8
+ "main": "./cli.js",
6
9
  "scripts": {},
7
10
  "author": "coana",
8
11
  "license": ""