Skip to content

Commit 3166236

Browse files
committed
fix exec path config
1 parent 0772395 commit 3166236

File tree

4 files changed

+15
-15
lines changed

4 files changed

+15
-15
lines changed

package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
"name": "@CheckmarxDev/ast-cli-javascript-wrapper",
2+
"name": "@CheckmarxDev/ast-cli-javascript-wrapper-runtime-cli",
33
"version": "0.0.113",
4-
"description": "AST CLI Javascript wrapper",
4+
"description": "AST CLI Javascript wrapper runtime CLI",
55
"main": "dist/main/wrapper/CxWrapper.js",
66
"typings": "dist/main/wrapper/CxWrapper.d.ts",
77
"files": [
@@ -22,15 +22,15 @@
2222
"postbuild": "copyfiles -u 1 src/main/wrapper/resources/cx* dist/;copyfiles -u 1 src/tests/data/* dist/;",
2323
"lint": "eslint . --ext .ts",
2424
"lint-and-fix": "eslint . --ext .ts --fix",
25-
"test": "copyfiles -u 1 src/tests/data/* dist/; tsc && jest"
25+
"test": "copyfiles -u 1 src/tests/data/* dist/; tsc && jest --runInBand"
2626
},
27-
"repository": "https://github.com/CheckmarxDev/ast-cli-javascript-wrapper.git",
27+
"repository": "https://github.com/CheckmarxDev/ast-cli-javascript-wrapper-runtime-cli.git",
2828
"author": "Jay Nanduri",
2929
"license": "ISC",
3030
"bugs": {
31-
"url": "https://github.com/CheckmarxDev/ast-cli-javascript-wrapper/issues"
31+
"url": "https://github.com/CheckmarxDev/ast-cli-javascript-wrapper-runtime-cli/issues"
3232
},
33-
"homepage": "https://github.com/CheckmarxDev/ast-cli-javascript-wrapper#readme",
33+
"homepage": "https://github.com/CheckmarxDev/ast-cli-javascript-wrapper-runtime-cli#readme",
3434
"devDependencies": {
3535
"@babel/core": "^7.25.2",
3636
"@babel/plugin-transform-runtime": "^7.25.4",

src/main/osinstaller/CxInstaller.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ export class CxInstaller {
6969
console.log('Downloaded CLI to:', zipPath);
7070

7171
await this.extractArchive(zipPath, this.resourceDirPath);
72+
fs1.chmodSync(this.getExecutablePath(), 0o777);
7273
console.log('Extracted CLI to:', this.resourceDirPath);
7374
} catch (error) {
7475
console.error('Error during installation:', error);

src/main/wrapper/CxWrapper.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,14 @@ type ParamTypeMap = Map<CxParamType, string>;
1313

1414
export class CxWrapper {
1515
config: CxConfig = new CxConfig();
16+
cxInstaller: CxInstaller = new CxInstaller(process.platform);
1617
windows = 'win32';
1718
mac = 'darwin';
1819
linux = 'linux';
1920

2021

2122
constructor(cxScanConfig: CxConfig, logFilePath?: string) {
2223
getLoggerWithFilePath(logFilePath)
23-
const cxInstaller = new CxInstaller(process.platform);
24-
this.config.pathToExecutable = cxInstaller.getExecutablePath();
2524
if (cxScanConfig.apiKey) {
2625
this.config.apiKey = cxScanConfig.apiKey;
2726
} else if (cxScanConfig.clientId && cxScanConfig.clientSecret) {
@@ -31,7 +30,11 @@ export class CxWrapper {
3130
} else {
3231
logger.info("Did not receive ClientId/Secret or ApiKey from cli arguments");
3332
}
34-
this.config.pathToExecutable = cxInstaller.getExecutablePath();
33+
if (cxScanConfig.pathToExecutable) {
34+
this.config.pathToExecutable = cxScanConfig.pathToExecutable;
35+
} else {
36+
this.config.pathToExecutable = this.cxInstaller.getExecutablePath();
37+
}
3538
if (cxScanConfig.baseUri) {
3639
this.config.baseUri = cxScanConfig.baseUri;
3740
}
@@ -47,9 +50,8 @@ export class CxWrapper {
4750
}
4851

4952
async initializeCommands(formatRequired: boolean): Promise<string[]> {
50-
const cxInstaller = new CxInstaller(process.platform);
51-
await cxInstaller.downloadIfNotInstalledCLI()
52-
this.config.pathToExecutable = cxInstaller.getExecutablePath();
53+
await this.cxInstaller.downloadIfNotInstalledCLI()
54+
this.config.pathToExecutable = this.cxInstaller.getExecutablePath();
5355

5456
const list: string[] = [];
5557
if (this.config.clientId) {

src/tests/BaseTest.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,5 @@ export class BaseTest {
1717
this.tenant = process.env["CX_TENANT"];
1818
this.apiKey = process.env["CX_APIKEY"];
1919
this.additionalParameters = "--debug"
20-
if (process.env["PATH_TO_EXECUTABLE"] !== null && process.env["PATH_TO_EXECUTABLE"] !== undefined) {
21-
this.pathToExecutable = process.env["PATH_TO_EXECUTABLE"];
22-
}
2320
}
2421
}

0 commit comments

Comments
 (0)