@coana-tech/cli 14.3.3 → 14.3.6

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 +20 -14
  2. package/package.json +1 -1
package/cli.js CHANGED
@@ -106072,7 +106072,7 @@ async function getEcosystemSpecificDockerArgs(ecosystem) {
106072
106072
  }
106073
106073
  return [];
106074
106074
  }
106075
- var import_child_process2, import_fs11, import_promises13, import_lodash7, import_os3, import_path20, import_ecosystem_support2, import_logger_singleton7, pullDockerImage, OtherModulesCommunicator, setUpGoModuleCache;
106075
+ var import_child_process2, import_fs11, import_promises13, import_lodash7, import_os3, import_path20, import_ecosystem_support2, import_logger_singleton7, pullDockerImage, TMP_DIR_IN_DOCKER, OtherModulesCommunicator, setUpGoModuleCache;
106076
106076
  var init_other_modules_communicator = __esm({
106077
106077
  "../other-modules-communicator/src/other-modules-communicator.ts"() {
106078
106078
  "use strict";
@@ -106100,6 +106100,7 @@ var init_other_modules_communicator = __esm({
106100
106100
  }
106101
106101
  return true;
106102
106102
  });
106103
+ TMP_DIR_IN_DOCKER = "/coana-tmp";
106103
106104
  OtherModulesCommunicator = class {
106104
106105
  constructor(rootWorkingDir, options, apiKey) {
106105
106106
  this.rootWorkingDir = rootWorkingDir;
@@ -106185,12 +106186,14 @@ var init_other_modules_communicator = __esm({
106185
106186
  }
106186
106187
  async runPackageManagerCommandWithOutput(commandName, packageManagerName, subprojectPath, args2 = [], extraDockerArgs, env) {
106187
106188
  const tmpDir = await this.getTmpDirForSubproject(subprojectPath);
106188
- const outputFilePath = (0, import_path20.join)(tmpDir, `${v4_default()}-${commandName}-output.json`);
106189
+ const outputFileName = `${v4_default()}-${commandName}-output.json`;
106190
+ const outputFilePathThisProcess = (0, import_path20.join)(tmpDir, outputFileName);
106191
+ const outputFilePathOtherProcess = (0, import_path20.join)(this.options.runWithoutDocker ? tmpDir : TMP_DIR_IN_DOCKER, outputFileName);
106189
106192
  await this.runPackageManagerCommand(
106190
106193
  commandName,
106191
106194
  packageManagerName,
106192
106195
  subprojectPath,
106193
- [...args2, "-o", outputFilePath],
106196
+ [...args2, "-o", outputFilePathOtherProcess],
106194
106197
  extraDockerArgs,
106195
106198
  {
106196
106199
  ...env ?? process.env,
@@ -106198,7 +106201,7 @@ var init_other_modules_communicator = __esm({
106198
106201
  COANA_API_KEY: this.apiKey.type === "present" ? this.apiKey.value : ""
106199
106202
  }
106200
106203
  );
106201
- return JSON.parse(await (0, import_promises13.readFile)(outputFilePath, "utf-8")).result;
106204
+ return JSON.parse(await (0, import_promises13.readFile)(outputFilePathThisProcess, "utf-8")).result;
106202
106205
  }
106203
106206
  async runReachabilityAnalyzerCommand(commandName, ecosystem, subprojectPath, workspacePath, args2, env) {
106204
106207
  const tmpDir = await this.getTmpDirForSubproject(subprojectPath);
@@ -106242,21 +106245,23 @@ var init_other_modules_communicator = __esm({
106242
106245
  }
106243
106246
  async runReachabilityAnalyzerCommandWithOutput(commandName, ecosystem, subprojectPath, workspacePath, args2, env) {
106244
106247
  const tmpDir = await this.getTmpDirForSubproject(subprojectPath);
106245
- const outputFilePath = (0, import_path20.join)(tmpDir, `${v4_default()}-${commandName}-output.json`);
106248
+ const outputFileName = `${v4_default()}-${commandName}-output.json`;
106249
+ const outputFilePathThisProcess = (0, import_path20.join)(tmpDir, outputFileName);
106250
+ const outputFilePathOtherProcess = (0, import_path20.join)(this.options.runWithoutDocker ? tmpDir : TMP_DIR_IN_DOCKER, outputFileName);
106246
106251
  await this.runReachabilityAnalyzerCommand(
106247
106252
  commandName,
106248
106253
  ecosystem,
106249
106254
  subprojectPath,
106250
106255
  workspacePath,
106251
- [...args2, "-o", outputFilePath],
106256
+ [...args2, "-o", outputFilePathOtherProcess],
106252
106257
  env
106253
106258
  );
106254
- return JSON.parse(await (0, import_promises13.readFile)(outputFilePath, "utf-8")).result;
106259
+ return JSON.parse(await (0, import_promises13.readFile)(outputFilePathThisProcess, "utf-8")).result;
106255
106260
  }
106256
106261
  async runInDocker(ecosystem, image, entryPoint, commandName, args2, subprojectPath, tmpDir, env = process.env) {
106257
106262
  if (!await pullDockerImage(image)) return false;
106258
106263
  const envArgs = Object.keys(env).filter((key) => DOCKER_ENV_WHITE_LIST.some((whiteListedKey) => key.includes(whiteListedKey))).flatMap((key) => ["-e", key]);
106259
- const cmd = cmdt`docker run --pull=never --rm -v ${this.rootWorkingDir}:/project -v ${tmpDir}:${tmpDir}
106264
+ const cmd = cmdt`docker run --pull=never --rm -v ${this.rootWorkingDir}:/project -v ${tmpDir}:${TMP_DIR_IN_DOCKER}
106260
106265
  -v=${this.options.coanaLogPath}:${this.options.coanaLogPath}
106261
106266
  ${await getEcosystemSpecificDockerArgs(ecosystem)}
106262
106267
  ${envArgs} ${image} ${entryPoint} ${commandName} ${args2}`;
@@ -106278,7 +106283,6 @@ var init_other_modules_communicator = __esm({
106278
106283
  return [];
106279
106284
  }
106280
106285
  async prepareProjectAndGetProjectData(packageManagerName, subprojectPath, workspacePaths, lightweightReachability, providedOptions) {
106281
- const tmpDir = await this.getTmpDirForSubproject(subprojectPath);
106282
106286
  return this.runPackageManagerCommandWithOutput(
106283
106287
  "prepareProjectAndGetProjectData",
106284
106288
  packageManagerName,
@@ -106288,7 +106292,7 @@ var init_other_modules_communicator = __esm({
106288
106292
  ...await this.getProvidedArgsForSubproject(subprojectPath, providedOptions),
106289
106293
  ...lightweightReachability ? [] : ["--install-dependencies"]
106290
106294
  ],
106291
- ["--export-dir", tmpDir]
106295
+ ["--export-dir", TMP_DIR_IN_DOCKER]
106292
106296
  );
106293
106297
  }
106294
106298
  async getFixingData(packageManagerName, subprojectPath, workspacePaths) {
@@ -106315,9 +106319,11 @@ var init_other_modules_communicator = __esm({
106315
106319
  }
106316
106320
  async runReachabilityAnalysis(subprojectPath, workspacePath, workspaceData, vulnerabilities, reachabilityAnalysisOptions, otherAnalysisOptions) {
106317
106321
  const tmpDir = await this.getTmpDirForSubproject(subprojectPath);
106318
- const inputFile = (0, import_path20.join)(tmpDir, `${v4_default()}-runReachabilityAnalysis-input.json`);
106322
+ const inputFileName = `${v4_default()}-runReachabilityAnalysis-input.json`;
106323
+ const inputFileOtherProcess = (0, import_path20.join)(this.options.runWithoutDocker ? tmpDir : TMP_DIR_IN_DOCKER, inputFileName);
106324
+ const inputFileThisProcess = (0, import_path20.join)(tmpDir, inputFileName);
106319
106325
  await (0, import_promises13.writeFile)(
106320
- inputFile,
106326
+ inputFileThisProcess,
106321
106327
  JSON.stringify({
106322
106328
  workspaceData,
106323
106329
  vulnerabilities,
@@ -106330,7 +106336,7 @@ var init_other_modules_communicator = __esm({
106330
106336
  workspaceData.type,
106331
106337
  subprojectPath,
106332
106338
  workspacePath,
106333
- argt`-i ${inputFile}`,
106339
+ argt`-i ${inputFileOtherProcess}`,
106334
106340
  {
106335
106341
  ...process.env,
106336
106342
  COANA_REPORT_ID: this.options.reportId,
@@ -207869,7 +207875,7 @@ var require_version = __commonJS({
207869
207875
  "use strict";
207870
207876
  Object.defineProperty(exports2, "__esModule", { value: true });
207871
207877
  exports2.version = void 0;
207872
- exports2.version = "14.3.3";
207878
+ exports2.version = "14.3.6";
207873
207879
  }
207874
207880
  });
207875
207881
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coana-tech/cli",
3
- "version": "14.3.3",
3
+ "version": "14.3.6",
4
4
  "description": "Coana CLI",
5
5
  "bin": {
6
6
  "@coana-tech/cli": "./cli.js"