Fix call to endGroup
Also, rename variable and change a comment.
This commit is contained in:
parent
354bc9f629
commit
7294b404d8
3 changed files with 27 additions and 23 deletions
23
lib/config-utils.js
generated
23
lib/config-utils.js
generated
|
|
@ -905,8 +905,9 @@ async function initConfig(languagesInput, queriesInput, packsInput, configFile,
|
||||||
"Please make sure that the default queries are enabled, or you are specifying queries to run.");
|
"Please make sure that the default queries are enabled, or you are specifying queries to run.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// if using the codescanning config in the CLI, pack downloads
|
// When using the codescanning config in the CLI, pack downloads
|
||||||
// happen in the CLI, so no need to do them here.
|
// happen in the CLI during the `database init` command, so no need
|
||||||
|
// to download them here.
|
||||||
if (!(await (0, util_1.useCodeScanningConfigInCli)(codeQL))) {
|
if (!(await (0, util_1.useCodeScanningConfigInCli)(codeQL))) {
|
||||||
await downloadPacks(codeQL, config.languages, config.packs, logger);
|
await downloadPacks(codeQL, config.languages, config.packs, logger);
|
||||||
}
|
}
|
||||||
|
|
@ -995,26 +996,26 @@ async function getConfig(tempDir, logger) {
|
||||||
}
|
}
|
||||||
exports.getConfig = getConfig;
|
exports.getConfig = getConfig;
|
||||||
async function downloadPacks(codeQL, languages, packs, logger) {
|
async function downloadPacks(codeQL, languages, packs, logger) {
|
||||||
let packsDownloaded = 0;
|
let numPacksDownloaded = 0;
|
||||||
logger.startGroup("Downloading packs");
|
logger.startGroup("Downloading packs");
|
||||||
for (const language of languages) {
|
for (const language of languages) {
|
||||||
const packsWithVersion = packs[language];
|
const packsWithVersion = packs[language];
|
||||||
if (packsWithVersion === null || packsWithVersion === void 0 ? void 0 : packsWithVersion.length) {
|
if (packsWithVersion === null || packsWithVersion === void 0 ? void 0 : packsWithVersion.length) {
|
||||||
logger.info(`Downloading custom packs for ${language}`);
|
logger.info(`Downloading custom packs for ${language}`);
|
||||||
const results = await codeQL.packDownload(packsWithVersion);
|
const results = await codeQL.packDownload(packsWithVersion);
|
||||||
packsDownloaded += results.packs.length;
|
numPacksDownloaded += results.packs.length;
|
||||||
logger.info(`Downloaded packs: ${results.packs
|
logger.info(`Downloaded packs: ${results.packs
|
||||||
.map((r) => `${r.name}@${r.version || "latest"}`)
|
.map((r) => `${r.name}@${r.version || "latest"}`)
|
||||||
.join(", ")}`);
|
.join(", ")}`);
|
||||||
}
|
}
|
||||||
if (packsDownloaded) {
|
|
||||||
logger.info(`Downloaded ${packsDownloaded} packs`);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
logger.info("No packs to download");
|
|
||||||
}
|
|
||||||
logger.endGroup();
|
|
||||||
}
|
}
|
||||||
|
if (numPacksDownloaded > 0) {
|
||||||
|
logger.info(`Downloaded ${numPacksDownloaded} ${packs === 1 ? "pack" : "packs"}`);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
logger.info("No packs to download");
|
||||||
|
}
|
||||||
|
logger.endGroup();
|
||||||
}
|
}
|
||||||
exports.downloadPacks = downloadPacks;
|
exports.downloadPacks = downloadPacks;
|
||||||
//# sourceMappingURL=config-utils.js.map
|
//# sourceMappingURL=config-utils.js.map
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -1682,8 +1682,9 @@ export async function initConfig(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// if using the codescanning config in the CLI, pack downloads
|
// When using the codescanning config in the CLI, pack downloads
|
||||||
// happen in the CLI, so no need to do them here.
|
// happen in the CLI during the `database init` command, so no need
|
||||||
|
// to download them here.
|
||||||
if (!(await useCodeScanningConfigInCli(codeQL))) {
|
if (!(await useCodeScanningConfigInCli(codeQL))) {
|
||||||
await downloadPacks(codeQL, config.languages, config.packs, logger);
|
await downloadPacks(codeQL, config.languages, config.packs, logger);
|
||||||
}
|
}
|
||||||
|
|
@ -1796,26 +1797,28 @@ export async function downloadPacks(
|
||||||
packs: Packs,
|
packs: Packs,
|
||||||
logger: Logger
|
logger: Logger
|
||||||
) {
|
) {
|
||||||
let packsDownloaded = 0;
|
let numPacksDownloaded = 0;
|
||||||
logger.startGroup("Downloading packs");
|
logger.startGroup("Downloading packs");
|
||||||
for (const language of languages) {
|
for (const language of languages) {
|
||||||
const packsWithVersion = packs[language];
|
const packsWithVersion = packs[language];
|
||||||
if (packsWithVersion?.length) {
|
if (packsWithVersion?.length) {
|
||||||
logger.info(`Downloading custom packs for ${language}`);
|
logger.info(`Downloading custom packs for ${language}`);
|
||||||
const results = await codeQL.packDownload(packsWithVersion);
|
const results = await codeQL.packDownload(packsWithVersion);
|
||||||
packsDownloaded += results.packs.length;
|
numPacksDownloaded += results.packs.length;
|
||||||
logger.info(
|
logger.info(
|
||||||
`Downloaded packs: ${results.packs
|
`Downloaded packs: ${results.packs
|
||||||
.map((r) => `${r.name}@${r.version || "latest"}`)
|
.map((r) => `${r.name}@${r.version || "latest"}`)
|
||||||
.join(", ")}`
|
.join(", ")}`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (packsDownloaded) {
|
|
||||||
logger.info(`Downloaded ${packsDownloaded} packs`);
|
|
||||||
} else {
|
|
||||||
logger.info("No packs to download");
|
|
||||||
}
|
|
||||||
logger.endGroup();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (numPacksDownloaded > 0) {
|
||||||
|
logger.info(
|
||||||
|
`Downloaded ${numPacksDownloaded} ${packs === 1 ? "pack" : "packs"}`
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
logger.info("No packs to download");
|
||||||
|
}
|
||||||
|
logger.endGroup();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue