@capraconsulting/cals-cli 3.6.0 → 3.7.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/lib/{cals-cli.js → cals-cli.mjs} +226 -304
- package/lib/{cals-cli.js.map → cals-cli.mjs.map} +1 -1
- package/lib/definition/index.d.ts +1 -1
- package/lib/github/index.d.ts +3 -2
- package/lib/index.es.js +79 -86
- package/lib/index.es.js.map +1 -1
- package/lib/index.js +153 -223
- package/lib/index.js.map +1 -1
- package/lib/snyk/index.d.ts +1 -1
- package/lib/sonarcloud/index.d.ts +2 -1
- package/package.json +15 -11
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cals-cli.
|
|
1
|
+
{"version":3,"file":"cals-cli.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { DefinitionFile, getGitHubOrgs, getRepoId, getRepos, parseDefinition, } from "./definition";
|
|
2
|
-
export { Definition, DefinitionRepo, GetReposResponse, Project, RepoTeam, } from "./types";
|
|
2
|
+
export type { Definition, DefinitionRepo, GetReposResponse, Project, RepoTeam, } from "./types";
|
package/lib/github/index.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export { createGitHubService, GitHubService
|
|
2
|
-
export {
|
|
1
|
+
export { createGitHubService, GitHubService } from "./service";
|
|
2
|
+
export type { SearchedPullRequestListItem } from "./service";
|
|
3
|
+
export type { RenovateDependencyDashboardIssue, VulnerabilityAlert, } from "./types";
|
package/lib/index.es.js
CHANGED
|
@@ -9,7 +9,7 @@ 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';
|
|
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';
|
|
@@ -21,14 +21,15 @@ import execa from 'execa';
|
|
|
21
21
|
import read from 'read';
|
|
22
22
|
import { Transform } from 'stream';
|
|
23
23
|
|
|
24
|
-
var version = "3.
|
|
24
|
+
var version = "3.7.0";
|
|
25
25
|
|
|
26
26
|
class CacheProvider {
|
|
27
27
|
constructor(config) {
|
|
28
|
-
this.mustValidate = false;
|
|
29
|
-
this.defaultCacheTime = 1800;
|
|
30
28
|
this.config = config;
|
|
31
29
|
}
|
|
30
|
+
mustValidate = false;
|
|
31
|
+
config;
|
|
32
|
+
defaultCacheTime = 1800;
|
|
32
33
|
/**
|
|
33
34
|
* Retrieve cache if existent, ignoring the time.
|
|
34
35
|
*
|
|
@@ -82,15 +83,17 @@ function clearLine(stdout) {
|
|
|
82
83
|
}
|
|
83
84
|
class Reporter {
|
|
84
85
|
constructor(opts = {}) {
|
|
85
|
-
this.stdout = process.stdout;
|
|
86
|
-
this.stderr = process.stderr;
|
|
87
|
-
this.stdin = process.stdin;
|
|
88
|
-
this.isTTY = this.stdout.isTTY;
|
|
89
|
-
this.format = chalk;
|
|
90
|
-
this.startTime = Date.now();
|
|
91
86
|
this.nonInteractive = !!opts.nonInteractive;
|
|
92
87
|
this.isVerbose = !!opts.verbose;
|
|
93
88
|
}
|
|
89
|
+
stdout = process.stdout;
|
|
90
|
+
stderr = process.stderr;
|
|
91
|
+
stdin = process.stdin;
|
|
92
|
+
isTTY = this.stdout.isTTY;
|
|
93
|
+
nonInteractive;
|
|
94
|
+
isVerbose;
|
|
95
|
+
format = chalk;
|
|
96
|
+
startTime = Date.now();
|
|
94
97
|
error(msg) {
|
|
95
98
|
clearLine(this.stderr);
|
|
96
99
|
this.stderr.write(`${this.format.red("error")} ${msg}\n`);
|
|
@@ -114,15 +117,13 @@ class Reporter {
|
|
|
114
117
|
}
|
|
115
118
|
|
|
116
119
|
class Config {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
this.configCached = undefined;
|
|
125
|
-
}
|
|
120
|
+
cwd = path.resolve(process.cwd());
|
|
121
|
+
configFile = path.join(os.homedir(), ".cals-config.json");
|
|
122
|
+
cacheDir = cachedir("cals-cli");
|
|
123
|
+
agent = new https.Agent({
|
|
124
|
+
keepAlive: true,
|
|
125
|
+
});
|
|
126
|
+
configCached = undefined;
|
|
126
127
|
get config() {
|
|
127
128
|
const existingConfig = this.configCached;
|
|
128
129
|
if (existingConfig !== undefined) {
|
|
@@ -466,12 +467,11 @@ function getRepoId(orgName, repoName) {
|
|
|
466
467
|
return `${orgName}/${repoName}`;
|
|
467
468
|
}
|
|
468
469
|
function checkAgainstSchema(value) {
|
|
469
|
-
var _a;
|
|
470
470
|
const ajv = new AJV({ allErrors: true });
|
|
471
471
|
const valid = ajv.validate(schema, value);
|
|
472
472
|
return valid
|
|
473
473
|
? { definition: value }
|
|
474
|
-
: { error:
|
|
474
|
+
: { error: ajv.errorsText() ?? "Unknown error" };
|
|
475
475
|
}
|
|
476
476
|
function requireValidDefinition(definition) {
|
|
477
477
|
// Verify no duplicates in users and extract known logins.
|
|
@@ -516,7 +516,8 @@ function requireValidDefinition(definition) {
|
|
|
516
516
|
if (!teamIdList.includes(id)) {
|
|
517
517
|
throw new Error(`Project team ${id} in project ${project.name} is not registered in team list`);
|
|
518
518
|
}
|
|
519
|
-
})
|
|
519
|
+
}) // Verify repo teams exists as teams.
|
|
520
|
+
;
|
|
520
521
|
(org.repos || []).forEach((repo) => {
|
|
521
522
|
(repo.teams || []).forEach((team) => {
|
|
522
523
|
const id = getTeamId(org.organization, team.name);
|
|
@@ -540,6 +541,7 @@ function requireValidDefinition(definition) {
|
|
|
540
541
|
}, []);
|
|
541
542
|
}
|
|
542
543
|
class DefinitionFile {
|
|
544
|
+
path;
|
|
543
545
|
constructor(path) {
|
|
544
546
|
this.path = path;
|
|
545
547
|
}
|
|
@@ -585,10 +587,8 @@ function createReporter(argv) {
|
|
|
585
587
|
}
|
|
586
588
|
|
|
587
589
|
class GitHubTokenCliProvider {
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
this.keyringAccount = "github-token";
|
|
591
|
-
}
|
|
590
|
+
keyringService = "cals";
|
|
591
|
+
keyringAccount = "github-token";
|
|
592
592
|
async getToken() {
|
|
593
593
|
if (process.env.CALS_GITHUB_TOKEN) {
|
|
594
594
|
return process.env.CALS_GITHUB_TOKEN;
|
|
@@ -624,8 +624,12 @@ async function undefinedForNotFound(value) {
|
|
|
624
624
|
}
|
|
625
625
|
|
|
626
626
|
class GitHubService {
|
|
627
|
+
config;
|
|
628
|
+
octokit;
|
|
629
|
+
cache;
|
|
630
|
+
tokenProvider;
|
|
631
|
+
semaphore;
|
|
627
632
|
constructor(props) {
|
|
628
|
-
this._requestCount = 0;
|
|
629
633
|
this.config = props.config;
|
|
630
634
|
this.octokit = props.octokit;
|
|
631
635
|
this.cache = props.cache;
|
|
@@ -698,6 +702,7 @@ class GitHubService {
|
|
|
698
702
|
/* eslint-enable @typescript-eslint/no-unsafe-member-access */
|
|
699
703
|
});
|
|
700
704
|
}
|
|
705
|
+
_requestCount = 0;
|
|
701
706
|
get requestCount() {
|
|
702
707
|
return this._requestCount;
|
|
703
708
|
}
|
|
@@ -816,15 +821,12 @@ class GitHubService {
|
|
|
816
821
|
login: it.login,
|
|
817
822
|
data: it,
|
|
818
823
|
})),
|
|
819
|
-
...(await this.getOrgMembersInvitedList(org)).map((it) => {
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
data: it,
|
|
826
|
-
});
|
|
827
|
-
}),
|
|
824
|
+
...(await this.getOrgMembersInvitedList(org)).map((it) => ({
|
|
825
|
+
type: "invited",
|
|
826
|
+
// TODO: Fix ?? case properly
|
|
827
|
+
login: it.login ?? "invalid",
|
|
828
|
+
data: it,
|
|
829
|
+
})),
|
|
828
830
|
];
|
|
829
831
|
}
|
|
830
832
|
async getRepository(owner, repo) {
|
|
@@ -893,15 +895,12 @@ class GitHubService {
|
|
|
893
895
|
login: it.login,
|
|
894
896
|
data: it,
|
|
895
897
|
})),
|
|
896
|
-
...(await this.getTeamMemberInvitedList(org, team)).map((it) => {
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
data: it,
|
|
903
|
-
});
|
|
904
|
-
}),
|
|
898
|
+
...(await this.getTeamMemberInvitedList(org, team)).map((it) => ({
|
|
899
|
+
type: "invited",
|
|
900
|
+
// TODO: Fix ?? case properly
|
|
901
|
+
login: it.login ?? "invalid",
|
|
902
|
+
data: it,
|
|
903
|
+
})),
|
|
905
904
|
];
|
|
906
905
|
}
|
|
907
906
|
async getSearchedPullRequestList(owner) {
|
|
@@ -1026,17 +1025,16 @@ class GitHubService {
|
|
|
1026
1025
|
}
|
|
1027
1026
|
}`;
|
|
1028
1027
|
return this.cache.json(`vulnerability-alerts-${owner}-${repo}`, async () => {
|
|
1029
|
-
var _a, _b, _c, _d, _e;
|
|
1030
1028
|
const result = [];
|
|
1031
1029
|
let after = null;
|
|
1032
1030
|
while (true) {
|
|
1033
1031
|
const query = getQuery(after);
|
|
1034
1032
|
const res = await this.runGraphqlQuery(query);
|
|
1035
|
-
result.push(...(
|
|
1036
|
-
if (!
|
|
1033
|
+
result.push(...(res.repository?.vulnerabilityAlerts.edges?.map((it) => it.node) ?? []));
|
|
1034
|
+
if (!res.repository?.vulnerabilityAlerts.pageInfo.hasNextPage) {
|
|
1037
1035
|
break;
|
|
1038
1036
|
}
|
|
1039
|
-
after =
|
|
1037
|
+
after = res.repository?.vulnerabilityAlerts.pageInfo.endCursor;
|
|
1040
1038
|
}
|
|
1041
1039
|
return result;
|
|
1042
1040
|
});
|
|
@@ -1078,27 +1076,23 @@ class GitHubService {
|
|
|
1078
1076
|
}
|
|
1079
1077
|
}`;
|
|
1080
1078
|
const issues = await this.cache.json(`renovate-bot-issues-${owner}-${repo}`, async () => {
|
|
1081
|
-
var _a, _b, _c, _d, _e;
|
|
1082
1079
|
const result = [];
|
|
1083
1080
|
let after = null;
|
|
1084
1081
|
while (true) {
|
|
1085
1082
|
const query = getQuery(after);
|
|
1086
1083
|
const res = await this.runGraphqlQuery(query);
|
|
1087
|
-
const nodes =
|
|
1084
|
+
const nodes = res.repository?.issues.edges?.map((it) => it.node) ?? [];
|
|
1088
1085
|
result.push(...nodes
|
|
1089
1086
|
.filter((it) => it.title === "Dependency Dashboard")
|
|
1090
|
-
.map((it) => {
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
});
|
|
1097
|
-
}));
|
|
1098
|
-
if (!((_d = res.repository) === null || _d === void 0 ? void 0 : _d.issues.pageInfo.hasNextPage)) {
|
|
1087
|
+
.map((it) => ({
|
|
1088
|
+
number: it.number,
|
|
1089
|
+
body: it.body,
|
|
1090
|
+
lastUpdatedByRenovate: it.userContentEdits?.nodes?.filter((it) => it.editor?.login === "renovate")?.[0]?.createdAt ?? null,
|
|
1091
|
+
})));
|
|
1092
|
+
if (!res.repository?.issues.pageInfo.hasNextPage) {
|
|
1099
1093
|
break;
|
|
1100
1094
|
}
|
|
1101
|
-
after =
|
|
1095
|
+
after = res.repository?.issues.pageInfo.endCursor;
|
|
1102
1096
|
}
|
|
1103
1097
|
return result;
|
|
1104
1098
|
});
|
|
@@ -1117,8 +1111,7 @@ async function createOctokit(config, tokenProvider) {
|
|
|
1117
1111
|
});
|
|
1118
1112
|
}
|
|
1119
1113
|
async function createGitHubService(props) {
|
|
1120
|
-
|
|
1121
|
-
const tokenProvider = (_a = props.tokenProvider) !== null && _a !== void 0 ? _a : new GitHubTokenCliProvider();
|
|
1114
|
+
const tokenProvider = props.tokenProvider ?? new GitHubTokenCliProvider();
|
|
1122
1115
|
return new GitHubService({
|
|
1123
1116
|
config: props.config,
|
|
1124
1117
|
octokit: await createOctokit(props.config, tokenProvider),
|
|
@@ -1143,10 +1136,8 @@ var index$2 = /*#__PURE__*/Object.freeze({
|
|
|
1143
1136
|
});
|
|
1144
1137
|
|
|
1145
1138
|
class SnykTokenCliProvider {
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
this.keyringAccount = "snyk-token";
|
|
1149
|
-
}
|
|
1139
|
+
keyringService = "cals";
|
|
1140
|
+
keyringAccount = "snyk-token";
|
|
1150
1141
|
async getToken() {
|
|
1151
1142
|
if (process.env.CALS_SNYK_TOKEN) {
|
|
1152
1143
|
return process.env.CALS_SNYK_TOKEN;
|
|
@@ -1167,13 +1158,14 @@ class SnykTokenCliProvider {
|
|
|
1167
1158
|
}
|
|
1168
1159
|
|
|
1169
1160
|
class SnykService {
|
|
1161
|
+
config;
|
|
1162
|
+
tokenProvider;
|
|
1170
1163
|
constructor(props) {
|
|
1171
1164
|
this.config = props.config;
|
|
1172
1165
|
this.tokenProvider = props.tokenProvider;
|
|
1173
1166
|
}
|
|
1174
1167
|
async getProjects(definition) {
|
|
1175
|
-
|
|
1176
|
-
const snykAccountId = (_a = definition.snyk) === null || _a === void 0 ? void 0 : _a.accountId;
|
|
1168
|
+
const snykAccountId = definition.snyk?.accountId;
|
|
1177
1169
|
if (snykAccountId === undefined) {
|
|
1178
1170
|
return [];
|
|
1179
1171
|
}
|
|
@@ -1238,7 +1230,7 @@ class SnykService {
|
|
|
1238
1230
|
totalDependencies: project.meta.latest_dependency_total.total,
|
|
1239
1231
|
issueCountsBySeverity: project.meta.latest_issue_counts,
|
|
1240
1232
|
lastTestedDate: project.meta.latest_dependency_total.updated_at,
|
|
1241
|
-
browseUrl: `https://app.snyk.io/org/${snykOrgSlugId
|
|
1233
|
+
browseUrl: `https://app.snyk.io/org/${snykOrgSlugId ?? "it"}/project/${project.id}`,
|
|
1242
1234
|
};
|
|
1243
1235
|
}),
|
|
1244
1236
|
];
|
|
@@ -1250,10 +1242,9 @@ class SnykService {
|
|
|
1250
1242
|
}
|
|
1251
1243
|
}
|
|
1252
1244
|
function createSnykService(props) {
|
|
1253
|
-
var _a;
|
|
1254
1245
|
return new SnykService({
|
|
1255
1246
|
config: props.config,
|
|
1256
|
-
tokenProvider:
|
|
1247
|
+
tokenProvider: props.tokenProvider ?? new SnykTokenCliProvider(),
|
|
1257
1248
|
});
|
|
1258
1249
|
}
|
|
1259
1250
|
|
|
@@ -1311,6 +1302,8 @@ class SonarCloudTokenCliProvider {
|
|
|
1311
1302
|
}
|
|
1312
1303
|
|
|
1313
1304
|
class SonarCloudService {
|
|
1305
|
+
config;
|
|
1306
|
+
tokenProvider;
|
|
1314
1307
|
constructor(props) {
|
|
1315
1308
|
this.config = props.config;
|
|
1316
1309
|
this.tokenProvider = props.tokenProvider;
|
|
@@ -1347,10 +1340,9 @@ class SonarCloudService {
|
|
|
1347
1340
|
}
|
|
1348
1341
|
}
|
|
1349
1342
|
function createSonarCloudService(props) {
|
|
1350
|
-
var _a;
|
|
1351
1343
|
return new SonarCloudService({
|
|
1352
1344
|
config: props.config,
|
|
1353
|
-
tokenProvider:
|
|
1345
|
+
tokenProvider: props.tokenProvider ?? new SonarCloudTokenCliProvider(),
|
|
1354
1346
|
});
|
|
1355
1347
|
}
|
|
1356
1348
|
|
|
@@ -1362,12 +1354,10 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
1362
1354
|
});
|
|
1363
1355
|
|
|
1364
1356
|
class TestExecutor {
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
this.tasks = [];
|
|
1370
|
-
}
|
|
1357
|
+
shutdown = false;
|
|
1358
|
+
cleanupTask = null;
|
|
1359
|
+
usingWithCleanupTasks = false;
|
|
1360
|
+
tasks = [];
|
|
1371
1361
|
/**
|
|
1372
1362
|
* Check if we are currently in shutdown state due to user
|
|
1373
1363
|
* asking to abort (Ctrl+C).
|
|
@@ -1629,9 +1619,12 @@ class OutputPrefixTransform extends Transform {
|
|
|
1629
1619
|
}
|
|
1630
1620
|
}
|
|
1631
1621
|
function pipeToConsole(result, name) {
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1622
|
+
result.stdout
|
|
1623
|
+
?.pipe(new OutputPrefixTransform(`${name}: `))
|
|
1624
|
+
.pipe(process.stdout);
|
|
1625
|
+
result.stderr
|
|
1626
|
+
?.pipe(new OutputPrefixTransform(`${name} (stderr): `))
|
|
1627
|
+
.pipe(process.stderr);
|
|
1635
1628
|
}
|
|
1636
1629
|
function checkPidRunning(pid) {
|
|
1637
1630
|
try {
|
|
@@ -1731,7 +1724,7 @@ async function startContainer({ executor, network, imageId, alias, env, dockerAr
|
|
|
1731
1724
|
args.push(imageId);
|
|
1732
1725
|
console.log(`Starting ${imageId}`);
|
|
1733
1726
|
const process = execa("docker", args);
|
|
1734
|
-
pipeToConsole(process, alias
|
|
1727
|
+
pipeToConsole(process, alias ?? containerName);
|
|
1735
1728
|
let failed = false;
|
|
1736
1729
|
process.catch(() => {
|
|
1737
1730
|
failed = true;
|
|
@@ -1748,7 +1741,7 @@ async function startContainer({ executor, network, imageId, alias, env, dockerAr
|
|
|
1748
1741
|
executor.registerCleanupTask(async () => {
|
|
1749
1742
|
console.log(`Stopping container ${containerName}`);
|
|
1750
1743
|
const r = execa("docker", ["stop", containerName]);
|
|
1751
|
-
pipeToConsole(r, (alias
|
|
1744
|
+
pipeToConsole(r, (alias ?? containerName) + " (stop)");
|
|
1752
1745
|
try {
|
|
1753
1746
|
await r;
|
|
1754
1747
|
}
|
|
@@ -1769,7 +1762,7 @@ async function startContainer({ executor, network, imageId, alias, env, dockerAr
|
|
|
1769
1762
|
}
|
|
1770
1763
|
async function runNpmRunScript(name, options) {
|
|
1771
1764
|
const result = execa("npm", ["run", name], {
|
|
1772
|
-
env: options
|
|
1765
|
+
env: options?.env,
|
|
1773
1766
|
});
|
|
1774
1767
|
pipeToConsole(result, `npm run ${name}`);
|
|
1775
1768
|
await result;
|
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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