@aikidosec/ci-api-client 1.0.0 → 1.0.1
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/lib/commands/scan.js +1 -1
- package/lib/index.d.ts +0 -1
- package/lib/index.js +3 -11
- package/package.json +1 -1
- package/src/commands/scan.ts +3 -4
- package/src/index.ts +5 -15
package/lib/commands/scan.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
1
2
|
import { Argument, InvalidArgumentError, Option } from 'commander';
|
|
2
3
|
import { pollScanStatus, startScan, } from '../aikidoApi.js';
|
|
3
4
|
import { getApiKey } from '../configuration.js';
|
|
4
5
|
import { outputError, outputHttpError, outputLog, startSpinner, } from '../output.js';
|
|
5
|
-
import chalk from 'chalk';
|
|
6
6
|
async function cli(repoId, baseCommitId, headCommitId, branchName, options, command) {
|
|
7
7
|
const apiKey = getApiKey();
|
|
8
8
|
if (!apiKey) {
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -2,23 +2,15 @@
|
|
|
2
2
|
import chalk from 'chalk';
|
|
3
3
|
import { Command } from 'commander';
|
|
4
4
|
import dotenv from 'dotenv';
|
|
5
|
-
import { readFileSync } from 'fs';
|
|
6
|
-
import { dirname, join } from 'path';
|
|
7
|
-
import { fileURLToPath } from 'url';
|
|
8
5
|
import apiKey from './commands/apiKey.js';
|
|
9
6
|
import scan from './commands/scan.js';
|
|
10
7
|
import upload from './commands/upload.js';
|
|
11
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
12
|
-
const __dirname = dirname(__filename);
|
|
13
|
-
const __rootdirname = dirname(__dirname);
|
|
14
8
|
dotenv.config(process.env.NODE_ENV ? { path: `.env.${process.env.NODE_ENV}` } : {});
|
|
15
|
-
const pkgJsonPath = join('/', __rootdirname, 'package.json');
|
|
16
|
-
export const pkgJson = JSON.parse(readFileSync(pkgJsonPath, 'utf8'));
|
|
17
9
|
export const program = new Command();
|
|
18
10
|
program
|
|
19
|
-
.name(
|
|
20
|
-
.description(
|
|
21
|
-
.version(
|
|
11
|
+
.name('Aikido API Client')
|
|
12
|
+
.description('CLI api client to easily integrate the Aikido public CI API into custom deploy scripts')
|
|
13
|
+
.version('1.0.1');
|
|
22
14
|
apiKey.cliSetup(program);
|
|
23
15
|
scan.cliSetup(program);
|
|
24
16
|
upload.cliSetup(program);
|
package/package.json
CHANGED
package/src/commands/scan.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
1
2
|
import { Argument, Command, InvalidArgumentError, Option } from 'commander';
|
|
3
|
+
import { Ora } from 'ora';
|
|
2
4
|
import {
|
|
3
|
-
TStartScanResult,
|
|
4
5
|
TPollIsScanningResult,
|
|
5
6
|
TPollScanCompletedDefaultBranchResult,
|
|
6
7
|
TPollScanFeatureBranchCompletedResult,
|
|
7
8
|
TScanApiOptions,
|
|
9
|
+
TStartScanResult,
|
|
8
10
|
pollScanStatus,
|
|
9
11
|
startScan,
|
|
10
12
|
} from '../aikidoApi.js';
|
|
@@ -15,9 +17,6 @@ import {
|
|
|
15
17
|
outputLog,
|
|
16
18
|
startSpinner,
|
|
17
19
|
} from '../output.js';
|
|
18
|
-
import chalk from 'chalk';
|
|
19
|
-
import { Ora } from 'ora';
|
|
20
|
-
import { pkgJson } from '../index.js';
|
|
21
20
|
|
|
22
21
|
type TScanArguments = {
|
|
23
22
|
repoId: string | number;
|
package/src/index.ts
CHANGED
|
@@ -2,34 +2,24 @@
|
|
|
2
2
|
import chalk from 'chalk';
|
|
3
3
|
import { Command } from 'commander';
|
|
4
4
|
import dotenv from 'dotenv';
|
|
5
|
-
import { readFileSync } from 'fs';
|
|
6
|
-
import { dirname, join } from 'path';
|
|
7
|
-
import { fileURLToPath } from 'url';
|
|
8
5
|
import apiKey from './commands/apiKey.js';
|
|
9
6
|
import scan from './commands/scan.js';
|
|
10
7
|
import upload from './commands/upload.js';
|
|
11
8
|
|
|
12
|
-
// Determine current file location and path to
|
|
13
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
14
|
-
const __dirname = dirname(__filename);
|
|
15
|
-
const __rootdirname = dirname(__dirname);
|
|
16
|
-
|
|
17
9
|
// Load all .env configuration variables and auto-inject them into process.env
|
|
18
10
|
dotenv.config(
|
|
19
11
|
process.env.NODE_ENV ? { path: `.env.${process.env.NODE_ENV}` } : {}
|
|
20
12
|
);
|
|
21
13
|
|
|
22
|
-
// Set commander instance info from package.json
|
|
23
|
-
const pkgJsonPath = join('/', __rootdirname, 'package.json');
|
|
24
|
-
export const pkgJson = JSON.parse(readFileSync(pkgJsonPath, 'utf8'));
|
|
25
|
-
|
|
26
14
|
// Start up commander.js Command instance
|
|
27
15
|
export const program = new Command();
|
|
28
16
|
|
|
29
17
|
program
|
|
30
|
-
.name(
|
|
31
|
-
.description(
|
|
32
|
-
|
|
18
|
+
.name('Aikido API Client')
|
|
19
|
+
.description(
|
|
20
|
+
'CLI api client to easily integrate the Aikido public CI API into custom deploy scripts'
|
|
21
|
+
)
|
|
22
|
+
.version('1.0.1');
|
|
33
23
|
|
|
34
24
|
// Load in all app commands and set them up in the `program` instance
|
|
35
25
|
apiKey.cliSetup(program);
|