@capraconsulting/cals-cli 3.8.0 → 3.10.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 +61 -45
- 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 +45 -46
- package/lib/index.es.js.map +1 -1
- package/lib/index.js +45 -46
- package/lib/index.js.map +1 -1
- package/lib/snyk/service.d.ts +1 -1
- package/package.json +10 -11
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
|
@@ -2,17 +2,18 @@
|
|
|
2
2
|
import semver from 'semver';
|
|
3
3
|
import yargs from 'yargs';
|
|
4
4
|
import { hideBin } from 'yargs/helpers';
|
|
5
|
-
import fs from 'fs';
|
|
5
|
+
import fs from 'node: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';
|
|
11
10
|
import fetch from 'node-fetch';
|
|
12
11
|
import pLimit from 'p-limit';
|
|
13
12
|
import keytar from 'keytar';
|
|
14
|
-
import
|
|
13
|
+
import process$2 from 'node:process';
|
|
14
|
+
import * as process$1 from 'process';
|
|
15
15
|
import { performance } from 'perf_hooks';
|
|
16
|
+
import { Buffer } from 'node:buffer';
|
|
16
17
|
import { deprecate } from 'util';
|
|
17
18
|
import path from 'path';
|
|
18
19
|
import rimraf from 'rimraf';
|
|
@@ -26,7 +27,7 @@ import read from 'read';
|
|
|
26
27
|
import findUp from 'find-up';
|
|
27
28
|
import execa from 'execa';
|
|
28
29
|
|
|
29
|
-
var version = "3.
|
|
30
|
+
var version = "3.10.0";
|
|
30
31
|
var engines = {
|
|
31
32
|
node: ">=12.0.0"
|
|
32
33
|
};
|
|
@@ -325,6 +326,26 @@ var schema = {
|
|
|
325
326
|
$schema: $schema
|
|
326
327
|
};
|
|
327
328
|
|
|
329
|
+
function groupBy(array, iteratee) {
|
|
330
|
+
return array.reduce((result, item) => {
|
|
331
|
+
const key = iteratee(item);
|
|
332
|
+
if (!result[key]) {
|
|
333
|
+
result[key] = [];
|
|
334
|
+
}
|
|
335
|
+
result[key].push(item);
|
|
336
|
+
return result;
|
|
337
|
+
}, {});
|
|
338
|
+
}
|
|
339
|
+
function uniq(array) {
|
|
340
|
+
return Array.from(new Set(array));
|
|
341
|
+
}
|
|
342
|
+
function sortBy(arr, getKey) {
|
|
343
|
+
return [...arr].sort((a, b) => getKey(a).localeCompare(getKey(b)));
|
|
344
|
+
}
|
|
345
|
+
function sumBy(array, iteratee) {
|
|
346
|
+
return array.reduce((sum, item) => sum + iteratee(item), 0);
|
|
347
|
+
}
|
|
348
|
+
|
|
328
349
|
function getTeamId(org, teamName) {
|
|
329
350
|
return `${org}/${teamName}`;
|
|
330
351
|
}
|
|
@@ -441,19 +462,20 @@ function getRepos(definition) {
|
|
|
441
462
|
.flat());
|
|
442
463
|
}
|
|
443
464
|
function getGitHubOrgs(definition) {
|
|
444
|
-
|
|
465
|
+
const githubOrganizations = definition.projects.flatMap((project) => project.github.map((it) => it.organization));
|
|
466
|
+
return uniq(githubOrganizations);
|
|
445
467
|
}
|
|
446
468
|
|
|
447
469
|
class GitHubTokenCliProvider {
|
|
448
470
|
keyringService = "cals";
|
|
449
471
|
keyringAccount = "github-token";
|
|
450
472
|
async getToken() {
|
|
451
|
-
if (process.env.CALS_GITHUB_TOKEN) {
|
|
452
|
-
return process.env.CALS_GITHUB_TOKEN;
|
|
473
|
+
if (process$2.env.CALS_GITHUB_TOKEN) {
|
|
474
|
+
return process$2.env.CALS_GITHUB_TOKEN;
|
|
453
475
|
}
|
|
454
476
|
const result = await keytar.getPassword(this.keyringService, this.keyringAccount);
|
|
455
477
|
if (result == null) {
|
|
456
|
-
process.stderr.write("No token found. Register using `cals github set-token`\n");
|
|
478
|
+
process$2.stderr.write("No token found. Register using `cals github set-token`\n");
|
|
457
479
|
return undefined;
|
|
458
480
|
}
|
|
459
481
|
return result;
|
|
@@ -631,7 +653,7 @@ class GitHubService {
|
|
|
631
653
|
return result;
|
|
632
654
|
});
|
|
633
655
|
if (response.status === 401) {
|
|
634
|
-
process$
|
|
656
|
+
process$1.stderr.write("Unauthorized\n");
|
|
635
657
|
await this.tokenProvider.markInvalid();
|
|
636
658
|
}
|
|
637
659
|
// If you get 502 after 10s, it is a timeout.
|
|
@@ -1027,12 +1049,12 @@ class SnykTokenCliProvider {
|
|
|
1027
1049
|
keyringService = "cals";
|
|
1028
1050
|
keyringAccount = "snyk-token";
|
|
1029
1051
|
async getToken() {
|
|
1030
|
-
if (process.env.CALS_SNYK_TOKEN) {
|
|
1031
|
-
return process.env.CALS_SNYK_TOKEN;
|
|
1052
|
+
if (process$2.env.CALS_SNYK_TOKEN) {
|
|
1053
|
+
return process$2.env.CALS_SNYK_TOKEN;
|
|
1032
1054
|
}
|
|
1033
1055
|
const result = await keytar.getPassword(this.keyringService, this.keyringAccount);
|
|
1034
1056
|
if (result == null) {
|
|
1035
|
-
process.stderr.write("No token found. Register using `cals snyk set-token`\n");
|
|
1057
|
+
process$2.stderr.write("No token found. Register using `cals snyk set-token`\n");
|
|
1036
1058
|
return undefined;
|
|
1037
1059
|
}
|
|
1038
1060
|
return result;
|
|
@@ -1090,7 +1112,7 @@ class SnykService {
|
|
|
1090
1112
|
agent: this.config.agent,
|
|
1091
1113
|
});
|
|
1092
1114
|
if (response.status === 401) {
|
|
1093
|
-
process.stderr.write("Unauthorized - removing token\n");
|
|
1115
|
+
process$2.stderr.write("Unauthorized - removing token\n");
|
|
1094
1116
|
await this.tokenProvider.markInvalid();
|
|
1095
1117
|
}
|
|
1096
1118
|
if (!response.ok) {
|
|
@@ -1149,7 +1171,7 @@ function getGitHubRepo(snykProject) {
|
|
|
1149
1171
|
}
|
|
1150
1172
|
else if (snykProject.origin === "cli" &&
|
|
1151
1173
|
snykProject.remoteRepoUrl != null) {
|
|
1152
|
-
// The remoteRepoUrl can be
|
|
1174
|
+
// The remoteRepoUrl can be overridden when using the CLI, so don't
|
|
1153
1175
|
// fail if we cannot extract the value.
|
|
1154
1176
|
const match = /github.com\/([^/]+)\/(.+)\.git$/.exec(snykProject.remoteRepoUrl);
|
|
1155
1177
|
if (match === null) {
|
|
@@ -1222,7 +1244,7 @@ class CacheProvider {
|
|
|
1222
1244
|
}
|
|
1223
1245
|
|
|
1224
1246
|
class Config {
|
|
1225
|
-
cwd = path.resolve(process.cwd());
|
|
1247
|
+
cwd = path.resolve(process$2.cwd());
|
|
1226
1248
|
configFile = path.join(os.homedir(), ".cals-config.json");
|
|
1227
1249
|
cacheDir = cachedir("cals-cli");
|
|
1228
1250
|
agent = new https.Agent({
|
|
@@ -1281,14 +1303,11 @@ class Reporter {
|
|
|
1281
1303
|
this.nonInteractive = !!opts.nonInteractive;
|
|
1282
1304
|
this.isVerbose = !!opts.verbose;
|
|
1283
1305
|
}
|
|
1284
|
-
stdout = process.stdout;
|
|
1285
|
-
stderr = process.stderr;
|
|
1286
|
-
stdin = process.stdin;
|
|
1287
|
-
isTTY = this.stdout.isTTY;
|
|
1306
|
+
stdout = process$2.stdout;
|
|
1307
|
+
stderr = process$2.stderr;
|
|
1288
1308
|
nonInteractive;
|
|
1289
1309
|
isVerbose;
|
|
1290
1310
|
format = chalk;
|
|
1291
|
-
startTime = Date.now();
|
|
1292
1311
|
error(msg) {
|
|
1293
1312
|
clearLine(this.stderr);
|
|
1294
1313
|
this.stderr.write(`${this.format.red("error")} ${msg}\n`);
|
|
@@ -1301,10 +1320,6 @@ class Reporter {
|
|
|
1301
1320
|
clearLine(this.stderr);
|
|
1302
1321
|
this.stderr.write(`${this.format.yellow("warning")} ${msg}\n`);
|
|
1303
1322
|
}
|
|
1304
|
-
success(msg) {
|
|
1305
|
-
clearLine(this.stdout);
|
|
1306
|
-
this.stdout.write(`${this.format.green("success")} ${msg}\n`);
|
|
1307
|
-
}
|
|
1308
1323
|
info(msg) {
|
|
1309
1324
|
clearLine(this.stdout);
|
|
1310
1325
|
this.stdout.write(`${this.format.blue("info")} ${msg}\n`);
|
|
@@ -1337,7 +1352,7 @@ function createConfig() {
|
|
|
1337
1352
|
const definitionFileOptionName = "definition-file";
|
|
1338
1353
|
const definitionFileOptionValue = {
|
|
1339
1354
|
describe: "Path to definition file, which should be the latest resources.yaml file from https://github.com/capralifecycle/resources-definition",
|
|
1340
|
-
|
|
1355
|
+
demandOption: true,
|
|
1341
1356
|
type: "string",
|
|
1342
1357
|
};
|
|
1343
1358
|
function getDefinitionFile(argv) {
|
|
@@ -1484,7 +1499,7 @@ async function getProjects(github, orgs, definition, snyk) {
|
|
|
1484
1499
|
const snykReposPromise = getSnykRepos(snyk, definition);
|
|
1485
1500
|
const repos = await getReposFromGitHub(github, orgs);
|
|
1486
1501
|
const snykRepos = await snykReposPromise;
|
|
1487
|
-
const definitionRepos =
|
|
1502
|
+
const definitionRepos = Object.fromEntries(getRepos(definition).map((repo) => [repo.id, repo]));
|
|
1488
1503
|
const projectGroups = Object.values(repos.reduce((acc, cur) => {
|
|
1489
1504
|
const org = cur.repository.owner.login;
|
|
1490
1505
|
const repoId = getRepoId(org, cur.repository.name);
|
|
@@ -1633,7 +1648,7 @@ const command$f = {
|
|
|
1633
1648
|
.demandCommand()
|
|
1634
1649
|
.usage(`cals definition`),
|
|
1635
1650
|
handler: () => {
|
|
1636
|
-
yargs(hideBin(process.argv)).showHelp();
|
|
1651
|
+
yargs(hideBin(process$2.argv)).showHelp();
|
|
1637
1652
|
},
|
|
1638
1653
|
};
|
|
1639
1654
|
|
|
@@ -1738,7 +1753,8 @@ function getChangedRepoAttribs(definitionRepo, actualRepo) {
|
|
|
1738
1753
|
async function getUnknownRepos(github, definition, limitToOrg) {
|
|
1739
1754
|
const knownRepos = getRepos(definition).map((it) => it.id);
|
|
1740
1755
|
const orgs = getGitHubOrgs(definition).filter((orgName) => limitToOrg === undefined || limitToOrg === orgName);
|
|
1741
|
-
|
|
1756
|
+
const orgRepoList = await pMap(orgs, (orgName) => github.getOrgRepoList({ org: orgName }));
|
|
1757
|
+
return sortBy(orgRepoList
|
|
1742
1758
|
.flat()
|
|
1743
1759
|
.filter((it) => !knownRepos.includes(`${it.owner.login}/${it.name}`)), (it) => `${it.owner.login}/${it.name}`);
|
|
1744
1760
|
}
|
|
@@ -2150,7 +2166,7 @@ function createOrgGetter(github) {
|
|
|
2150
2166
|
});
|
|
2151
2167
|
};
|
|
2152
2168
|
}
|
|
2153
|
-
async function process
|
|
2169
|
+
async function process(reporter, github, definition, getOrg, execute, limitToOrg) {
|
|
2154
2170
|
let changes = [];
|
|
2155
2171
|
for (const orgName of getGitHubOrgs(definition)) {
|
|
2156
2172
|
if (limitToOrg !== undefined && limitToOrg !== orgName) {
|
|
@@ -2234,14 +2250,14 @@ const command$b = {
|
|
|
2234
2250
|
const definition = await getDefinitionFile(argv).getDefinition();
|
|
2235
2251
|
await reportRateLimit(reporter, github, async () => {
|
|
2236
2252
|
const orgGetter = createOrgGetter(github);
|
|
2237
|
-
await process
|
|
2253
|
+
await process(reporter, github, definition, orgGetter, !!argv["execute"], argv["org"]);
|
|
2238
2254
|
});
|
|
2239
2255
|
},
|
|
2240
2256
|
};
|
|
2241
2257
|
|
|
2242
2258
|
async function generateCloneCommands({ reporter, config, github, org, ...opt }) {
|
|
2243
2259
|
if (!opt.listGroups && !opt.all && opt.group === undefined) {
|
|
2244
|
-
yargs(hideBin(process.argv)).showHelp();
|
|
2260
|
+
yargs(hideBin(process$2.argv)).showHelp();
|
|
2245
2261
|
return;
|
|
2246
2262
|
}
|
|
2247
2263
|
const repos = await github.getOrgRepoList({ org });
|
|
@@ -2265,7 +2281,7 @@ async function generateCloneCommands({ reporter, config, github, org, ...opt })
|
|
|
2265
2281
|
.forEach((repo) => {
|
|
2266
2282
|
// The output of this is used to pipe into e.g. bash.
|
|
2267
2283
|
// We cannot use reporter.log as it adds additional characters.
|
|
2268
|
-
process.stdout.write(sprintf('[ ! -e "%s" ] && git clone %s\n', repo.name, repo.sshUrl));
|
|
2284
|
+
process$2.stdout.write(sprintf('[ ! -e "%s" ] && git clone %s\n', repo.name, repo.sshUrl));
|
|
2269
2285
|
});
|
|
2270
2286
|
});
|
|
2271
2287
|
}
|
|
@@ -2277,7 +2293,7 @@ const command$a = {
|
|
|
2277
2293
|
describe: "Group to generate commands for",
|
|
2278
2294
|
})
|
|
2279
2295
|
.options("org", {
|
|
2280
|
-
|
|
2296
|
+
demandOption: true,
|
|
2281
2297
|
describe: "Specify GitHub organization",
|
|
2282
2298
|
type: "string",
|
|
2283
2299
|
})
|
|
@@ -2409,7 +2425,7 @@ async function listRepos({ reporter, github, includeArchived, name = undefined,
|
|
|
2409
2425
|
}
|
|
2410
2426
|
// All CSV output is done using direct stdout to avoid extra chars.
|
|
2411
2427
|
if (csv) {
|
|
2412
|
-
process.stdout.write("reponame,group\n");
|
|
2428
|
+
process$2.stdout.write("reponame,group\n");
|
|
2413
2429
|
}
|
|
2414
2430
|
getGroupedRepos(repos).forEach((group) => {
|
|
2415
2431
|
if (!csv && compact) {
|
|
@@ -2422,7 +2438,7 @@ async function listRepos({ reporter, github, includeArchived, name = undefined,
|
|
|
2422
2438
|
group.items.forEach((repo) => {
|
|
2423
2439
|
if (csv) {
|
|
2424
2440
|
// We assume we have no repos or group names with a comma in its name.
|
|
2425
|
-
process.stdout.write(`${repo.name},${group.name}\n`);
|
|
2441
|
+
process$2.stdout.write(`${repo.name},${group.name}\n`);
|
|
2426
2442
|
return;
|
|
2427
2443
|
}
|
|
2428
2444
|
if (compact) {
|
|
@@ -2988,7 +3004,7 @@ async function sync$1({ reporter, github, cals, rootdir, askClone, askMove, }) {
|
|
|
2988
3004
|
for (const it of archivedRepos) {
|
|
2989
3005
|
reporter.info(` ${it.actualRelpath}`);
|
|
2990
3006
|
}
|
|
2991
|
-
const thisDirName = path.basename(process.cwd());
|
|
3007
|
+
const thisDirName = path.basename(process$2.cwd());
|
|
2992
3008
|
const archiveDir = `../${thisDirName}-archive`;
|
|
2993
3009
|
const hasArchiveDir = fs.existsSync(archiveDir);
|
|
2994
3010
|
if (hasArchiveDir) {
|
|
@@ -3070,7 +3086,7 @@ async function loadCalsManifest(config, reporter) {
|
|
|
3070
3086
|
const p = await findUp(CALS_YAML, { cwd: config.cwd });
|
|
3071
3087
|
if (p === undefined) {
|
|
3072
3088
|
reporter.error(`File ${CALS_YAML} not found. See help`);
|
|
3073
|
-
process.exitCode = 1;
|
|
3089
|
+
process$2.exitCode = 1;
|
|
3074
3090
|
return null;
|
|
3075
3091
|
}
|
|
3076
3092
|
// TODO: Verify file has expected contents.
|
|
@@ -3186,7 +3202,7 @@ Notes:
|
|
|
3186
3202
|
option to avoid stale cache. The cache can also be cleared with
|
|
3187
3203
|
the "cals delete-cache" command.`),
|
|
3188
3204
|
handler: () => {
|
|
3189
|
-
yargs(hideBin(process.argv)).showHelp();
|
|
3205
|
+
yargs(hideBin(process$2.argv)).showHelp();
|
|
3190
3206
|
},
|
|
3191
3207
|
};
|
|
3192
3208
|
|
|
@@ -3198,7 +3214,7 @@ function totalSeverityCount(project) {
|
|
|
3198
3214
|
}
|
|
3199
3215
|
function buildStatsLine(stats) {
|
|
3200
3216
|
function item(num, str) {
|
|
3201
|
-
return num === 0 ?
|
|
3217
|
+
return num === 0 ? " ".repeat(str.length + 4) : sprintf("%3d %s", num, str);
|
|
3202
3218
|
}
|
|
3203
3219
|
return sprintf("%s %s %s %s", item(stats.critical ?? 0, "critical"), item(stats.high, "high"), item(stats.medium, "medium"), item(stats.low, "low"));
|
|
3204
3220
|
}
|
|
@@ -3334,17 +3350,17 @@ Notes:
|
|
|
3334
3350
|
and provide a link to generate one:
|
|
3335
3351
|
$ cals snyk set-token`),
|
|
3336
3352
|
handler: () => {
|
|
3337
|
-
yargs(hideBin(process.argv)).showHelp();
|
|
3353
|
+
yargs(hideBin(process$2.argv)).showHelp();
|
|
3338
3354
|
},
|
|
3339
3355
|
};
|
|
3340
3356
|
|
|
3341
3357
|
async function main() {
|
|
3342
|
-
if (!semver.satisfies(process.version, engines.node)) {
|
|
3343
|
-
console.error(`Required node version ${engines.node} not satisfied with current version ${process.version}.`);
|
|
3344
|
-
process.exit(1);
|
|
3358
|
+
if (!semver.satisfies(process$2.version, engines.node)) {
|
|
3359
|
+
console.error(`Required node version ${engines.node} not satisfied with current version ${process$2.version}.`);
|
|
3360
|
+
process$2.exit(1);
|
|
3345
3361
|
}
|
|
3346
|
-
await yargs(hideBin(process.argv))
|
|
3347
|
-
.usage(`cals-cli v${version} (build: ${"
|
|
3362
|
+
await yargs(hideBin(process$2.argv))
|
|
3363
|
+
.usage(`cals-cli v${version} (build: ${"2025-01-10T09:38:35+0000"})`)
|
|
3348
3364
|
.scriptName("cals")
|
|
3349
3365
|
.locale("en")
|
|
3350
3366
|
.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
|
@@ -1,27 +1,28 @@
|
|
|
1
|
-
import fs from 'fs';
|
|
1
|
+
import fs from 'node:fs';
|
|
2
2
|
import path from 'path';
|
|
3
3
|
import rimraf from 'rimraf';
|
|
4
4
|
import chalk from 'chalk';
|
|
5
5
|
import readline from 'readline';
|
|
6
|
+
import process$1 from 'node:process';
|
|
6
7
|
import 'util';
|
|
7
8
|
import cachedir from 'cachedir';
|
|
8
9
|
import https from 'https';
|
|
9
10
|
import os from 'os';
|
|
10
11
|
import AJV from 'ajv';
|
|
11
12
|
import yaml from 'js-yaml';
|
|
12
|
-
import { uniq } from 'lodash-es';
|
|
13
13
|
import { Octokit } from '@octokit/rest';
|
|
14
14
|
import fetch from 'node-fetch';
|
|
15
15
|
import pLimit from 'p-limit';
|
|
16
16
|
import keytar from 'keytar';
|
|
17
|
-
import * as process
|
|
17
|
+
import * as process from 'process';
|
|
18
18
|
import { performance } from 'perf_hooks';
|
|
19
|
+
import { Buffer } from 'node:buffer';
|
|
19
20
|
import { strict } from 'assert';
|
|
20
21
|
import execa from 'execa';
|
|
21
22
|
import read from 'read';
|
|
22
23
|
import { Transform } from 'stream';
|
|
23
24
|
|
|
24
|
-
var version = "3.
|
|
25
|
+
var version = "3.10.0";
|
|
25
26
|
|
|
26
27
|
class CacheProvider {
|
|
27
28
|
constructor(config) {
|
|
@@ -86,14 +87,11 @@ class Reporter {
|
|
|
86
87
|
this.nonInteractive = !!opts.nonInteractive;
|
|
87
88
|
this.isVerbose = !!opts.verbose;
|
|
88
89
|
}
|
|
89
|
-
stdout = process.stdout;
|
|
90
|
-
stderr = process.stderr;
|
|
91
|
-
stdin = process.stdin;
|
|
92
|
-
isTTY = this.stdout.isTTY;
|
|
90
|
+
stdout = process$1.stdout;
|
|
91
|
+
stderr = process$1.stderr;
|
|
93
92
|
nonInteractive;
|
|
94
93
|
isVerbose;
|
|
95
94
|
format = chalk;
|
|
96
|
-
startTime = Date.now();
|
|
97
95
|
error(msg) {
|
|
98
96
|
clearLine(this.stderr);
|
|
99
97
|
this.stderr.write(`${this.format.red("error")} ${msg}\n`);
|
|
@@ -106,10 +104,6 @@ class Reporter {
|
|
|
106
104
|
clearLine(this.stderr);
|
|
107
105
|
this.stderr.write(`${this.format.yellow("warning")} ${msg}\n`);
|
|
108
106
|
}
|
|
109
|
-
success(msg) {
|
|
110
|
-
clearLine(this.stdout);
|
|
111
|
-
this.stdout.write(`${this.format.green("success")} ${msg}\n`);
|
|
112
|
-
}
|
|
113
107
|
info(msg) {
|
|
114
108
|
clearLine(this.stdout);
|
|
115
109
|
this.stdout.write(`${this.format.blue("info")} ${msg}\n`);
|
|
@@ -117,7 +111,7 @@ class Reporter {
|
|
|
117
111
|
}
|
|
118
112
|
|
|
119
113
|
class Config {
|
|
120
|
-
cwd = path.resolve(process.cwd());
|
|
114
|
+
cwd = path.resolve(process$1.cwd());
|
|
121
115
|
configFile = path.join(os.homedir(), ".cals-config.json");
|
|
122
116
|
cacheDir = cachedir("cals-cli");
|
|
123
117
|
agent = new https.Agent({
|
|
@@ -460,6 +454,10 @@ var schema = {
|
|
|
460
454
|
$schema: $schema
|
|
461
455
|
};
|
|
462
456
|
|
|
457
|
+
function uniq(array) {
|
|
458
|
+
return Array.from(new Set(array));
|
|
459
|
+
}
|
|
460
|
+
|
|
463
461
|
function getTeamId(org, teamName) {
|
|
464
462
|
return `${org}/${teamName}`;
|
|
465
463
|
}
|
|
@@ -576,9 +574,19 @@ function getRepos(definition) {
|
|
|
576
574
|
.flat());
|
|
577
575
|
}
|
|
578
576
|
function getGitHubOrgs(definition) {
|
|
579
|
-
|
|
577
|
+
const githubOrganizations = definition.projects.flatMap((project) => project.github.map((it) => it.organization));
|
|
578
|
+
return uniq(githubOrganizations);
|
|
580
579
|
}
|
|
581
580
|
|
|
581
|
+
var index$3 = /*#__PURE__*/Object.freeze({
|
|
582
|
+
__proto__: null,
|
|
583
|
+
DefinitionFile: DefinitionFile,
|
|
584
|
+
getGitHubOrgs: getGitHubOrgs,
|
|
585
|
+
getRepoId: getRepoId,
|
|
586
|
+
getRepos: getRepos,
|
|
587
|
+
parseDefinition: parseDefinition
|
|
588
|
+
});
|
|
589
|
+
|
|
582
590
|
function createReporter(argv) {
|
|
583
591
|
return new Reporter({
|
|
584
592
|
verbose: !!argv.verbose,
|
|
@@ -590,12 +598,12 @@ class GitHubTokenCliProvider {
|
|
|
590
598
|
keyringService = "cals";
|
|
591
599
|
keyringAccount = "github-token";
|
|
592
600
|
async getToken() {
|
|
593
|
-
if (process.env.CALS_GITHUB_TOKEN) {
|
|
594
|
-
return process.env.CALS_GITHUB_TOKEN;
|
|
601
|
+
if (process$1.env.CALS_GITHUB_TOKEN) {
|
|
602
|
+
return process$1.env.CALS_GITHUB_TOKEN;
|
|
595
603
|
}
|
|
596
604
|
const result = await keytar.getPassword(this.keyringService, this.keyringAccount);
|
|
597
605
|
if (result == null) {
|
|
598
|
-
process.stderr.write("No token found. Register using `cals github set-token`\n");
|
|
606
|
+
process$1.stderr.write("No token found. Register using `cals github set-token`\n");
|
|
599
607
|
return undefined;
|
|
600
608
|
}
|
|
601
609
|
return result;
|
|
@@ -728,7 +736,7 @@ class GitHubService {
|
|
|
728
736
|
return result;
|
|
729
737
|
});
|
|
730
738
|
if (response.status === 401) {
|
|
731
|
-
process
|
|
739
|
+
process.stderr.write("Unauthorized\n");
|
|
732
740
|
await this.tokenProvider.markInvalid();
|
|
733
741
|
}
|
|
734
742
|
// If you get 502 after 10s, it is a timeout.
|
|
@@ -1120,15 +1128,6 @@ async function createGitHubService(props) {
|
|
|
1120
1128
|
});
|
|
1121
1129
|
}
|
|
1122
1130
|
|
|
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
1131
|
var index$2 = /*#__PURE__*/Object.freeze({
|
|
1133
1132
|
__proto__: null,
|
|
1134
1133
|
createGitHubService: createGitHubService,
|
|
@@ -1139,12 +1138,12 @@ class SnykTokenCliProvider {
|
|
|
1139
1138
|
keyringService = "cals";
|
|
1140
1139
|
keyringAccount = "snyk-token";
|
|
1141
1140
|
async getToken() {
|
|
1142
|
-
if (process.env.CALS_SNYK_TOKEN) {
|
|
1143
|
-
return process.env.CALS_SNYK_TOKEN;
|
|
1141
|
+
if (process$1.env.CALS_SNYK_TOKEN) {
|
|
1142
|
+
return process$1.env.CALS_SNYK_TOKEN;
|
|
1144
1143
|
}
|
|
1145
1144
|
const result = await keytar.getPassword(this.keyringService, this.keyringAccount);
|
|
1146
1145
|
if (result == null) {
|
|
1147
|
-
process.stderr.write("No token found. Register using `cals snyk set-token`\n");
|
|
1146
|
+
process$1.stderr.write("No token found. Register using `cals snyk set-token`\n");
|
|
1148
1147
|
return undefined;
|
|
1149
1148
|
}
|
|
1150
1149
|
return result;
|
|
@@ -1202,7 +1201,7 @@ class SnykService {
|
|
|
1202
1201
|
agent: this.config.agent,
|
|
1203
1202
|
});
|
|
1204
1203
|
if (response.status === 401) {
|
|
1205
|
-
process.stderr.write("Unauthorized - removing token\n");
|
|
1204
|
+
process$1.stderr.write("Unauthorized - removing token\n");
|
|
1206
1205
|
await this.tokenProvider.markInvalid();
|
|
1207
1206
|
}
|
|
1208
1207
|
if (!response.ok) {
|
|
@@ -1261,7 +1260,7 @@ function getGitHubRepo(snykProject) {
|
|
|
1261
1260
|
}
|
|
1262
1261
|
else if (snykProject.origin === "cli" &&
|
|
1263
1262
|
snykProject.remoteRepoUrl != null) {
|
|
1264
|
-
// The remoteRepoUrl can be
|
|
1263
|
+
// The remoteRepoUrl can be overridden when using the CLI, so don't
|
|
1265
1264
|
// fail if we cannot extract the value.
|
|
1266
1265
|
const match = /github.com\/([^/]+)\/(.+)\.git$/.exec(snykProject.remoteRepoUrl);
|
|
1267
1266
|
if (match === null) {
|
|
@@ -1290,10 +1289,10 @@ var index$1 = /*#__PURE__*/Object.freeze({
|
|
|
1290
1289
|
|
|
1291
1290
|
class SonarCloudTokenCliProvider {
|
|
1292
1291
|
async getToken() {
|
|
1293
|
-
if (process.env.CALS_SONARCLOUD_TOKEN) {
|
|
1294
|
-
return Promise.resolve(process.env.CALS_SONARCLOUD_TOKEN);
|
|
1292
|
+
if (process$1.env.CALS_SONARCLOUD_TOKEN) {
|
|
1293
|
+
return Promise.resolve(process$1.env.CALS_SONARCLOUD_TOKEN);
|
|
1295
1294
|
}
|
|
1296
|
-
process.stderr.write("No environmental variable found. Set variable `CALS_SONARCLOUD_TOKEN` to token value\n");
|
|
1295
|
+
process$1.stderr.write("No environmental variable found. Set variable `CALS_SONARCLOUD_TOKEN` to token value\n");
|
|
1297
1296
|
return undefined;
|
|
1298
1297
|
}
|
|
1299
1298
|
async markInvalid() {
|
|
@@ -1326,11 +1325,11 @@ class SonarCloudService {
|
|
|
1326
1325
|
agent: this.config.agent,
|
|
1327
1326
|
});
|
|
1328
1327
|
if (response.status === 401) {
|
|
1329
|
-
process.stderr.write("Unauthorized - removing token\n");
|
|
1328
|
+
process$1.stderr.write("Unauthorized - removing token\n");
|
|
1330
1329
|
await this.tokenProvider.markInvalid();
|
|
1331
1330
|
}
|
|
1332
1331
|
if (response.status === 404) {
|
|
1333
|
-
process.stderr.write(`Project ${sonarCloudProjectKey} does not exist in SonarCloud\n`);
|
|
1332
|
+
process$1.stderr.write(`Project ${sonarCloudProjectKey} does not exist in SonarCloud\n`);
|
|
1334
1333
|
return undefined;
|
|
1335
1334
|
}
|
|
1336
1335
|
if (!response.ok) {
|
|
@@ -1413,14 +1412,14 @@ class TestExecutor {
|
|
|
1413
1412
|
// This will not abort the running tasks until after
|
|
1414
1413
|
// we have completed the cleanup tasks. The running tasks
|
|
1415
1414
|
// can stop earlier by calling checkCanContinue.
|
|
1416
|
-
process.on("SIGINT", () => {
|
|
1415
|
+
process$1.on("SIGINT", () => {
|
|
1417
1416
|
console.warn("Caught interrupt signal - forcing termination");
|
|
1418
1417
|
if (this.cleanupTask != null) {
|
|
1419
1418
|
return;
|
|
1420
1419
|
}
|
|
1421
1420
|
this.shutdown = true;
|
|
1422
1421
|
this.cleanupTask = this.runTasks().then(() => {
|
|
1423
|
-
process.exit(1);
|
|
1422
|
+
process$1.exit(1);
|
|
1424
1423
|
});
|
|
1425
1424
|
});
|
|
1426
1425
|
await body(this);
|
|
@@ -1428,7 +1427,7 @@ class TestExecutor {
|
|
|
1428
1427
|
catch (error) {
|
|
1429
1428
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
1430
1429
|
console.error(error.stack || error.message || error);
|
|
1431
|
-
process.exitCode = 1;
|
|
1430
|
+
process$1.exitCode = 1;
|
|
1432
1431
|
}
|
|
1433
1432
|
finally {
|
|
1434
1433
|
console.log(`Reached finally block`);
|
|
@@ -1621,14 +1620,14 @@ class OutputPrefixTransform extends Transform {
|
|
|
1621
1620
|
function pipeToConsole(result, name) {
|
|
1622
1621
|
result.stdout
|
|
1623
1622
|
?.pipe(new OutputPrefixTransform(`${name}: `))
|
|
1624
|
-
.pipe(process.stdout);
|
|
1623
|
+
.pipe(process$1.stdout);
|
|
1625
1624
|
result.stderr
|
|
1626
1625
|
?.pipe(new OutputPrefixTransform(`${name} (stderr): `))
|
|
1627
|
-
.pipe(process.stderr);
|
|
1626
|
+
.pipe(process$1.stderr);
|
|
1628
1627
|
}
|
|
1629
1628
|
function checkPidRunning(pid) {
|
|
1630
1629
|
try {
|
|
1631
|
-
process.kill(pid, 0);
|
|
1630
|
+
process$1.kill(pid, 0);
|
|
1632
1631
|
return true;
|
|
1633
1632
|
}
|
|
1634
1633
|
catch {
|
|
@@ -1771,7 +1770,7 @@ async function runNpmRunScript(name, options) {
|
|
|
1771
1770
|
* This likely does not cover all situations.
|
|
1772
1771
|
*/
|
|
1773
1772
|
async function getDockerHostAddress() {
|
|
1774
|
-
if (process.platform === "darwin" || process.platform === "win32") {
|
|
1773
|
+
if (process$1.platform === "darwin" || process$1.platform === "win32") {
|
|
1775
1774
|
return "host.docker.internal";
|
|
1776
1775
|
}
|
|
1777
1776
|
if (fs.existsSync("/.dockerenv")) {
|
|
@@ -1782,7 +1781,7 @@ async function getDockerHostAddress() {
|
|
|
1782
1781
|
return res.stdout
|
|
1783
1782
|
.split("\n")
|
|
1784
1783
|
.filter((it) => it.includes("default via"))
|
|
1785
|
-
.map((it) => /default via ([\d
|
|
1784
|
+
.map((it) => /default via ([\d.]+) /.exec(it)[1])[0];
|
|
1786
1785
|
}
|
|
1787
1786
|
catch {
|
|
1788
1787
|
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
|
@@ -1,27 +1,28 @@
|
|
|
1
|
-
import fs from 'fs';
|
|
1
|
+
import fs from 'node:fs';
|
|
2
2
|
import path from 'path';
|
|
3
3
|
import rimraf from 'rimraf';
|
|
4
4
|
import chalk from 'chalk';
|
|
5
5
|
import readline from 'readline';
|
|
6
|
+
import process$1 from 'node:process';
|
|
6
7
|
import 'util';
|
|
7
8
|
import cachedir from 'cachedir';
|
|
8
9
|
import https from 'https';
|
|
9
10
|
import os from 'os';
|
|
10
11
|
import AJV from 'ajv';
|
|
11
12
|
import yaml from 'js-yaml';
|
|
12
|
-
import { uniq } from 'lodash-es';
|
|
13
13
|
import { Octokit } from '@octokit/rest';
|
|
14
14
|
import fetch from 'node-fetch';
|
|
15
15
|
import pLimit from 'p-limit';
|
|
16
16
|
import keytar from 'keytar';
|
|
17
|
-
import * as process
|
|
17
|
+
import * as process from 'process';
|
|
18
18
|
import { performance } from 'perf_hooks';
|
|
19
|
+
import { Buffer } from 'node:buffer';
|
|
19
20
|
import { strict } from 'assert';
|
|
20
21
|
import execa from 'execa';
|
|
21
22
|
import read from 'read';
|
|
22
23
|
import { Transform } from 'stream';
|
|
23
24
|
|
|
24
|
-
var version = "3.
|
|
25
|
+
var version = "3.10.0";
|
|
25
26
|
|
|
26
27
|
class CacheProvider {
|
|
27
28
|
constructor(config) {
|
|
@@ -86,14 +87,11 @@ class Reporter {
|
|
|
86
87
|
this.nonInteractive = !!opts.nonInteractive;
|
|
87
88
|
this.isVerbose = !!opts.verbose;
|
|
88
89
|
}
|
|
89
|
-
stdout = process.stdout;
|
|
90
|
-
stderr = process.stderr;
|
|
91
|
-
stdin = process.stdin;
|
|
92
|
-
isTTY = this.stdout.isTTY;
|
|
90
|
+
stdout = process$1.stdout;
|
|
91
|
+
stderr = process$1.stderr;
|
|
93
92
|
nonInteractive;
|
|
94
93
|
isVerbose;
|
|
95
94
|
format = chalk;
|
|
96
|
-
startTime = Date.now();
|
|
97
95
|
error(msg) {
|
|
98
96
|
clearLine(this.stderr);
|
|
99
97
|
this.stderr.write(`${this.format.red("error")} ${msg}\n`);
|
|
@@ -106,10 +104,6 @@ class Reporter {
|
|
|
106
104
|
clearLine(this.stderr);
|
|
107
105
|
this.stderr.write(`${this.format.yellow("warning")} ${msg}\n`);
|
|
108
106
|
}
|
|
109
|
-
success(msg) {
|
|
110
|
-
clearLine(this.stdout);
|
|
111
|
-
this.stdout.write(`${this.format.green("success")} ${msg}\n`);
|
|
112
|
-
}
|
|
113
107
|
info(msg) {
|
|
114
108
|
clearLine(this.stdout);
|
|
115
109
|
this.stdout.write(`${this.format.blue("info")} ${msg}\n`);
|
|
@@ -117,7 +111,7 @@ class Reporter {
|
|
|
117
111
|
}
|
|
118
112
|
|
|
119
113
|
class Config {
|
|
120
|
-
cwd = path.resolve(process.cwd());
|
|
114
|
+
cwd = path.resolve(process$1.cwd());
|
|
121
115
|
configFile = path.join(os.homedir(), ".cals-config.json");
|
|
122
116
|
cacheDir = cachedir("cals-cli");
|
|
123
117
|
agent = new https.Agent({
|
|
@@ -460,6 +454,10 @@ var schema = {
|
|
|
460
454
|
$schema: $schema
|
|
461
455
|
};
|
|
462
456
|
|
|
457
|
+
function uniq(array) {
|
|
458
|
+
return Array.from(new Set(array));
|
|
459
|
+
}
|
|
460
|
+
|
|
463
461
|
function getTeamId(org, teamName) {
|
|
464
462
|
return `${org}/${teamName}`;
|
|
465
463
|
}
|
|
@@ -576,9 +574,19 @@ function getRepos(definition) {
|
|
|
576
574
|
.flat());
|
|
577
575
|
}
|
|
578
576
|
function getGitHubOrgs(definition) {
|
|
579
|
-
|
|
577
|
+
const githubOrganizations = definition.projects.flatMap((project) => project.github.map((it) => it.organization));
|
|
578
|
+
return uniq(githubOrganizations);
|
|
580
579
|
}
|
|
581
580
|
|
|
581
|
+
var index$3 = /*#__PURE__*/Object.freeze({
|
|
582
|
+
__proto__: null,
|
|
583
|
+
DefinitionFile: DefinitionFile,
|
|
584
|
+
getGitHubOrgs: getGitHubOrgs,
|
|
585
|
+
getRepoId: getRepoId,
|
|
586
|
+
getRepos: getRepos,
|
|
587
|
+
parseDefinition: parseDefinition
|
|
588
|
+
});
|
|
589
|
+
|
|
582
590
|
function createReporter(argv) {
|
|
583
591
|
return new Reporter({
|
|
584
592
|
verbose: !!argv.verbose,
|
|
@@ -590,12 +598,12 @@ class GitHubTokenCliProvider {
|
|
|
590
598
|
keyringService = "cals";
|
|
591
599
|
keyringAccount = "github-token";
|
|
592
600
|
async getToken() {
|
|
593
|
-
if (process.env.CALS_GITHUB_TOKEN) {
|
|
594
|
-
return process.env.CALS_GITHUB_TOKEN;
|
|
601
|
+
if (process$1.env.CALS_GITHUB_TOKEN) {
|
|
602
|
+
return process$1.env.CALS_GITHUB_TOKEN;
|
|
595
603
|
}
|
|
596
604
|
const result = await keytar.getPassword(this.keyringService, this.keyringAccount);
|
|
597
605
|
if (result == null) {
|
|
598
|
-
process.stderr.write("No token found. Register using `cals github set-token`\n");
|
|
606
|
+
process$1.stderr.write("No token found. Register using `cals github set-token`\n");
|
|
599
607
|
return undefined;
|
|
600
608
|
}
|
|
601
609
|
return result;
|
|
@@ -728,7 +736,7 @@ class GitHubService {
|
|
|
728
736
|
return result;
|
|
729
737
|
});
|
|
730
738
|
if (response.status === 401) {
|
|
731
|
-
process
|
|
739
|
+
process.stderr.write("Unauthorized\n");
|
|
732
740
|
await this.tokenProvider.markInvalid();
|
|
733
741
|
}
|
|
734
742
|
// If you get 502 after 10s, it is a timeout.
|
|
@@ -1120,15 +1128,6 @@ async function createGitHubService(props) {
|
|
|
1120
1128
|
});
|
|
1121
1129
|
}
|
|
1122
1130
|
|
|
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
1131
|
var index$2 = /*#__PURE__*/Object.freeze({
|
|
1133
1132
|
__proto__: null,
|
|
1134
1133
|
createGitHubService: createGitHubService,
|
|
@@ -1139,12 +1138,12 @@ class SnykTokenCliProvider {
|
|
|
1139
1138
|
keyringService = "cals";
|
|
1140
1139
|
keyringAccount = "snyk-token";
|
|
1141
1140
|
async getToken() {
|
|
1142
|
-
if (process.env.CALS_SNYK_TOKEN) {
|
|
1143
|
-
return process.env.CALS_SNYK_TOKEN;
|
|
1141
|
+
if (process$1.env.CALS_SNYK_TOKEN) {
|
|
1142
|
+
return process$1.env.CALS_SNYK_TOKEN;
|
|
1144
1143
|
}
|
|
1145
1144
|
const result = await keytar.getPassword(this.keyringService, this.keyringAccount);
|
|
1146
1145
|
if (result == null) {
|
|
1147
|
-
process.stderr.write("No token found. Register using `cals snyk set-token`\n");
|
|
1146
|
+
process$1.stderr.write("No token found. Register using `cals snyk set-token`\n");
|
|
1148
1147
|
return undefined;
|
|
1149
1148
|
}
|
|
1150
1149
|
return result;
|
|
@@ -1202,7 +1201,7 @@ class SnykService {
|
|
|
1202
1201
|
agent: this.config.agent,
|
|
1203
1202
|
});
|
|
1204
1203
|
if (response.status === 401) {
|
|
1205
|
-
process.stderr.write("Unauthorized - removing token\n");
|
|
1204
|
+
process$1.stderr.write("Unauthorized - removing token\n");
|
|
1206
1205
|
await this.tokenProvider.markInvalid();
|
|
1207
1206
|
}
|
|
1208
1207
|
if (!response.ok) {
|
|
@@ -1261,7 +1260,7 @@ function getGitHubRepo(snykProject) {
|
|
|
1261
1260
|
}
|
|
1262
1261
|
else if (snykProject.origin === "cli" &&
|
|
1263
1262
|
snykProject.remoteRepoUrl != null) {
|
|
1264
|
-
// The remoteRepoUrl can be
|
|
1263
|
+
// The remoteRepoUrl can be overridden when using the CLI, so don't
|
|
1265
1264
|
// fail if we cannot extract the value.
|
|
1266
1265
|
const match = /github.com\/([^/]+)\/(.+)\.git$/.exec(snykProject.remoteRepoUrl);
|
|
1267
1266
|
if (match === null) {
|
|
@@ -1290,10 +1289,10 @@ var index$1 = /*#__PURE__*/Object.freeze({
|
|
|
1290
1289
|
|
|
1291
1290
|
class SonarCloudTokenCliProvider {
|
|
1292
1291
|
async getToken() {
|
|
1293
|
-
if (process.env.CALS_SONARCLOUD_TOKEN) {
|
|
1294
|
-
return Promise.resolve(process.env.CALS_SONARCLOUD_TOKEN);
|
|
1292
|
+
if (process$1.env.CALS_SONARCLOUD_TOKEN) {
|
|
1293
|
+
return Promise.resolve(process$1.env.CALS_SONARCLOUD_TOKEN);
|
|
1295
1294
|
}
|
|
1296
|
-
process.stderr.write("No environmental variable found. Set variable `CALS_SONARCLOUD_TOKEN` to token value\n");
|
|
1295
|
+
process$1.stderr.write("No environmental variable found. Set variable `CALS_SONARCLOUD_TOKEN` to token value\n");
|
|
1297
1296
|
return undefined;
|
|
1298
1297
|
}
|
|
1299
1298
|
async markInvalid() {
|
|
@@ -1326,11 +1325,11 @@ class SonarCloudService {
|
|
|
1326
1325
|
agent: this.config.agent,
|
|
1327
1326
|
});
|
|
1328
1327
|
if (response.status === 401) {
|
|
1329
|
-
process.stderr.write("Unauthorized - removing token\n");
|
|
1328
|
+
process$1.stderr.write("Unauthorized - removing token\n");
|
|
1330
1329
|
await this.tokenProvider.markInvalid();
|
|
1331
1330
|
}
|
|
1332
1331
|
if (response.status === 404) {
|
|
1333
|
-
process.stderr.write(`Project ${sonarCloudProjectKey} does not exist in SonarCloud\n`);
|
|
1332
|
+
process$1.stderr.write(`Project ${sonarCloudProjectKey} does not exist in SonarCloud\n`);
|
|
1334
1333
|
return undefined;
|
|
1335
1334
|
}
|
|
1336
1335
|
if (!response.ok) {
|
|
@@ -1413,14 +1412,14 @@ class TestExecutor {
|
|
|
1413
1412
|
// This will not abort the running tasks until after
|
|
1414
1413
|
// we have completed the cleanup tasks. The running tasks
|
|
1415
1414
|
// can stop earlier by calling checkCanContinue.
|
|
1416
|
-
process.on("SIGINT", () => {
|
|
1415
|
+
process$1.on("SIGINT", () => {
|
|
1417
1416
|
console.warn("Caught interrupt signal - forcing termination");
|
|
1418
1417
|
if (this.cleanupTask != null) {
|
|
1419
1418
|
return;
|
|
1420
1419
|
}
|
|
1421
1420
|
this.shutdown = true;
|
|
1422
1421
|
this.cleanupTask = this.runTasks().then(() => {
|
|
1423
|
-
process.exit(1);
|
|
1422
|
+
process$1.exit(1);
|
|
1424
1423
|
});
|
|
1425
1424
|
});
|
|
1426
1425
|
await body(this);
|
|
@@ -1428,7 +1427,7 @@ class TestExecutor {
|
|
|
1428
1427
|
catch (error) {
|
|
1429
1428
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
1430
1429
|
console.error(error.stack || error.message || error);
|
|
1431
|
-
process.exitCode = 1;
|
|
1430
|
+
process$1.exitCode = 1;
|
|
1432
1431
|
}
|
|
1433
1432
|
finally {
|
|
1434
1433
|
console.log(`Reached finally block`);
|
|
@@ -1621,14 +1620,14 @@ class OutputPrefixTransform extends Transform {
|
|
|
1621
1620
|
function pipeToConsole(result, name) {
|
|
1622
1621
|
result.stdout
|
|
1623
1622
|
?.pipe(new OutputPrefixTransform(`${name}: `))
|
|
1624
|
-
.pipe(process.stdout);
|
|
1623
|
+
.pipe(process$1.stdout);
|
|
1625
1624
|
result.stderr
|
|
1626
1625
|
?.pipe(new OutputPrefixTransform(`${name} (stderr): `))
|
|
1627
|
-
.pipe(process.stderr);
|
|
1626
|
+
.pipe(process$1.stderr);
|
|
1628
1627
|
}
|
|
1629
1628
|
function checkPidRunning(pid) {
|
|
1630
1629
|
try {
|
|
1631
|
-
process.kill(pid, 0);
|
|
1630
|
+
process$1.kill(pid, 0);
|
|
1632
1631
|
return true;
|
|
1633
1632
|
}
|
|
1634
1633
|
catch {
|
|
@@ -1771,7 +1770,7 @@ async function runNpmRunScript(name, options) {
|
|
|
1771
1770
|
* This likely does not cover all situations.
|
|
1772
1771
|
*/
|
|
1773
1772
|
async function getDockerHostAddress() {
|
|
1774
|
-
if (process.platform === "darwin" || process.platform === "win32") {
|
|
1773
|
+
if (process$1.platform === "darwin" || process$1.platform === "win32") {
|
|
1775
1774
|
return "host.docker.internal";
|
|
1776
1775
|
}
|
|
1777
1776
|
if (fs.existsSync("/.dockerenv")) {
|
|
@@ -1782,7 +1781,7 @@ async function getDockerHostAddress() {
|
|
|
1782
1781
|
return res.stdout
|
|
1783
1782
|
.split("\n")
|
|
1784
1783
|
.filter((it) => it.includes("default via"))
|
|
1785
|
-
.map((it) => /default via ([\d
|
|
1784
|
+
.map((it) => /default via ([\d.]+) /.exec(it)[1])[0];
|
|
1786
1785
|
}
|
|
1787
1786
|
catch {
|
|
1788
1787
|
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":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/lib/snyk/service.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capraconsulting/cals-cli",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.10.0",
|
|
4
4
|
"description": "CLI for repeatable tasks in CALS",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"prepare": "tsx scripts/create-definition-schema.ts && husky",
|
|
9
9
|
"build": "rollup -c",
|
|
10
|
-
"test": "
|
|
11
|
-
"test:watch": "
|
|
10
|
+
"test": "vitest run --coverage src",
|
|
11
|
+
"test:watch": "vitest --coverage src",
|
|
12
12
|
"lint": "eslint .",
|
|
13
13
|
"lint:fix": "eslint --fix .",
|
|
14
14
|
"prepack": "./scripts/build-and-verify.sh",
|
|
@@ -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
|
-
"
|
|
36
|
-
"node-fetch": "^2.6.7",
|
|
35
|
+
"node-fetch": "^3.0.0",
|
|
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",
|
|
@@ -56,10 +56,9 @@
|
|
|
56
56
|
"@rollup/plugin-alias": "5.1.1",
|
|
57
57
|
"@rollup/plugin-json": "6.1.0",
|
|
58
58
|
"@rollup/plugin-replace": "6.0.1",
|
|
59
|
-
"@types/jest": "29.5.14",
|
|
60
59
|
"@types/js-yaml": "4.0.9",
|
|
61
60
|
"@types/lodash-es": "4.17.12",
|
|
62
|
-
"@types/node": "22.10.
|
|
61
|
+
"@types/node": "22.10.5",
|
|
63
62
|
"@types/node-fetch": "2.6.12",
|
|
64
63
|
"@types/read": "0.0.32",
|
|
65
64
|
"@types/rimraf": "3.0.2",
|
|
@@ -68,22 +67,22 @@
|
|
|
68
67
|
"@types/yargs": "17.0.33",
|
|
69
68
|
"@typescript-eslint/eslint-plugin": "8.18.0",
|
|
70
69
|
"@typescript-eslint/parser": "8.18.0",
|
|
70
|
+
"@vitest/coverage-v8": "2.1.8",
|
|
71
|
+
"@vitest/ui": "2.1.8",
|
|
71
72
|
"dateformat": "4.6.3",
|
|
72
73
|
"eslint": "9.16.0",
|
|
73
74
|
"eslint-config-prettier": "9.1.0",
|
|
74
75
|
"eslint-plugin-prettier": "5.2.1",
|
|
75
76
|
"husky": "9.1.7",
|
|
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",
|
|
81
80
|
"semantic-release": "24.2.0",
|
|
82
81
|
"tempy": "1.0.1",
|
|
83
|
-
"ts-jest": "^29.1.1",
|
|
84
82
|
"tsx": "4.19.2",
|
|
85
83
|
"typescript": "5.7.2",
|
|
86
|
-
"typescript-json-schema": "0.65.1"
|
|
84
|
+
"typescript-json-schema": "0.65.1",
|
|
85
|
+
"vitest": "2.1.8"
|
|
87
86
|
},
|
|
88
87
|
"files": [
|
|
89
88
|
"lib"
|