@capraconsulting/cals-cli 3.13.0 → 3.13.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/README.md +4 -16
- package/lib/cals-cli.mjs +27 -27
- package/lib/index.d.ts +0 -1
- package/lib/index.es.js +24 -89
- package/lib/index.es.js.map +1 -1
- package/lib/index.js +24 -89
- package/lib/index.js.map +1 -1
- package/package.json +8 -9
- package/lib/sonarcloud/index.d.ts +0 -3
- package/lib/sonarcloud/service.d.ts +0 -33
- package/lib/sonarcloud/token.d.ts +0 -8
package/README.md
CHANGED
|
@@ -13,26 +13,14 @@ It is recommended to use `npx` over global install to ensure you
|
|
|
13
13
|
always run the latest version. If you install it globally remember
|
|
14
14
|
to update it before running.
|
|
15
15
|
|
|
16
|
-
##
|
|
16
|
+
## Build
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
Build and verify:
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
```bash
|
|
23
|
-
npm install
|
|
24
|
-
npm run build
|
|
25
|
-
npm link
|
|
20
|
+
```sh
|
|
21
|
+
$ make # or "make build"
|
|
26
22
|
```
|
|
27
23
|
|
|
28
|
-
Run the cli from any terminal/folder:
|
|
29
|
-
|
|
30
|
-
```bash
|
|
31
|
-
cals
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
Rebuild using `npm run build`.
|
|
35
|
-
|
|
36
24
|
## Contributing
|
|
37
25
|
|
|
38
26
|
This project uses [semantic release](https://semantic-release.gitbook.io/semantic-release/)
|
package/lib/cals-cli.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import process$
|
|
2
|
+
import * as process$1 from 'node:process';
|
|
3
|
+
import process__default from 'node:process';
|
|
3
4
|
import semver from 'semver';
|
|
4
5
|
import yargs from 'yargs';
|
|
5
6
|
import { hideBin } from 'yargs/helpers';
|
|
@@ -12,7 +13,6 @@ import { performance } from 'node:perf_hooks';
|
|
|
12
13
|
import { Octokit } from '@octokit/rest';
|
|
13
14
|
import fetch from 'node-fetch';
|
|
14
15
|
import pLimit from 'p-limit';
|
|
15
|
-
import * as process$1 from 'process';
|
|
16
16
|
import keytar from 'keytar';
|
|
17
17
|
import { deprecate } from 'node:util';
|
|
18
18
|
import path from 'node:path';
|
|
@@ -26,7 +26,7 @@ import { read } from 'read';
|
|
|
26
26
|
import { findUp } from 'find-up';
|
|
27
27
|
import { execa } from 'execa';
|
|
28
28
|
|
|
29
|
-
var version = "3.13.
|
|
29
|
+
var version = "3.13.1";
|
|
30
30
|
var engines = {
|
|
31
31
|
node: ">=22.14.0"
|
|
32
32
|
};
|
|
@@ -464,12 +464,12 @@ class GitHubTokenCliProvider {
|
|
|
464
464
|
keyringService = "cals";
|
|
465
465
|
keyringAccount = "github-token";
|
|
466
466
|
async getToken() {
|
|
467
|
-
if (
|
|
468
|
-
return
|
|
467
|
+
if (process__default.env.CALS_GITHUB_TOKEN) {
|
|
468
|
+
return process__default.env.CALS_GITHUB_TOKEN;
|
|
469
469
|
}
|
|
470
470
|
const result = await keytar.getPassword(this.keyringService, this.keyringAccount);
|
|
471
471
|
if (result == null) {
|
|
472
|
-
|
|
472
|
+
process__default.stderr.write("No token found. Register using `cals github set-token`\n");
|
|
473
473
|
return undefined;
|
|
474
474
|
}
|
|
475
475
|
return result;
|
|
@@ -1035,12 +1035,12 @@ class SnykTokenCliProvider {
|
|
|
1035
1035
|
keyringService = "cals";
|
|
1036
1036
|
keyringAccount = "snyk-token";
|
|
1037
1037
|
async getToken() {
|
|
1038
|
-
if (
|
|
1039
|
-
return
|
|
1038
|
+
if (process__default.env.CALS_SNYK_TOKEN) {
|
|
1039
|
+
return process__default.env.CALS_SNYK_TOKEN;
|
|
1040
1040
|
}
|
|
1041
1041
|
const result = await keytar.getPassword(this.keyringService, this.keyringAccount);
|
|
1042
1042
|
if (result == null) {
|
|
1043
|
-
|
|
1043
|
+
process__default.stderr.write("No token found. Register using `cals snyk set-token`\n");
|
|
1044
1044
|
return undefined;
|
|
1045
1045
|
}
|
|
1046
1046
|
return result;
|
|
@@ -1098,7 +1098,7 @@ class SnykService {
|
|
|
1098
1098
|
agent: this.config.agent,
|
|
1099
1099
|
});
|
|
1100
1100
|
if (response.status === 401) {
|
|
1101
|
-
|
|
1101
|
+
process__default.stderr.write("Unauthorized - removing token\n");
|
|
1102
1102
|
await this.tokenProvider.markInvalid();
|
|
1103
1103
|
}
|
|
1104
1104
|
if (!response.ok) {
|
|
@@ -1227,7 +1227,7 @@ class CacheProvider {
|
|
|
1227
1227
|
}
|
|
1228
1228
|
|
|
1229
1229
|
class Config {
|
|
1230
|
-
cwd = path.resolve(
|
|
1230
|
+
cwd = path.resolve(process__default.cwd());
|
|
1231
1231
|
configFile = path.join(os.homedir(), ".cals-config.json");
|
|
1232
1232
|
cacheDir = cachedir("cals-cli");
|
|
1233
1233
|
agent = new https.Agent({
|
|
@@ -1285,8 +1285,8 @@ class Reporter {
|
|
|
1285
1285
|
this.nonInteractive = !!opts.nonInteractive;
|
|
1286
1286
|
this.isVerbose = !!opts.verbose;
|
|
1287
1287
|
}
|
|
1288
|
-
stdout =
|
|
1289
|
-
stderr =
|
|
1288
|
+
stdout = process__default.stdout;
|
|
1289
|
+
stderr = process__default.stderr;
|
|
1290
1290
|
nonInteractive;
|
|
1291
1291
|
isVerbose;
|
|
1292
1292
|
format = chalk;
|
|
@@ -1626,7 +1626,7 @@ const command$f = {
|
|
|
1626
1626
|
.demandCommand()
|
|
1627
1627
|
.usage("cals definition"),
|
|
1628
1628
|
handler: () => {
|
|
1629
|
-
yargs(hideBin(
|
|
1629
|
+
yargs(hideBin(process__default.argv)).showHelp();
|
|
1630
1630
|
},
|
|
1631
1631
|
};
|
|
1632
1632
|
|
|
@@ -2209,7 +2209,7 @@ const command$b = {
|
|
|
2209
2209
|
|
|
2210
2210
|
async function generateCloneCommands({ reporter, config, github, org, ...opt }) {
|
|
2211
2211
|
if (!opt.listGroups && !opt.all && opt.group === undefined) {
|
|
2212
|
-
yargs(hideBin(
|
|
2212
|
+
yargs(hideBin(process__default.argv)).showHelp();
|
|
2213
2213
|
return;
|
|
2214
2214
|
}
|
|
2215
2215
|
const repos = await github.getOrgRepoList({ org });
|
|
@@ -2233,7 +2233,7 @@ async function generateCloneCommands({ reporter, config, github, org, ...opt })
|
|
|
2233
2233
|
.forEach((repo) => {
|
|
2234
2234
|
// The output of this is used to pipe into e.g. bash.
|
|
2235
2235
|
// We cannot use reporter.log as it adds additional characters.
|
|
2236
|
-
|
|
2236
|
+
process__default.stdout.write(sprintf('[ ! -e "%s" ] && git clone %s\n', repo.name, repo.sshUrl));
|
|
2237
2237
|
});
|
|
2238
2238
|
});
|
|
2239
2239
|
}
|
|
@@ -2377,7 +2377,7 @@ async function listRepos({ reporter, github, includeArchived, name = undefined,
|
|
|
2377
2377
|
}
|
|
2378
2378
|
// All CSV output is done using direct stdout to avoid extra chars.
|
|
2379
2379
|
if (csv) {
|
|
2380
|
-
|
|
2380
|
+
process__default.stdout.write("reponame,group\n");
|
|
2381
2381
|
}
|
|
2382
2382
|
getGroupedRepos(repos).forEach((group) => {
|
|
2383
2383
|
if (!csv && compact) {
|
|
@@ -2390,7 +2390,7 @@ async function listRepos({ reporter, github, includeArchived, name = undefined,
|
|
|
2390
2390
|
group.items.forEach((repo) => {
|
|
2391
2391
|
if (csv) {
|
|
2392
2392
|
// We assume we have no repos or group names with a comma in its name.
|
|
2393
|
-
|
|
2393
|
+
process__default.stdout.write(`${repo.name},${group.name}\n`);
|
|
2394
2394
|
return;
|
|
2395
2395
|
}
|
|
2396
2396
|
if (compact) {
|
|
@@ -2954,7 +2954,7 @@ async function sync$1({ reporter, github, cals, rootdir, askClone, askMove, }) {
|
|
|
2954
2954
|
for (const it of archivedRepos) {
|
|
2955
2955
|
reporter.info(` ${it.actualRelpath}`);
|
|
2956
2956
|
}
|
|
2957
|
-
const thisDirName = path.basename(
|
|
2957
|
+
const thisDirName = path.basename(process__default.cwd());
|
|
2958
2958
|
const archiveDir = `../${thisDirName}-archive`;
|
|
2959
2959
|
const hasArchiveDir = fs.existsSync(archiveDir);
|
|
2960
2960
|
if (hasArchiveDir) {
|
|
@@ -3036,7 +3036,7 @@ async function loadCalsManifest(config, reporter) {
|
|
|
3036
3036
|
const p = await findUp(CALS_YAML, { cwd: config.cwd });
|
|
3037
3037
|
if (p === undefined) {
|
|
3038
3038
|
reporter.error(`File ${CALS_YAML} not found. See help`);
|
|
3039
|
-
|
|
3039
|
+
process__default.exitCode = 1;
|
|
3040
3040
|
return null;
|
|
3041
3041
|
}
|
|
3042
3042
|
// TODO: Verify file has expected contents.
|
|
@@ -3153,7 +3153,7 @@ Notes:
|
|
|
3153
3153
|
option to avoid stale cache. The cache can also be cleared with
|
|
3154
3154
|
the "cals delete-cache" command.`),
|
|
3155
3155
|
handler: () => {
|
|
3156
|
-
yargs(hideBin(
|
|
3156
|
+
yargs(hideBin(process__default.argv)).showHelp();
|
|
3157
3157
|
},
|
|
3158
3158
|
};
|
|
3159
3159
|
|
|
@@ -3299,17 +3299,17 @@ Notes:
|
|
|
3299
3299
|
and provide a link to generate one:
|
|
3300
3300
|
$ cals snyk set-token`),
|
|
3301
3301
|
handler: () => {
|
|
3302
|
-
yargs(hideBin(
|
|
3302
|
+
yargs(hideBin(process__default.argv)).showHelp();
|
|
3303
3303
|
},
|
|
3304
3304
|
};
|
|
3305
3305
|
|
|
3306
3306
|
async function main() {
|
|
3307
|
-
if (!semver.satisfies(
|
|
3308
|
-
console.error(`Required node version ${engines.node} not satisfied with current version ${
|
|
3309
|
-
|
|
3307
|
+
if (!semver.satisfies(process__default.version, engines.node)) {
|
|
3308
|
+
console.error(`Required node version ${engines.node} not satisfied with current version ${process__default.version}.`);
|
|
3309
|
+
process__default.exit(1);
|
|
3310
3310
|
}
|
|
3311
|
-
await yargs(hideBin(
|
|
3312
|
-
.usage(`cals-cli v${version} (build: ${"2026-01-
|
|
3311
|
+
await yargs(hideBin(process__default.argv))
|
|
3312
|
+
.usage(`cals-cli v${version} (build: ${"2026-01-22T15:26:47+0000"})`)
|
|
3313
3313
|
.scriptName("cals")
|
|
3314
3314
|
.locale("en")
|
|
3315
3315
|
.help("help")
|
package/lib/index.d.ts
CHANGED
|
@@ -8,6 +8,5 @@ export declare const VERSION: string;
|
|
|
8
8
|
export * as definition from "./definition";
|
|
9
9
|
export * as github from "./github";
|
|
10
10
|
export * as snyk from "./snyk";
|
|
11
|
-
export * as sonarCloud from "./sonarcloud";
|
|
12
11
|
export * from "./testing";
|
|
13
12
|
export { CacheProvider, Config, createGitHubService, createReporter, DefinitionFile, GitHubService, Reporter, };
|
package/lib/index.es.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import fs from 'node:fs';
|
|
2
2
|
import path from 'node:path';
|
|
3
|
-
import process
|
|
3
|
+
import * as process from 'node:process';
|
|
4
|
+
import process__default from 'node:process';
|
|
4
5
|
import readline from 'node:readline';
|
|
5
6
|
import chalk from 'chalk';
|
|
6
7
|
import 'node:util';
|
|
@@ -14,14 +15,13 @@ import { performance } from 'node:perf_hooks';
|
|
|
14
15
|
import { Octokit } from '@octokit/rest';
|
|
15
16
|
import fetch from 'node-fetch';
|
|
16
17
|
import pLimit from 'p-limit';
|
|
17
|
-
import * as process from 'process';
|
|
18
18
|
import keytar from 'keytar';
|
|
19
19
|
import { strict } from 'node:assert';
|
|
20
20
|
import { Transform } from 'node:stream';
|
|
21
21
|
import { execa } from 'execa';
|
|
22
22
|
import { read } from 'read';
|
|
23
23
|
|
|
24
|
-
var version = "3.13.
|
|
24
|
+
var version = "3.13.1";
|
|
25
25
|
|
|
26
26
|
class CacheProvider {
|
|
27
27
|
constructor(config) {
|
|
@@ -86,8 +86,8 @@ class Reporter {
|
|
|
86
86
|
this.nonInteractive = !!opts.nonInteractive;
|
|
87
87
|
this.isVerbose = !!opts.verbose;
|
|
88
88
|
}
|
|
89
|
-
stdout =
|
|
90
|
-
stderr =
|
|
89
|
+
stdout = process__default.stdout;
|
|
90
|
+
stderr = process__default.stderr;
|
|
91
91
|
nonInteractive;
|
|
92
92
|
isVerbose;
|
|
93
93
|
format = chalk;
|
|
@@ -110,7 +110,7 @@ class Reporter {
|
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
class Config {
|
|
113
|
-
cwd = path.resolve(
|
|
113
|
+
cwd = path.resolve(process__default.cwd());
|
|
114
114
|
configFile = path.join(os.homedir(), ".cals-config.json");
|
|
115
115
|
cacheDir = cachedir("cals-cli");
|
|
116
116
|
agent = new https.Agent({
|
|
@@ -571,7 +571,7 @@ function getGitHubOrgs(definition) {
|
|
|
571
571
|
return uniq(githubOrganizations);
|
|
572
572
|
}
|
|
573
573
|
|
|
574
|
-
var index$
|
|
574
|
+
var index$2 = /*#__PURE__*/Object.freeze({
|
|
575
575
|
__proto__: null,
|
|
576
576
|
DefinitionFile: DefinitionFile,
|
|
577
577
|
getGitHubOrgs: getGitHubOrgs,
|
|
@@ -591,12 +591,12 @@ class GitHubTokenCliProvider {
|
|
|
591
591
|
keyringService = "cals";
|
|
592
592
|
keyringAccount = "github-token";
|
|
593
593
|
async getToken() {
|
|
594
|
-
if (
|
|
595
|
-
return
|
|
594
|
+
if (process__default.env.CALS_GITHUB_TOKEN) {
|
|
595
|
+
return process__default.env.CALS_GITHUB_TOKEN;
|
|
596
596
|
}
|
|
597
597
|
const result = await keytar.getPassword(this.keyringService, this.keyringAccount);
|
|
598
598
|
if (result == null) {
|
|
599
|
-
|
|
599
|
+
process__default.stderr.write("No token found. Register using `cals github set-token`\n");
|
|
600
600
|
return undefined;
|
|
601
601
|
}
|
|
602
602
|
return result;
|
|
@@ -1113,7 +1113,7 @@ async function createGitHubService(props) {
|
|
|
1113
1113
|
});
|
|
1114
1114
|
}
|
|
1115
1115
|
|
|
1116
|
-
var index$
|
|
1116
|
+
var index$1 = /*#__PURE__*/Object.freeze({
|
|
1117
1117
|
__proto__: null,
|
|
1118
1118
|
GitHubService: GitHubService,
|
|
1119
1119
|
createGitHubService: createGitHubService
|
|
@@ -1123,12 +1123,12 @@ class SnykTokenCliProvider {
|
|
|
1123
1123
|
keyringService = "cals";
|
|
1124
1124
|
keyringAccount = "snyk-token";
|
|
1125
1125
|
async getToken() {
|
|
1126
|
-
if (
|
|
1127
|
-
return
|
|
1126
|
+
if (process__default.env.CALS_SNYK_TOKEN) {
|
|
1127
|
+
return process__default.env.CALS_SNYK_TOKEN;
|
|
1128
1128
|
}
|
|
1129
1129
|
const result = await keytar.getPassword(this.keyringService, this.keyringAccount);
|
|
1130
1130
|
if (result == null) {
|
|
1131
|
-
|
|
1131
|
+
process__default.stderr.write("No token found. Register using `cals snyk set-token`\n");
|
|
1132
1132
|
return undefined;
|
|
1133
1133
|
}
|
|
1134
1134
|
return result;
|
|
@@ -1186,7 +1186,7 @@ class SnykService {
|
|
|
1186
1186
|
agent: this.config.agent,
|
|
1187
1187
|
});
|
|
1188
1188
|
if (response.status === 401) {
|
|
1189
|
-
|
|
1189
|
+
process__default.stderr.write("Unauthorized - removing token\n");
|
|
1190
1190
|
await this.tokenProvider.markInvalid();
|
|
1191
1191
|
}
|
|
1192
1192
|
if (!response.ok) {
|
|
@@ -1261,7 +1261,7 @@ function getGitHubRepoId(repo) {
|
|
|
1261
1261
|
return repo ? `${repo.owner}/${repo.name}` : undefined;
|
|
1262
1262
|
}
|
|
1263
1263
|
|
|
1264
|
-
var index
|
|
1264
|
+
var index = /*#__PURE__*/Object.freeze({
|
|
1265
1265
|
__proto__: null,
|
|
1266
1266
|
SnykService: SnykService,
|
|
1267
1267
|
createSnykService: createSnykService,
|
|
@@ -1269,71 +1269,6 @@ var index$1 = /*#__PURE__*/Object.freeze({
|
|
|
1269
1269
|
getGitHubRepoId: getGitHubRepoId
|
|
1270
1270
|
});
|
|
1271
1271
|
|
|
1272
|
-
class SonarCloudTokenCliProvider {
|
|
1273
|
-
async getToken() {
|
|
1274
|
-
if (process$1.env.CALS_SONARCLOUD_TOKEN) {
|
|
1275
|
-
return Promise.resolve(process$1.env.CALS_SONARCLOUD_TOKEN);
|
|
1276
|
-
}
|
|
1277
|
-
process$1.stderr.write("No environmental variable found. Set variable `CALS_SONARCLOUD_TOKEN` to token value\n");
|
|
1278
|
-
return undefined;
|
|
1279
|
-
}
|
|
1280
|
-
async markInvalid() {
|
|
1281
|
-
await Promise.resolve();
|
|
1282
|
-
}
|
|
1283
|
-
}
|
|
1284
|
-
|
|
1285
|
-
class SonarCloudService {
|
|
1286
|
-
config;
|
|
1287
|
-
tokenProvider;
|
|
1288
|
-
constructor(props) {
|
|
1289
|
-
this.config = props.config;
|
|
1290
|
-
this.tokenProvider = props.tokenProvider;
|
|
1291
|
-
}
|
|
1292
|
-
/**
|
|
1293
|
-
* Returns metrics for project with given key.
|
|
1294
|
-
* ONLY test coverage metrics are returned as of now
|
|
1295
|
-
*/
|
|
1296
|
-
async getMetricsByProjectKey(sonarCloudProjectKey) {
|
|
1297
|
-
const token = await this.tokenProvider.getToken();
|
|
1298
|
-
if (token === undefined) {
|
|
1299
|
-
throw new Error("Missing token for SonarCloud");
|
|
1300
|
-
}
|
|
1301
|
-
const response = await fetch(`https://sonarcloud.io/api/measures/component?component=${encodeURIComponent(sonarCloudProjectKey)}&metricKeys=coverage`, {
|
|
1302
|
-
method: "GET",
|
|
1303
|
-
headers: {
|
|
1304
|
-
Accept: "application/json",
|
|
1305
|
-
Authorization: `Basic ${Buffer.from(token.concat(":"), "utf8").toString("base64")}`,
|
|
1306
|
-
},
|
|
1307
|
-
agent: this.config.agent,
|
|
1308
|
-
});
|
|
1309
|
-
if (response.status === 401) {
|
|
1310
|
-
process$1.stderr.write("Unauthorized - removing token\n");
|
|
1311
|
-
await this.tokenProvider.markInvalid();
|
|
1312
|
-
}
|
|
1313
|
-
if (response.status === 404) {
|
|
1314
|
-
process$1.stderr.write(`Project ${sonarCloudProjectKey} does not exist in SonarCloud\n`);
|
|
1315
|
-
return undefined;
|
|
1316
|
-
}
|
|
1317
|
-
if (!response.ok) {
|
|
1318
|
-
throw new Error(`Response from SonarCloud not OK (${response.status}): ${await response.text()}`);
|
|
1319
|
-
}
|
|
1320
|
-
return (await response.json());
|
|
1321
|
-
}
|
|
1322
|
-
}
|
|
1323
|
-
function createSonarCloudService(props) {
|
|
1324
|
-
return new SonarCloudService({
|
|
1325
|
-
config: props.config,
|
|
1326
|
-
tokenProvider: props.tokenProvider ?? new SonarCloudTokenCliProvider(),
|
|
1327
|
-
});
|
|
1328
|
-
}
|
|
1329
|
-
|
|
1330
|
-
var index = /*#__PURE__*/Object.freeze({
|
|
1331
|
-
__proto__: null,
|
|
1332
|
-
SonarCloudService: SonarCloudService,
|
|
1333
|
-
SonarCloudTokenCliProvider: SonarCloudTokenCliProvider,
|
|
1334
|
-
createSonarCloudService: createSonarCloudService
|
|
1335
|
-
});
|
|
1336
|
-
|
|
1337
1272
|
class TestExecutor {
|
|
1338
1273
|
shutdown = false;
|
|
1339
1274
|
cleanupTask = null;
|
|
@@ -1394,21 +1329,21 @@ class TestExecutor {
|
|
|
1394
1329
|
// This will not abort the running tasks until after
|
|
1395
1330
|
// we have completed the cleanup tasks. The running tasks
|
|
1396
1331
|
// can stop earlier by calling checkCanContinue.
|
|
1397
|
-
|
|
1332
|
+
process__default.on("SIGINT", () => {
|
|
1398
1333
|
console.warn("Caught interrupt signal - forcing termination");
|
|
1399
1334
|
if (this.cleanupTask != null) {
|
|
1400
1335
|
return;
|
|
1401
1336
|
}
|
|
1402
1337
|
this.shutdown = true;
|
|
1403
1338
|
this.cleanupTask = this.runTasks().then(() => {
|
|
1404
|
-
|
|
1339
|
+
process__default.exit(1);
|
|
1405
1340
|
});
|
|
1406
1341
|
});
|
|
1407
1342
|
await body(this);
|
|
1408
1343
|
}
|
|
1409
1344
|
catch (error) {
|
|
1410
1345
|
console.error(error.stack || error.message || error);
|
|
1411
|
-
|
|
1346
|
+
process__default.exitCode = 1;
|
|
1412
1347
|
}
|
|
1413
1348
|
finally {
|
|
1414
1349
|
console.log("Reached finally block");
|
|
@@ -1601,14 +1536,14 @@ class OutputPrefixTransform extends Transform {
|
|
|
1601
1536
|
function pipeToConsole(result, name) {
|
|
1602
1537
|
result.stdout
|
|
1603
1538
|
?.pipe(new OutputPrefixTransform(`${name}: `))
|
|
1604
|
-
.pipe(
|
|
1539
|
+
.pipe(process__default.stdout);
|
|
1605
1540
|
result.stderr
|
|
1606
1541
|
?.pipe(new OutputPrefixTransform(`${name} (stderr): `))
|
|
1607
|
-
.pipe(
|
|
1542
|
+
.pipe(process__default.stderr);
|
|
1608
1543
|
}
|
|
1609
1544
|
function checkPidRunning(pid) {
|
|
1610
1545
|
try {
|
|
1611
|
-
|
|
1546
|
+
process__default.kill(pid, 0);
|
|
1612
1547
|
return true;
|
|
1613
1548
|
}
|
|
1614
1549
|
catch {
|
|
@@ -1750,7 +1685,7 @@ async function runNpmRunScript(name, options) {
|
|
|
1750
1685
|
* This likely does not cover all situations.
|
|
1751
1686
|
*/
|
|
1752
1687
|
async function getDockerHostAddress() {
|
|
1753
|
-
if (
|
|
1688
|
+
if (process__default.platform === "darwin" || process__default.platform === "win32") {
|
|
1754
1689
|
return "host.docker.internal";
|
|
1755
1690
|
}
|
|
1756
1691
|
if (fs.existsSync("/.dockerenv")) {
|
|
@@ -1778,5 +1713,5 @@ async function waitForEnterToContinue(prompt = "Press enter to continue") {
|
|
|
1778
1713
|
|
|
1779
1714
|
const VERSION = version;
|
|
1780
1715
|
|
|
1781
|
-
export { CacheProvider, Config, DefinitionFile, GitHubService, Reporter, TestExecutor, VERSION, createGitHubService, createNetwork, createReporter, createTestExecutor, curl, index$
|
|
1716
|
+
export { CacheProvider, Config, DefinitionFile, GitHubService, Reporter, TestExecutor, VERSION, createGitHubService, createNetwork, createReporter, createTestExecutor, curl, index$2 as definition, getDockerHostAddress, index$1 as github, pollForCondition, runNpmRunScript, index as snyk, startContainer, waitForEnterToContinue, waitForHttpOk, waitForPostgresAvailable };
|
|
1782
1717
|
//# sourceMappingURL=index.es.js.map
|
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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/lib/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import fs from 'node:fs';
|
|
2
2
|
import path from 'node:path';
|
|
3
|
-
import process
|
|
3
|
+
import * as process from 'node:process';
|
|
4
|
+
import process__default from 'node:process';
|
|
4
5
|
import readline from 'node:readline';
|
|
5
6
|
import chalk from 'chalk';
|
|
6
7
|
import 'node:util';
|
|
@@ -14,14 +15,13 @@ import { performance } from 'node:perf_hooks';
|
|
|
14
15
|
import { Octokit } from '@octokit/rest';
|
|
15
16
|
import fetch from 'node-fetch';
|
|
16
17
|
import pLimit from 'p-limit';
|
|
17
|
-
import * as process from 'process';
|
|
18
18
|
import keytar from 'keytar';
|
|
19
19
|
import { strict } from 'node:assert';
|
|
20
20
|
import { Transform } from 'node:stream';
|
|
21
21
|
import { execa } from 'execa';
|
|
22
22
|
import { read } from 'read';
|
|
23
23
|
|
|
24
|
-
var version = "3.13.
|
|
24
|
+
var version = "3.13.1";
|
|
25
25
|
|
|
26
26
|
class CacheProvider {
|
|
27
27
|
constructor(config) {
|
|
@@ -86,8 +86,8 @@ class Reporter {
|
|
|
86
86
|
this.nonInteractive = !!opts.nonInteractive;
|
|
87
87
|
this.isVerbose = !!opts.verbose;
|
|
88
88
|
}
|
|
89
|
-
stdout =
|
|
90
|
-
stderr =
|
|
89
|
+
stdout = process__default.stdout;
|
|
90
|
+
stderr = process__default.stderr;
|
|
91
91
|
nonInteractive;
|
|
92
92
|
isVerbose;
|
|
93
93
|
format = chalk;
|
|
@@ -110,7 +110,7 @@ class Reporter {
|
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
class Config {
|
|
113
|
-
cwd = path.resolve(
|
|
113
|
+
cwd = path.resolve(process__default.cwd());
|
|
114
114
|
configFile = path.join(os.homedir(), ".cals-config.json");
|
|
115
115
|
cacheDir = cachedir("cals-cli");
|
|
116
116
|
agent = new https.Agent({
|
|
@@ -571,7 +571,7 @@ function getGitHubOrgs(definition) {
|
|
|
571
571
|
return uniq(githubOrganizations);
|
|
572
572
|
}
|
|
573
573
|
|
|
574
|
-
var index$
|
|
574
|
+
var index$2 = /*#__PURE__*/Object.freeze({
|
|
575
575
|
__proto__: null,
|
|
576
576
|
DefinitionFile: DefinitionFile,
|
|
577
577
|
getGitHubOrgs: getGitHubOrgs,
|
|
@@ -591,12 +591,12 @@ class GitHubTokenCliProvider {
|
|
|
591
591
|
keyringService = "cals";
|
|
592
592
|
keyringAccount = "github-token";
|
|
593
593
|
async getToken() {
|
|
594
|
-
if (
|
|
595
|
-
return
|
|
594
|
+
if (process__default.env.CALS_GITHUB_TOKEN) {
|
|
595
|
+
return process__default.env.CALS_GITHUB_TOKEN;
|
|
596
596
|
}
|
|
597
597
|
const result = await keytar.getPassword(this.keyringService, this.keyringAccount);
|
|
598
598
|
if (result == null) {
|
|
599
|
-
|
|
599
|
+
process__default.stderr.write("No token found. Register using `cals github set-token`\n");
|
|
600
600
|
return undefined;
|
|
601
601
|
}
|
|
602
602
|
return result;
|
|
@@ -1113,7 +1113,7 @@ async function createGitHubService(props) {
|
|
|
1113
1113
|
});
|
|
1114
1114
|
}
|
|
1115
1115
|
|
|
1116
|
-
var index$
|
|
1116
|
+
var index$1 = /*#__PURE__*/Object.freeze({
|
|
1117
1117
|
__proto__: null,
|
|
1118
1118
|
GitHubService: GitHubService,
|
|
1119
1119
|
createGitHubService: createGitHubService
|
|
@@ -1123,12 +1123,12 @@ class SnykTokenCliProvider {
|
|
|
1123
1123
|
keyringService = "cals";
|
|
1124
1124
|
keyringAccount = "snyk-token";
|
|
1125
1125
|
async getToken() {
|
|
1126
|
-
if (
|
|
1127
|
-
return
|
|
1126
|
+
if (process__default.env.CALS_SNYK_TOKEN) {
|
|
1127
|
+
return process__default.env.CALS_SNYK_TOKEN;
|
|
1128
1128
|
}
|
|
1129
1129
|
const result = await keytar.getPassword(this.keyringService, this.keyringAccount);
|
|
1130
1130
|
if (result == null) {
|
|
1131
|
-
|
|
1131
|
+
process__default.stderr.write("No token found. Register using `cals snyk set-token`\n");
|
|
1132
1132
|
return undefined;
|
|
1133
1133
|
}
|
|
1134
1134
|
return result;
|
|
@@ -1186,7 +1186,7 @@ class SnykService {
|
|
|
1186
1186
|
agent: this.config.agent,
|
|
1187
1187
|
});
|
|
1188
1188
|
if (response.status === 401) {
|
|
1189
|
-
|
|
1189
|
+
process__default.stderr.write("Unauthorized - removing token\n");
|
|
1190
1190
|
await this.tokenProvider.markInvalid();
|
|
1191
1191
|
}
|
|
1192
1192
|
if (!response.ok) {
|
|
@@ -1261,7 +1261,7 @@ function getGitHubRepoId(repo) {
|
|
|
1261
1261
|
return repo ? `${repo.owner}/${repo.name}` : undefined;
|
|
1262
1262
|
}
|
|
1263
1263
|
|
|
1264
|
-
var index
|
|
1264
|
+
var index = /*#__PURE__*/Object.freeze({
|
|
1265
1265
|
__proto__: null,
|
|
1266
1266
|
SnykService: SnykService,
|
|
1267
1267
|
createSnykService: createSnykService,
|
|
@@ -1269,71 +1269,6 @@ var index$1 = /*#__PURE__*/Object.freeze({
|
|
|
1269
1269
|
getGitHubRepoId: getGitHubRepoId
|
|
1270
1270
|
});
|
|
1271
1271
|
|
|
1272
|
-
class SonarCloudTokenCliProvider {
|
|
1273
|
-
async getToken() {
|
|
1274
|
-
if (process$1.env.CALS_SONARCLOUD_TOKEN) {
|
|
1275
|
-
return Promise.resolve(process$1.env.CALS_SONARCLOUD_TOKEN);
|
|
1276
|
-
}
|
|
1277
|
-
process$1.stderr.write("No environmental variable found. Set variable `CALS_SONARCLOUD_TOKEN` to token value\n");
|
|
1278
|
-
return undefined;
|
|
1279
|
-
}
|
|
1280
|
-
async markInvalid() {
|
|
1281
|
-
await Promise.resolve();
|
|
1282
|
-
}
|
|
1283
|
-
}
|
|
1284
|
-
|
|
1285
|
-
class SonarCloudService {
|
|
1286
|
-
config;
|
|
1287
|
-
tokenProvider;
|
|
1288
|
-
constructor(props) {
|
|
1289
|
-
this.config = props.config;
|
|
1290
|
-
this.tokenProvider = props.tokenProvider;
|
|
1291
|
-
}
|
|
1292
|
-
/**
|
|
1293
|
-
* Returns metrics for project with given key.
|
|
1294
|
-
* ONLY test coverage metrics are returned as of now
|
|
1295
|
-
*/
|
|
1296
|
-
async getMetricsByProjectKey(sonarCloudProjectKey) {
|
|
1297
|
-
const token = await this.tokenProvider.getToken();
|
|
1298
|
-
if (token === undefined) {
|
|
1299
|
-
throw new Error("Missing token for SonarCloud");
|
|
1300
|
-
}
|
|
1301
|
-
const response = await fetch(`https://sonarcloud.io/api/measures/component?component=${encodeURIComponent(sonarCloudProjectKey)}&metricKeys=coverage`, {
|
|
1302
|
-
method: "GET",
|
|
1303
|
-
headers: {
|
|
1304
|
-
Accept: "application/json",
|
|
1305
|
-
Authorization: `Basic ${Buffer.from(token.concat(":"), "utf8").toString("base64")}`,
|
|
1306
|
-
},
|
|
1307
|
-
agent: this.config.agent,
|
|
1308
|
-
});
|
|
1309
|
-
if (response.status === 401) {
|
|
1310
|
-
process$1.stderr.write("Unauthorized - removing token\n");
|
|
1311
|
-
await this.tokenProvider.markInvalid();
|
|
1312
|
-
}
|
|
1313
|
-
if (response.status === 404) {
|
|
1314
|
-
process$1.stderr.write(`Project ${sonarCloudProjectKey} does not exist in SonarCloud\n`);
|
|
1315
|
-
return undefined;
|
|
1316
|
-
}
|
|
1317
|
-
if (!response.ok) {
|
|
1318
|
-
throw new Error(`Response from SonarCloud not OK (${response.status}): ${await response.text()}`);
|
|
1319
|
-
}
|
|
1320
|
-
return (await response.json());
|
|
1321
|
-
}
|
|
1322
|
-
}
|
|
1323
|
-
function createSonarCloudService(props) {
|
|
1324
|
-
return new SonarCloudService({
|
|
1325
|
-
config: props.config,
|
|
1326
|
-
tokenProvider: props.tokenProvider ?? new SonarCloudTokenCliProvider(),
|
|
1327
|
-
});
|
|
1328
|
-
}
|
|
1329
|
-
|
|
1330
|
-
var index = /*#__PURE__*/Object.freeze({
|
|
1331
|
-
__proto__: null,
|
|
1332
|
-
SonarCloudService: SonarCloudService,
|
|
1333
|
-
SonarCloudTokenCliProvider: SonarCloudTokenCliProvider,
|
|
1334
|
-
createSonarCloudService: createSonarCloudService
|
|
1335
|
-
});
|
|
1336
|
-
|
|
1337
1272
|
class TestExecutor {
|
|
1338
1273
|
shutdown = false;
|
|
1339
1274
|
cleanupTask = null;
|
|
@@ -1394,21 +1329,21 @@ class TestExecutor {
|
|
|
1394
1329
|
// This will not abort the running tasks until after
|
|
1395
1330
|
// we have completed the cleanup tasks. The running tasks
|
|
1396
1331
|
// can stop earlier by calling checkCanContinue.
|
|
1397
|
-
|
|
1332
|
+
process__default.on("SIGINT", () => {
|
|
1398
1333
|
console.warn("Caught interrupt signal - forcing termination");
|
|
1399
1334
|
if (this.cleanupTask != null) {
|
|
1400
1335
|
return;
|
|
1401
1336
|
}
|
|
1402
1337
|
this.shutdown = true;
|
|
1403
1338
|
this.cleanupTask = this.runTasks().then(() => {
|
|
1404
|
-
|
|
1339
|
+
process__default.exit(1);
|
|
1405
1340
|
});
|
|
1406
1341
|
});
|
|
1407
1342
|
await body(this);
|
|
1408
1343
|
}
|
|
1409
1344
|
catch (error) {
|
|
1410
1345
|
console.error(error.stack || error.message || error);
|
|
1411
|
-
|
|
1346
|
+
process__default.exitCode = 1;
|
|
1412
1347
|
}
|
|
1413
1348
|
finally {
|
|
1414
1349
|
console.log("Reached finally block");
|
|
@@ -1601,14 +1536,14 @@ class OutputPrefixTransform extends Transform {
|
|
|
1601
1536
|
function pipeToConsole(result, name) {
|
|
1602
1537
|
result.stdout
|
|
1603
1538
|
?.pipe(new OutputPrefixTransform(`${name}: `))
|
|
1604
|
-
.pipe(
|
|
1539
|
+
.pipe(process__default.stdout);
|
|
1605
1540
|
result.stderr
|
|
1606
1541
|
?.pipe(new OutputPrefixTransform(`${name} (stderr): `))
|
|
1607
|
-
.pipe(
|
|
1542
|
+
.pipe(process__default.stderr);
|
|
1608
1543
|
}
|
|
1609
1544
|
function checkPidRunning(pid) {
|
|
1610
1545
|
try {
|
|
1611
|
-
|
|
1546
|
+
process__default.kill(pid, 0);
|
|
1612
1547
|
return true;
|
|
1613
1548
|
}
|
|
1614
1549
|
catch {
|
|
@@ -1750,7 +1685,7 @@ async function runNpmRunScript(name, options) {
|
|
|
1750
1685
|
* This likely does not cover all situations.
|
|
1751
1686
|
*/
|
|
1752
1687
|
async function getDockerHostAddress() {
|
|
1753
|
-
if (
|
|
1688
|
+
if (process__default.platform === "darwin" || process__default.platform === "win32") {
|
|
1754
1689
|
return "host.docker.internal";
|
|
1755
1690
|
}
|
|
1756
1691
|
if (fs.existsSync("/.dockerenv")) {
|
|
@@ -1778,5 +1713,5 @@ async function waitForEnterToContinue(prompt = "Press enter to continue") {
|
|
|
1778
1713
|
|
|
1779
1714
|
const VERSION = version;
|
|
1780
1715
|
|
|
1781
|
-
export { CacheProvider, Config, DefinitionFile, GitHubService, Reporter, TestExecutor, VERSION, createGitHubService, createNetwork, createReporter, createTestExecutor, curl, index$
|
|
1716
|
+
export { CacheProvider, Config, DefinitionFile, GitHubService, Reporter, TestExecutor, VERSION, createGitHubService, createNetwork, createReporter, createTestExecutor, curl, index$2 as definition, getDockerHostAddress, index$1 as github, pollForCondition, runNpmRunScript, index as snyk, startContainer, waitForEnterToContinue, waitForHttpOk, waitForPostgresAvailable };
|
|
1782
1717
|
//# sourceMappingURL=index.js.map
|
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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capraconsulting/cals-cli",
|
|
3
|
-
"version": "3.13.
|
|
3
|
+
"version": "3.13.1",
|
|
4
4
|
"description": "CLI for repeatable tasks in CALS",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
"lint": "biome check",
|
|
13
13
|
"lint:fix": "biome check --fix",
|
|
14
14
|
"format": "biome format --write",
|
|
15
|
+
"format:check": "biome format",
|
|
15
16
|
"prepack": "./scripts/build-and-verify.sh",
|
|
16
17
|
"semantic-release": "semantic-release",
|
|
17
18
|
"watch": "rollup -c -w",
|
|
@@ -25,18 +26,16 @@
|
|
|
25
26
|
},
|
|
26
27
|
"dependencies": {
|
|
27
28
|
"@octokit/rest": "^22.0.1",
|
|
28
|
-
"@types/dateformat": "5.0.3",
|
|
29
29
|
"ajv": "^8.17.1",
|
|
30
30
|
"cachedir": "^2.4.0",
|
|
31
31
|
"chalk": "5.6.2",
|
|
32
|
-
"execa": "^9.6.
|
|
32
|
+
"execa": "^9.6.1",
|
|
33
33
|
"find-up": "^8.0.0",
|
|
34
34
|
"js-yaml": "^4.1.1",
|
|
35
35
|
"keytar": "^7.9.0",
|
|
36
36
|
"node-fetch": "^3.3.2",
|
|
37
37
|
"p-limit": "^7.2.0",
|
|
38
38
|
"p-map": "^7.0.4",
|
|
39
|
-
"process": "0.11.10",
|
|
40
39
|
"read": "^5.0.1",
|
|
41
40
|
"semver": "^7.7.3",
|
|
42
41
|
"sprintf-js": "^1.1.3",
|
|
@@ -50,25 +49,25 @@
|
|
|
50
49
|
"@rollup/plugin-alias": "6.0.0",
|
|
51
50
|
"@rollup/plugin-json": "6.1.0",
|
|
52
51
|
"@rollup/plugin-replace": "6.0.3",
|
|
52
|
+
"@types/dateformat": "5.0.3",
|
|
53
53
|
"@types/js-yaml": "4.0.9",
|
|
54
54
|
"@types/lodash-es": "4.17.12",
|
|
55
|
-
"@types/node": "24.10.
|
|
55
|
+
"@types/node": "24.10.9",
|
|
56
56
|
"@types/node-fetch": "2.6.13",
|
|
57
57
|
"@types/semver": "7.7.1",
|
|
58
58
|
"@types/sprintf-js": "1.1.4",
|
|
59
59
|
"@types/yargs": "17.0.35",
|
|
60
|
-
"@vitest/coverage-v8": "4.0.
|
|
61
|
-
"@vitest/ui": "4.0.16",
|
|
60
|
+
"@vitest/coverage-v8": "4.0.17",
|
|
62
61
|
"dateformat": "5.0.3",
|
|
63
62
|
"husky": "9.1.7",
|
|
64
63
|
"npm-check-updates": "19.3.1",
|
|
65
|
-
"rollup": "4.
|
|
64
|
+
"rollup": "4.56.0",
|
|
66
65
|
"rollup-plugin-typescript2": "0.36.0",
|
|
67
66
|
"semantic-release": "25.0.2",
|
|
68
67
|
"tsx": "4.21.0",
|
|
69
68
|
"typescript": "5.9.3",
|
|
70
69
|
"typescript-json-schema": "0.67.1",
|
|
71
|
-
"vitest": "4.0.
|
|
70
|
+
"vitest": "4.0.17"
|
|
72
71
|
},
|
|
73
72
|
"files": [
|
|
74
73
|
"lib"
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import type { Config } from "../config";
|
|
2
|
-
import { type SonarCloudTokenProvider } from "./token";
|
|
3
|
-
interface SonarCloudServiceProps {
|
|
4
|
-
config: Config;
|
|
5
|
-
tokenProvider: SonarCloudTokenProvider;
|
|
6
|
-
}
|
|
7
|
-
export declare class SonarCloudService {
|
|
8
|
-
private config;
|
|
9
|
-
private tokenProvider;
|
|
10
|
-
constructor(props: SonarCloudServiceProps);
|
|
11
|
-
/**
|
|
12
|
-
* Returns metrics for project with given key.
|
|
13
|
-
* ONLY test coverage metrics are returned as of now
|
|
14
|
-
*/
|
|
15
|
-
getMetricsByProjectKey(sonarCloudProjectKey: string): Promise<{
|
|
16
|
-
component: {
|
|
17
|
-
id: string;
|
|
18
|
-
key: string;
|
|
19
|
-
name: string;
|
|
20
|
-
qualifier: string;
|
|
21
|
-
measures: {
|
|
22
|
-
metric: string;
|
|
23
|
-
value: string;
|
|
24
|
-
}[];
|
|
25
|
-
};
|
|
26
|
-
} | undefined>;
|
|
27
|
-
}
|
|
28
|
-
interface CreateSonarCloudServiceProps {
|
|
29
|
-
config: Config;
|
|
30
|
-
tokenProvider?: SonarCloudTokenProvider;
|
|
31
|
-
}
|
|
32
|
-
export declare function createSonarCloudService(props: CreateSonarCloudServiceProps): SonarCloudService;
|
|
33
|
-
export {};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export interface SonarCloudTokenProvider {
|
|
2
|
-
getToken(): Promise<string | undefined>;
|
|
3
|
-
markInvalid(): Promise<void>;
|
|
4
|
-
}
|
|
5
|
-
export declare class SonarCloudTokenCliProvider implements SonarCloudTokenProvider {
|
|
6
|
-
getToken(): Promise<string | undefined>;
|
|
7
|
-
markInvalid(): Promise<void>;
|
|
8
|
-
}
|