@capraconsulting/cals-cli 3.8.0 → 3.9.0
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/README.md +0 -1
- package/lib/cals-cli.mjs +31 -17
- package/lib/cals-cli.mjs.map +1 -1
- package/lib/cli/commands/github/util.d.ts +1 -1
- package/lib/cli/reporter.d.ts +0 -6
- package/lib/cli/util.d.ts +1 -1
- package/lib/collections/collections.d.ts +4 -0
- package/lib/collections/collections.test.d.ts +1 -0
- package/lib/definition/definition.d.ts +1 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.es.js +18 -21
- package/lib/index.es.js.map +1 -1
- package/lib/index.js +18 -21
- package/lib/index.js.map +1 -1
- package/lib/snyk/service.d.ts +1 -1
- package/package.json +2 -3
package/README.md
CHANGED
|
@@ -71,7 +71,6 @@ https://snyk.docs.apiary.io/reference/projects
|
|
|
71
71
|
- [ ] Detect active vs disabled projects in Snyk (no way through API now?)
|
|
72
72
|
- [x] Report issues in Snyk grouped by our projects
|
|
73
73
|
|
|
74
|
-
|
|
75
74
|
## Contributing
|
|
76
75
|
|
|
77
76
|
This project doesn't currently accept contributions. For inquiries, please contact the maintainers at [Slack](https://liflig.slack.com/archives/C02T4KTPYS2).
|
package/lib/cals-cli.mjs
CHANGED
|
@@ -4,7 +4,6 @@ import yargs from 'yargs';
|
|
|
4
4
|
import { hideBin } from 'yargs/helpers';
|
|
5
5
|
import fs from 'fs';
|
|
6
6
|
import yaml from 'js-yaml';
|
|
7
|
-
import { uniq, keyBy, sortBy, groupBy, sumBy, repeat } from 'lodash-es';
|
|
8
7
|
import pMap from 'p-map';
|
|
9
8
|
import AJV from 'ajv';
|
|
10
9
|
import { Octokit } from '@octokit/rest';
|
|
@@ -26,7 +25,7 @@ import read from 'read';
|
|
|
26
25
|
import findUp from 'find-up';
|
|
27
26
|
import execa from 'execa';
|
|
28
27
|
|
|
29
|
-
var version = "3.
|
|
28
|
+
var version = "3.9.0";
|
|
30
29
|
var engines = {
|
|
31
30
|
node: ">=12.0.0"
|
|
32
31
|
};
|
|
@@ -325,6 +324,26 @@ var schema = {
|
|
|
325
324
|
$schema: $schema
|
|
326
325
|
};
|
|
327
326
|
|
|
327
|
+
function groupBy(array, iteratee) {
|
|
328
|
+
return array.reduce((result, item) => {
|
|
329
|
+
const key = iteratee(item);
|
|
330
|
+
if (!result[key]) {
|
|
331
|
+
result[key] = [];
|
|
332
|
+
}
|
|
333
|
+
result[key].push(item);
|
|
334
|
+
return result;
|
|
335
|
+
}, {});
|
|
336
|
+
}
|
|
337
|
+
function uniq(array) {
|
|
338
|
+
return Array.from(new Set(array));
|
|
339
|
+
}
|
|
340
|
+
function sortBy(arr, getKey) {
|
|
341
|
+
return [...arr].sort((a, b) => getKey(a).localeCompare(getKey(b)));
|
|
342
|
+
}
|
|
343
|
+
function sumBy(array, iteratee) {
|
|
344
|
+
return array.reduce((sum, item) => sum + iteratee(item), 0);
|
|
345
|
+
}
|
|
346
|
+
|
|
328
347
|
function getTeamId(org, teamName) {
|
|
329
348
|
return `${org}/${teamName}`;
|
|
330
349
|
}
|
|
@@ -441,7 +460,8 @@ function getRepos(definition) {
|
|
|
441
460
|
.flat());
|
|
442
461
|
}
|
|
443
462
|
function getGitHubOrgs(definition) {
|
|
444
|
-
|
|
463
|
+
const githubOrganizations = definition.projects.flatMap((project) => project.github.map((it) => it.organization));
|
|
464
|
+
return uniq(githubOrganizations);
|
|
445
465
|
}
|
|
446
466
|
|
|
447
467
|
class GitHubTokenCliProvider {
|
|
@@ -1149,7 +1169,7 @@ function getGitHubRepo(snykProject) {
|
|
|
1149
1169
|
}
|
|
1150
1170
|
else if (snykProject.origin === "cli" &&
|
|
1151
1171
|
snykProject.remoteRepoUrl != null) {
|
|
1152
|
-
// The remoteRepoUrl can be
|
|
1172
|
+
// The remoteRepoUrl can be overridden when using the CLI, so don't
|
|
1153
1173
|
// fail if we cannot extract the value.
|
|
1154
1174
|
const match = /github.com\/([^/]+)\/(.+)\.git$/.exec(snykProject.remoteRepoUrl);
|
|
1155
1175
|
if (match === null) {
|
|
@@ -1283,12 +1303,9 @@ class Reporter {
|
|
|
1283
1303
|
}
|
|
1284
1304
|
stdout = process.stdout;
|
|
1285
1305
|
stderr = process.stderr;
|
|
1286
|
-
stdin = process.stdin;
|
|
1287
|
-
isTTY = this.stdout.isTTY;
|
|
1288
1306
|
nonInteractive;
|
|
1289
1307
|
isVerbose;
|
|
1290
1308
|
format = chalk;
|
|
1291
|
-
startTime = Date.now();
|
|
1292
1309
|
error(msg) {
|
|
1293
1310
|
clearLine(this.stderr);
|
|
1294
1311
|
this.stderr.write(`${this.format.red("error")} ${msg}\n`);
|
|
@@ -1301,10 +1318,6 @@ class Reporter {
|
|
|
1301
1318
|
clearLine(this.stderr);
|
|
1302
1319
|
this.stderr.write(`${this.format.yellow("warning")} ${msg}\n`);
|
|
1303
1320
|
}
|
|
1304
|
-
success(msg) {
|
|
1305
|
-
clearLine(this.stdout);
|
|
1306
|
-
this.stdout.write(`${this.format.green("success")} ${msg}\n`);
|
|
1307
|
-
}
|
|
1308
1321
|
info(msg) {
|
|
1309
1322
|
clearLine(this.stdout);
|
|
1310
1323
|
this.stdout.write(`${this.format.blue("info")} ${msg}\n`);
|
|
@@ -1337,7 +1350,7 @@ function createConfig() {
|
|
|
1337
1350
|
const definitionFileOptionName = "definition-file";
|
|
1338
1351
|
const definitionFileOptionValue = {
|
|
1339
1352
|
describe: "Path to definition file, which should be the latest resources.yaml file from https://github.com/capralifecycle/resources-definition",
|
|
1340
|
-
|
|
1353
|
+
demandOption: true,
|
|
1341
1354
|
type: "string",
|
|
1342
1355
|
};
|
|
1343
1356
|
function getDefinitionFile(argv) {
|
|
@@ -1484,7 +1497,7 @@ async function getProjects(github, orgs, definition, snyk) {
|
|
|
1484
1497
|
const snykReposPromise = getSnykRepos(snyk, definition);
|
|
1485
1498
|
const repos = await getReposFromGitHub(github, orgs);
|
|
1486
1499
|
const snykRepos = await snykReposPromise;
|
|
1487
|
-
const definitionRepos =
|
|
1500
|
+
const definitionRepos = Object.fromEntries(getRepos(definition).map((repo) => [repo.id, repo]));
|
|
1488
1501
|
const projectGroups = Object.values(repos.reduce((acc, cur) => {
|
|
1489
1502
|
const org = cur.repository.owner.login;
|
|
1490
1503
|
const repoId = getRepoId(org, cur.repository.name);
|
|
@@ -1738,7 +1751,8 @@ function getChangedRepoAttribs(definitionRepo, actualRepo) {
|
|
|
1738
1751
|
async function getUnknownRepos(github, definition, limitToOrg) {
|
|
1739
1752
|
const knownRepos = getRepos(definition).map((it) => it.id);
|
|
1740
1753
|
const orgs = getGitHubOrgs(definition).filter((orgName) => limitToOrg === undefined || limitToOrg === orgName);
|
|
1741
|
-
|
|
1754
|
+
const orgRepoList = await pMap(orgs, (orgName) => github.getOrgRepoList({ org: orgName }));
|
|
1755
|
+
return sortBy(orgRepoList
|
|
1742
1756
|
.flat()
|
|
1743
1757
|
.filter((it) => !knownRepos.includes(`${it.owner.login}/${it.name}`)), (it) => `${it.owner.login}/${it.name}`);
|
|
1744
1758
|
}
|
|
@@ -2277,7 +2291,7 @@ const command$a = {
|
|
|
2277
2291
|
describe: "Group to generate commands for",
|
|
2278
2292
|
})
|
|
2279
2293
|
.options("org", {
|
|
2280
|
-
|
|
2294
|
+
demandOption: true,
|
|
2281
2295
|
describe: "Specify GitHub organization",
|
|
2282
2296
|
type: "string",
|
|
2283
2297
|
})
|
|
@@ -3198,7 +3212,7 @@ function totalSeverityCount(project) {
|
|
|
3198
3212
|
}
|
|
3199
3213
|
function buildStatsLine(stats) {
|
|
3200
3214
|
function item(num, str) {
|
|
3201
|
-
return num === 0 ?
|
|
3215
|
+
return num === 0 ? " ".repeat(str.length + 4) : sprintf("%3d %s", num, str);
|
|
3202
3216
|
}
|
|
3203
3217
|
return sprintf("%s %s %s %s", item(stats.critical ?? 0, "critical"), item(stats.high, "high"), item(stats.medium, "medium"), item(stats.low, "low"));
|
|
3204
3218
|
}
|
|
@@ -3344,7 +3358,7 @@ async function main() {
|
|
|
3344
3358
|
process.exit(1);
|
|
3345
3359
|
}
|
|
3346
3360
|
await yargs(hideBin(process.argv))
|
|
3347
|
-
.usage(`cals-cli v${version} (build: ${"
|
|
3361
|
+
.usage(`cals-cli v${version} (build: ${"2025-01-09T21:55:58+0000"})`)
|
|
3348
3362
|
.scriptName("cals")
|
|
3349
3363
|
.locale("en")
|
|
3350
3364
|
.help("help")
|
package/lib/cals-cli.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cals-cli.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cals-cli.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { GitHubService } from "../../../github
|
|
1
|
+
import { GitHubService } from "../../../github";
|
|
2
2
|
import { Reporter } from "../../reporter";
|
|
3
3
|
export declare function reportRateLimit(reporter: Reporter, github: GitHubService, block: () => Promise<void>): Promise<void>;
|
package/lib/cli/reporter.d.ts
CHANGED
|
@@ -10,17 +10,11 @@ export declare class Reporter {
|
|
|
10
10
|
stderr: NodeJS.WriteStream & {
|
|
11
11
|
fd: 2;
|
|
12
12
|
};
|
|
13
|
-
stdin: NodeJS.ReadStream & {
|
|
14
|
-
fd: 0;
|
|
15
|
-
};
|
|
16
|
-
isTTY: boolean;
|
|
17
13
|
nonInteractive: boolean;
|
|
18
14
|
isVerbose: boolean;
|
|
19
15
|
format: typeof chalk;
|
|
20
|
-
startTime: number;
|
|
21
16
|
error(msg: string): void;
|
|
22
17
|
log(msg: string): void;
|
|
23
18
|
warn(msg: string): void;
|
|
24
|
-
success(msg: string): void;
|
|
25
19
|
info(msg: string): void;
|
|
26
20
|
}
|
package/lib/cli/util.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Arguments, Options } from "yargs";
|
|
2
2
|
import { CacheProvider } from "../cache";
|
|
3
3
|
import { Config } from "../config";
|
|
4
|
-
import { DefinitionFile } from "../definition
|
|
4
|
+
import { DefinitionFile } from "../definition";
|
|
5
5
|
import { Reporter } from "./reporter";
|
|
6
6
|
export declare function createReporter(argv: Record<string, unknown>): Reporter;
|
|
7
7
|
export declare function createCacheProvider(config: Config, argv: Record<string, unknown>): CacheProvider;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare function groupBy<T>(array: T[], iteratee: (item: T) => string): Record<string, T[]>;
|
|
2
|
+
export declare function uniq<T>(array: T[]): T[];
|
|
3
|
+
export declare function sortBy<T>(arr: T[], getKey: (item: T) => string): T[];
|
|
4
|
+
export declare function sumBy<T>(array: T[], iteratee: (item: T) => number): number;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -3,7 +3,7 @@ import { Definition, GetReposResponse } from "./types";
|
|
|
3
3
|
export { schema };
|
|
4
4
|
export declare function getRepoId(orgName: string, repoName: string): string;
|
|
5
5
|
export declare class DefinitionFile {
|
|
6
|
-
private path;
|
|
6
|
+
private readonly path;
|
|
7
7
|
constructor(path: string);
|
|
8
8
|
getContents(): Promise<string>;
|
|
9
9
|
getDefinition(): Promise<Definition>;
|
package/lib/index.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ import { CacheProvider } from "./cache";
|
|
|
2
2
|
import { Reporter } from "./cli/reporter";
|
|
3
3
|
import { createReporter } from "./cli/util";
|
|
4
4
|
import { Config } from "./config";
|
|
5
|
-
import { DefinitionFile } from "./definition
|
|
6
|
-
import { createGitHubService, GitHubService } from "./github
|
|
5
|
+
import { DefinitionFile } from "./definition";
|
|
6
|
+
import { createGitHubService, GitHubService } from "./github";
|
|
7
7
|
export declare const VERSION: string;
|
|
8
8
|
export * as definition from "./definition";
|
|
9
9
|
export * as github from "./github";
|
package/lib/index.es.js
CHANGED
|
@@ -9,7 +9,6 @@ import https from 'https';
|
|
|
9
9
|
import os from 'os';
|
|
10
10
|
import AJV from 'ajv';
|
|
11
11
|
import yaml from 'js-yaml';
|
|
12
|
-
import { uniq } from 'lodash-es';
|
|
13
12
|
import { Octokit } from '@octokit/rest';
|
|
14
13
|
import fetch from 'node-fetch';
|
|
15
14
|
import pLimit from 'p-limit';
|
|
@@ -21,7 +20,7 @@ import execa from 'execa';
|
|
|
21
20
|
import read from 'read';
|
|
22
21
|
import { Transform } from 'stream';
|
|
23
22
|
|
|
24
|
-
var version = "3.
|
|
23
|
+
var version = "3.9.0";
|
|
25
24
|
|
|
26
25
|
class CacheProvider {
|
|
27
26
|
constructor(config) {
|
|
@@ -88,12 +87,9 @@ class Reporter {
|
|
|
88
87
|
}
|
|
89
88
|
stdout = process.stdout;
|
|
90
89
|
stderr = process.stderr;
|
|
91
|
-
stdin = process.stdin;
|
|
92
|
-
isTTY = this.stdout.isTTY;
|
|
93
90
|
nonInteractive;
|
|
94
91
|
isVerbose;
|
|
95
92
|
format = chalk;
|
|
96
|
-
startTime = Date.now();
|
|
97
93
|
error(msg) {
|
|
98
94
|
clearLine(this.stderr);
|
|
99
95
|
this.stderr.write(`${this.format.red("error")} ${msg}\n`);
|
|
@@ -106,10 +102,6 @@ class Reporter {
|
|
|
106
102
|
clearLine(this.stderr);
|
|
107
103
|
this.stderr.write(`${this.format.yellow("warning")} ${msg}\n`);
|
|
108
104
|
}
|
|
109
|
-
success(msg) {
|
|
110
|
-
clearLine(this.stdout);
|
|
111
|
-
this.stdout.write(`${this.format.green("success")} ${msg}\n`);
|
|
112
|
-
}
|
|
113
105
|
info(msg) {
|
|
114
106
|
clearLine(this.stdout);
|
|
115
107
|
this.stdout.write(`${this.format.blue("info")} ${msg}\n`);
|
|
@@ -460,6 +452,10 @@ var schema = {
|
|
|
460
452
|
$schema: $schema
|
|
461
453
|
};
|
|
462
454
|
|
|
455
|
+
function uniq(array) {
|
|
456
|
+
return Array.from(new Set(array));
|
|
457
|
+
}
|
|
458
|
+
|
|
463
459
|
function getTeamId(org, teamName) {
|
|
464
460
|
return `${org}/${teamName}`;
|
|
465
461
|
}
|
|
@@ -576,9 +572,19 @@ function getRepos(definition) {
|
|
|
576
572
|
.flat());
|
|
577
573
|
}
|
|
578
574
|
function getGitHubOrgs(definition) {
|
|
579
|
-
|
|
575
|
+
const githubOrganizations = definition.projects.flatMap((project) => project.github.map((it) => it.organization));
|
|
576
|
+
return uniq(githubOrganizations);
|
|
580
577
|
}
|
|
581
578
|
|
|
579
|
+
var index$3 = /*#__PURE__*/Object.freeze({
|
|
580
|
+
__proto__: null,
|
|
581
|
+
DefinitionFile: DefinitionFile,
|
|
582
|
+
getGitHubOrgs: getGitHubOrgs,
|
|
583
|
+
getRepoId: getRepoId,
|
|
584
|
+
getRepos: getRepos,
|
|
585
|
+
parseDefinition: parseDefinition
|
|
586
|
+
});
|
|
587
|
+
|
|
582
588
|
function createReporter(argv) {
|
|
583
589
|
return new Reporter({
|
|
584
590
|
verbose: !!argv.verbose,
|
|
@@ -1120,15 +1126,6 @@ async function createGitHubService(props) {
|
|
|
1120
1126
|
});
|
|
1121
1127
|
}
|
|
1122
1128
|
|
|
1123
|
-
var index$3 = /*#__PURE__*/Object.freeze({
|
|
1124
|
-
__proto__: null,
|
|
1125
|
-
DefinitionFile: DefinitionFile,
|
|
1126
|
-
getGitHubOrgs: getGitHubOrgs,
|
|
1127
|
-
getRepoId: getRepoId,
|
|
1128
|
-
getRepos: getRepos,
|
|
1129
|
-
parseDefinition: parseDefinition
|
|
1130
|
-
});
|
|
1131
|
-
|
|
1132
1129
|
var index$2 = /*#__PURE__*/Object.freeze({
|
|
1133
1130
|
__proto__: null,
|
|
1134
1131
|
createGitHubService: createGitHubService,
|
|
@@ -1261,7 +1258,7 @@ function getGitHubRepo(snykProject) {
|
|
|
1261
1258
|
}
|
|
1262
1259
|
else if (snykProject.origin === "cli" &&
|
|
1263
1260
|
snykProject.remoteRepoUrl != null) {
|
|
1264
|
-
// The remoteRepoUrl can be
|
|
1261
|
+
// The remoteRepoUrl can be overridden when using the CLI, so don't
|
|
1265
1262
|
// fail if we cannot extract the value.
|
|
1266
1263
|
const match = /github.com\/([^/]+)\/(.+)\.git$/.exec(snykProject.remoteRepoUrl);
|
|
1267
1264
|
if (match === null) {
|
|
@@ -1782,7 +1779,7 @@ async function getDockerHostAddress() {
|
|
|
1782
1779
|
return res.stdout
|
|
1783
1780
|
.split("\n")
|
|
1784
1781
|
.filter((it) => it.includes("default via"))
|
|
1785
|
-
.map((it) => /default via ([\d
|
|
1782
|
+
.map((it) => /default via ([\d.]+) /.exec(it)[1])[0];
|
|
1786
1783
|
}
|
|
1787
1784
|
catch {
|
|
1788
1785
|
throw new Error("Failed to extract docker host address");
|
package/lib/index.es.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.es.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.es.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/lib/index.js
CHANGED
|
@@ -9,7 +9,6 @@ import https from 'https';
|
|
|
9
9
|
import os from 'os';
|
|
10
10
|
import AJV from 'ajv';
|
|
11
11
|
import yaml from 'js-yaml';
|
|
12
|
-
import { uniq } from 'lodash-es';
|
|
13
12
|
import { Octokit } from '@octokit/rest';
|
|
14
13
|
import fetch from 'node-fetch';
|
|
15
14
|
import pLimit from 'p-limit';
|
|
@@ -21,7 +20,7 @@ import execa from 'execa';
|
|
|
21
20
|
import read from 'read';
|
|
22
21
|
import { Transform } from 'stream';
|
|
23
22
|
|
|
24
|
-
var version = "3.
|
|
23
|
+
var version = "3.9.0";
|
|
25
24
|
|
|
26
25
|
class CacheProvider {
|
|
27
26
|
constructor(config) {
|
|
@@ -88,12 +87,9 @@ class Reporter {
|
|
|
88
87
|
}
|
|
89
88
|
stdout = process.stdout;
|
|
90
89
|
stderr = process.stderr;
|
|
91
|
-
stdin = process.stdin;
|
|
92
|
-
isTTY = this.stdout.isTTY;
|
|
93
90
|
nonInteractive;
|
|
94
91
|
isVerbose;
|
|
95
92
|
format = chalk;
|
|
96
|
-
startTime = Date.now();
|
|
97
93
|
error(msg) {
|
|
98
94
|
clearLine(this.stderr);
|
|
99
95
|
this.stderr.write(`${this.format.red("error")} ${msg}\n`);
|
|
@@ -106,10 +102,6 @@ class Reporter {
|
|
|
106
102
|
clearLine(this.stderr);
|
|
107
103
|
this.stderr.write(`${this.format.yellow("warning")} ${msg}\n`);
|
|
108
104
|
}
|
|
109
|
-
success(msg) {
|
|
110
|
-
clearLine(this.stdout);
|
|
111
|
-
this.stdout.write(`${this.format.green("success")} ${msg}\n`);
|
|
112
|
-
}
|
|
113
105
|
info(msg) {
|
|
114
106
|
clearLine(this.stdout);
|
|
115
107
|
this.stdout.write(`${this.format.blue("info")} ${msg}\n`);
|
|
@@ -460,6 +452,10 @@ var schema = {
|
|
|
460
452
|
$schema: $schema
|
|
461
453
|
};
|
|
462
454
|
|
|
455
|
+
function uniq(array) {
|
|
456
|
+
return Array.from(new Set(array));
|
|
457
|
+
}
|
|
458
|
+
|
|
463
459
|
function getTeamId(org, teamName) {
|
|
464
460
|
return `${org}/${teamName}`;
|
|
465
461
|
}
|
|
@@ -576,9 +572,19 @@ function getRepos(definition) {
|
|
|
576
572
|
.flat());
|
|
577
573
|
}
|
|
578
574
|
function getGitHubOrgs(definition) {
|
|
579
|
-
|
|
575
|
+
const githubOrganizations = definition.projects.flatMap((project) => project.github.map((it) => it.organization));
|
|
576
|
+
return uniq(githubOrganizations);
|
|
580
577
|
}
|
|
581
578
|
|
|
579
|
+
var index$3 = /*#__PURE__*/Object.freeze({
|
|
580
|
+
__proto__: null,
|
|
581
|
+
DefinitionFile: DefinitionFile,
|
|
582
|
+
getGitHubOrgs: getGitHubOrgs,
|
|
583
|
+
getRepoId: getRepoId,
|
|
584
|
+
getRepos: getRepos,
|
|
585
|
+
parseDefinition: parseDefinition
|
|
586
|
+
});
|
|
587
|
+
|
|
582
588
|
function createReporter(argv) {
|
|
583
589
|
return new Reporter({
|
|
584
590
|
verbose: !!argv.verbose,
|
|
@@ -1120,15 +1126,6 @@ async function createGitHubService(props) {
|
|
|
1120
1126
|
});
|
|
1121
1127
|
}
|
|
1122
1128
|
|
|
1123
|
-
var index$3 = /*#__PURE__*/Object.freeze({
|
|
1124
|
-
__proto__: null,
|
|
1125
|
-
DefinitionFile: DefinitionFile,
|
|
1126
|
-
getGitHubOrgs: getGitHubOrgs,
|
|
1127
|
-
getRepoId: getRepoId,
|
|
1128
|
-
getRepos: getRepos,
|
|
1129
|
-
parseDefinition: parseDefinition
|
|
1130
|
-
});
|
|
1131
|
-
|
|
1132
1129
|
var index$2 = /*#__PURE__*/Object.freeze({
|
|
1133
1130
|
__proto__: null,
|
|
1134
1131
|
createGitHubService: createGitHubService,
|
|
@@ -1261,7 +1258,7 @@ function getGitHubRepo(snykProject) {
|
|
|
1261
1258
|
}
|
|
1262
1259
|
else if (snykProject.origin === "cli" &&
|
|
1263
1260
|
snykProject.remoteRepoUrl != null) {
|
|
1264
|
-
// The remoteRepoUrl can be
|
|
1261
|
+
// The remoteRepoUrl can be overridden when using the CLI, so don't
|
|
1265
1262
|
// fail if we cannot extract the value.
|
|
1266
1263
|
const match = /github.com\/([^/]+)\/(.+)\.git$/.exec(snykProject.remoteRepoUrl);
|
|
1267
1264
|
if (match === null) {
|
|
@@ -1782,7 +1779,7 @@ async function getDockerHostAddress() {
|
|
|
1782
1779
|
return res.stdout
|
|
1783
1780
|
.split("\n")
|
|
1784
1781
|
.filter((it) => it.includes("default via"))
|
|
1785
|
-
.map((it) => /default via ([\d
|
|
1782
|
+
.map((it) => /default via ([\d.]+) /.exec(it)[1])[0];
|
|
1786
1783
|
}
|
|
1787
1784
|
catch {
|
|
1788
1785
|
throw new Error("Failed to extract docker host address");
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names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": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -32,10 +32,10 @@
|
|
|
32
32
|
"find-up": "^5.0.0",
|
|
33
33
|
"js-yaml": "^4.1.0",
|
|
34
34
|
"keytar": "^7.9.0",
|
|
35
|
-
"lodash-es": "^4.17.21",
|
|
36
35
|
"node-fetch": "^2.6.7",
|
|
37
36
|
"p-limit": "^3.0.0",
|
|
38
37
|
"p-map": "^4.0.0",
|
|
38
|
+
"process": "0.11.10",
|
|
39
39
|
"read": "^1.0.7",
|
|
40
40
|
"rimraf": "^4.0.0",
|
|
41
41
|
"semver": "^7.6.2",
|
|
@@ -74,7 +74,6 @@
|
|
|
74
74
|
"eslint-plugin-prettier": "5.2.1",
|
|
75
75
|
"husky": "9.1.7",
|
|
76
76
|
"jest": "^29.6.1",
|
|
77
|
-
"lodash": "4.17.21",
|
|
78
77
|
"prettier": "3.4.2",
|
|
79
78
|
"rollup": "2.79.2",
|
|
80
79
|
"rollup-plugin-typescript2": "0.36.0",
|