@code-pushup/core 0.12.1 → 0.12.2
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/index.js
CHANGED
|
@@ -32,6 +32,9 @@ function exists(value) {
|
|
|
32
32
|
return value != null;
|
|
33
33
|
}
|
|
34
34
|
function getMissingRefsForCategories(categories, plugins) {
|
|
35
|
+
if (categories.length === 0) {
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
35
38
|
const auditRefsFromCategory = categories.flatMap(
|
|
36
39
|
({ refs }) => refs.filter(({ type }) => type === "audit").map(({ plugin, slug }) => `${plugin}/${slug}`)
|
|
37
40
|
);
|
|
@@ -306,7 +309,7 @@ function getDuplicateRefsInCategoryMetrics(metrics) {
|
|
|
306
309
|
}
|
|
307
310
|
var categoriesSchema = z5.array(categoryConfigSchema, {
|
|
308
311
|
description: "Categorization of individual audits"
|
|
309
|
-
}).
|
|
312
|
+
}).refine(
|
|
310
313
|
(categoryCfg) => !getDuplicateSlugCategories(categoryCfg),
|
|
311
314
|
(categoryCfg) => ({
|
|
312
315
|
message: duplicateSlugCategoriesErrorMsg(categoryCfg)
|
|
@@ -464,15 +467,15 @@ var unrefinedCoreConfigSchema = z11.object({
|
|
|
464
467
|
persist: persistConfigSchema.optional(),
|
|
465
468
|
/** portal configuration for uploading results */
|
|
466
469
|
upload: uploadConfigSchema.optional(),
|
|
467
|
-
categories: categoriesSchema
|
|
470
|
+
categories: categoriesSchema.optional()
|
|
468
471
|
});
|
|
469
472
|
var coreConfigSchema = refineCoreConfig(unrefinedCoreConfigSchema);
|
|
470
473
|
function refineCoreConfig(schema) {
|
|
471
474
|
return schema.refine(
|
|
472
|
-
(coreCfg) => !getMissingRefsForCategories(coreCfg.categories, coreCfg.plugins),
|
|
475
|
+
(coreCfg) => !getMissingRefsForCategories(coreCfg.categories ?? [], coreCfg.plugins),
|
|
473
476
|
(coreCfg) => ({
|
|
474
477
|
message: missingRefsForCategoriesErrorMsg(
|
|
475
|
-
coreCfg.categories,
|
|
478
|
+
coreCfg.categories ?? [],
|
|
476
479
|
coreCfg.plugins
|
|
477
480
|
)
|
|
478
481
|
})
|
|
@@ -1106,12 +1109,13 @@ function tableHtml(data) {
|
|
|
1106
1109
|
|
|
1107
1110
|
// packages/utils/src/lib/reports/generate-md-report.ts
|
|
1108
1111
|
function generateMdReport(report, commitData) {
|
|
1112
|
+
const printCategories = report.categories.length > 0;
|
|
1109
1113
|
return (
|
|
1110
1114
|
// header section
|
|
1111
1115
|
// eslint-disable-next-line prefer-template
|
|
1112
|
-
reportToHeaderSection() + NEW_LINE + // overview section
|
|
1113
|
-
reportToOverviewSection(report) + NEW_LINE + NEW_LINE + // categories section
|
|
1114
|
-
reportToCategoriesSection(report) + NEW_LINE + NEW_LINE + // audits section
|
|
1116
|
+
reportToHeaderSection() + NEW_LINE + // categories overview section
|
|
1117
|
+
(printCategories ? reportToOverviewSection(report) + NEW_LINE + NEW_LINE : "") + // categories section
|
|
1118
|
+
(printCategories ? reportToCategoriesSection(report) + NEW_LINE + NEW_LINE : "") + // audits section
|
|
1115
1119
|
reportToAuditsSection(report) + NEW_LINE + NEW_LINE + // about section
|
|
1116
1120
|
reportToAboutSection(report, commitData) + NEW_LINE + NEW_LINE + // footer section
|
|
1117
1121
|
`${FOOTER_PREFIX} ${link(README_LINK, "Code PushUp")}`
|
|
@@ -1288,7 +1292,8 @@ function addLine(line = "") {
|
|
|
1288
1292
|
return line + NEW_LINE;
|
|
1289
1293
|
}
|
|
1290
1294
|
function generateStdoutSummary(report) {
|
|
1291
|
-
|
|
1295
|
+
const printCategories = report.categories.length > 0;
|
|
1296
|
+
return addLine(reportToHeaderSection2(report)) + addLine() + addLine(reportToDetailSection(report)) + (printCategories ? addLine(reportToOverviewSection2(report)) : "") + addLine(`${FOOTER_PREFIX} ${CODE_PUSHUP_DOMAIN}`);
|
|
1292
1297
|
}
|
|
1293
1298
|
function reportToHeaderSection2(report) {
|
|
1294
1299
|
const { packageName, version: version2 } = report;
|
|
@@ -1520,7 +1525,7 @@ var verboseUtils = (verbose) => ({
|
|
|
1520
1525
|
|
|
1521
1526
|
// packages/core/package.json
|
|
1522
1527
|
var name = "@code-pushup/core";
|
|
1523
|
-
var version = "0.12.
|
|
1528
|
+
var version = "0.12.2";
|
|
1524
1529
|
|
|
1525
1530
|
// packages/core/src/lib/implementation/execute-plugin.ts
|
|
1526
1531
|
import chalk4 from "chalk";
|
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { CoreConfig } from '@code-pushup/models';
|
|
2
2
|
import { GlobalOptions } from './types';
|
|
3
|
-
export type CollectAndPersistReportsOptions = Pick<CoreConfig, 'persist' | 'plugins' | 'categories'
|
|
3
|
+
export type CollectAndPersistReportsOptions = Required<Pick<CoreConfig, 'persist' | 'plugins' | 'categories'>> & GlobalOptions;
|
|
4
4
|
export declare function collectAndPersistReports(options: CollectAndPersistReportsOptions): Promise<void>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CoreConfig, Report } from '@code-pushup/models';
|
|
2
2
|
import { GlobalOptions } from '../types';
|
|
3
|
-
export type CollectOptions = Pick<CoreConfig, 'plugins' | 'categories'
|
|
3
|
+
export type CollectOptions = Required<Pick<CoreConfig, 'plugins' | 'categories'>> & GlobalOptions;
|
|
4
4
|
/**
|
|
5
5
|
* Run audits, collect plugin output and aggregate it into a JSON object
|
|
6
6
|
* @param options
|