@code-pushup/js-packages-plugin 0.54.0 → 0.55.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.
Files changed (3) hide show
  1. package/bin.js +13 -18
  2. package/index.js +16 -21
  3. package/package.json +3 -3
package/bin.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // packages/plugin-js-packages/src/lib/runner/index.ts
2
2
  import { writeFile } from "node:fs/promises";
3
- import { dirname } from "node:path";
3
+ import { dirname as dirname2 } from "node:path";
4
4
 
5
5
  // packages/models/src/lib/implementation/schemas.ts
6
6
  import { MATERIAL_ICONS } from "vscode-material-icons";
@@ -33,7 +33,7 @@ function exists(value) {
33
33
  return value != null;
34
34
  }
35
35
  function getMissingRefsForCategories(categories, plugins) {
36
- if (categories.length === 0) {
36
+ if (!categories || categories.length === 0) {
37
37
  return false;
38
38
  }
39
39
  const auditRefsFromCategory = categories.flatMap(
@@ -532,12 +532,9 @@ var unrefinedCoreConfigSchema = z14.object({
532
532
  var coreConfigSchema = refineCoreConfig(unrefinedCoreConfigSchema);
533
533
  function refineCoreConfig(schema) {
534
534
  return schema.refine(
535
- (coreCfg) => !getMissingRefsForCategories(coreCfg.categories ?? [], coreCfg.plugins),
536
- (coreCfg) => ({
537
- message: missingRefsForCategoriesErrorMsg(
538
- coreCfg.categories ?? [],
539
- coreCfg.plugins
540
- )
535
+ ({ categories, plugins }) => !getMissingRefsForCategories(categories, plugins),
536
+ ({ categories, plugins }) => ({
537
+ message: missingRefsForCategoriesErrorMsg(categories, plugins)
541
538
  })
542
539
  );
543
540
  }
@@ -589,19 +586,16 @@ var reportSchema = packageVersionSchema({
589
586
  ).merge(
590
587
  z15.object(
591
588
  {
592
- categories: z15.array(categoryConfigSchema),
593
589
  plugins: z15.array(pluginReportSchema).min(1),
590
+ categories: z15.array(categoryConfigSchema).optional(),
594
591
  commit: commitSchema.describe("Git commit for which report was collected").nullable()
595
592
  },
596
593
  { description: "Collect output data" }
597
594
  )
598
595
  ).refine(
599
- (report) => !getMissingRefsForCategories(report.categories, report.plugins),
600
- (report) => ({
601
- message: missingRefsForCategoriesErrorMsg(
602
- report.categories,
603
- report.plugins
604
- )
596
+ ({ categories, plugins }) => !getMissingRefsForCategories(categories, plugins),
597
+ ({ categories, plugins }) => ({
598
+ message: missingRefsForCategoriesErrorMsg(categories, plugins)
605
599
  })
606
600
  );
607
601
 
@@ -772,7 +766,7 @@ function executeProcess(cfg) {
772
766
  import { bold, gray } from "ansis";
773
767
  import { bundleRequire } from "bundle-require";
774
768
  import { mkdir, readFile, readdir, rm, stat } from "node:fs/promises";
775
- import { join } from "node:path";
769
+ import { dirname, join } from "node:path";
776
770
 
777
771
  // packages/utils/src/lib/formatting.ts
778
772
  function pluralize(text, amount) {
@@ -1498,7 +1492,8 @@ var yarnv2PackageManager = {
1498
1492
  ],
1499
1493
  supportedDepGroups: ["prod", "dev"],
1500
1494
  // Yarn v2 does not support audit for optional dependencies
1501
- unifyResult: yarnv2ToAuditResult
1495
+ unifyResult: yarnv2ToAuditResult,
1496
+ ignoreExitCode: true
1502
1497
  },
1503
1498
  outdated: {
1504
1499
  commandArgs: COMMON_OUTDATED_ARGS,
@@ -1689,7 +1684,7 @@ async function executeRunner() {
1689
1684
  const auditResults = checks.includes("audit") ? await processAudit(packageManager, depGroups, auditLevelMapping) : [];
1690
1685
  const outdatedResults = checks.includes("outdated") ? await processOutdated(packageManager, depGroups, packageJsonPaths) : [];
1691
1686
  const checkResults = [...auditResults, ...outdatedResults];
1692
- await ensureDirectoryExists(dirname(RUNNER_OUTPUT_PATH));
1687
+ await ensureDirectoryExists(dirname2(RUNNER_OUTPUT_PATH));
1693
1688
  await writeFile(RUNNER_OUTPUT_PATH, JSON.stringify(checkResults));
1694
1689
  }
1695
1690
  async function processOutdated(id, depGroups, packageJsonPaths) {
package/index.js CHANGED
@@ -1,10 +1,10 @@
1
1
  // packages/plugin-js-packages/src/lib/js-packages-plugin.ts
2
- import { dirname as dirname2, join as join4 } from "node:path";
2
+ import { dirname as dirname3, join as join4 } from "node:path";
3
3
  import { fileURLToPath } from "node:url";
4
4
 
5
5
  // packages/plugin-js-packages/package.json
6
6
  var name = "@code-pushup/js-packages-plugin";
7
- var version = "0.54.0";
7
+ var version = "0.55.0";
8
8
 
9
9
  // packages/plugin-js-packages/src/lib/config.ts
10
10
  import { z as z17 } from "zod";
@@ -40,7 +40,7 @@ function exists(value) {
40
40
  return value != null;
41
41
  }
42
42
  function getMissingRefsForCategories(categories, plugins) {
43
- if (categories.length === 0) {
43
+ if (!categories || categories.length === 0) {
44
44
  return false;
45
45
  }
46
46
  const auditRefsFromCategory = categories.flatMap(
@@ -539,12 +539,9 @@ var unrefinedCoreConfigSchema = z14.object({
539
539
  var coreConfigSchema = refineCoreConfig(unrefinedCoreConfigSchema);
540
540
  function refineCoreConfig(schema) {
541
541
  return schema.refine(
542
- (coreCfg) => !getMissingRefsForCategories(coreCfg.categories ?? [], coreCfg.plugins),
543
- (coreCfg) => ({
544
- message: missingRefsForCategoriesErrorMsg(
545
- coreCfg.categories ?? [],
546
- coreCfg.plugins
547
- )
542
+ ({ categories, plugins }) => !getMissingRefsForCategories(categories, plugins),
543
+ ({ categories, plugins }) => ({
544
+ message: missingRefsForCategoriesErrorMsg(categories, plugins)
548
545
  })
549
546
  );
550
547
  }
@@ -596,19 +593,16 @@ var reportSchema = packageVersionSchema({
596
593
  ).merge(
597
594
  z15.object(
598
595
  {
599
- categories: z15.array(categoryConfigSchema),
600
596
  plugins: z15.array(pluginReportSchema).min(1),
597
+ categories: z15.array(categoryConfigSchema).optional(),
601
598
  commit: commitSchema.describe("Git commit for which report was collected").nullable()
602
599
  },
603
600
  { description: "Collect output data" }
604
601
  )
605
602
  ).refine(
606
- (report) => !getMissingRefsForCategories(report.categories, report.plugins),
607
- (report) => ({
608
- message: missingRefsForCategoriesErrorMsg(
609
- report.categories,
610
- report.plugins
611
- )
603
+ ({ categories, plugins }) => !getMissingRefsForCategories(categories, plugins),
604
+ ({ categories, plugins }) => ({
605
+ message: missingRefsForCategoriesErrorMsg(categories, plugins)
612
606
  })
613
607
  );
614
608
 
@@ -848,7 +842,7 @@ function executeProcess(cfg) {
848
842
  import { bold, gray } from "ansis";
849
843
  import { bundleRequire } from "bundle-require";
850
844
  import { mkdir, readFile, readdir, rm, stat } from "node:fs/promises";
851
- import { join } from "node:path";
845
+ import { dirname, join } from "node:path";
852
846
 
853
847
  // packages/utils/src/lib/logging.ts
854
848
  import isaacs_cliui from "@isaacs/cliui";
@@ -1431,7 +1425,8 @@ var yarnv2PackageManager = {
1431
1425
  ],
1432
1426
  supportedDepGroups: ["prod", "dev"],
1433
1427
  // Yarn v2 does not support audit for optional dependencies
1434
- unifyResult: yarnv2ToAuditResult
1428
+ unifyResult: yarnv2ToAuditResult,
1429
+ ignoreExitCode: true
1435
1430
  },
1436
1431
  outdated: {
1437
1432
  commandArgs: COMMON_OUTDATED_ARGS,
@@ -1449,7 +1444,7 @@ var packageManagers = {
1449
1444
 
1450
1445
  // packages/plugin-js-packages/src/lib/runner/index.ts
1451
1446
  import { writeFile } from "node:fs/promises";
1452
- import { dirname } from "node:path";
1447
+ import { dirname as dirname2 } from "node:path";
1453
1448
 
1454
1449
  // packages/plugin-js-packages/src/lib/runner/audit/transform.ts
1455
1450
  import { md as md7 } from "build-md";
@@ -1482,7 +1477,7 @@ var RELEASE_TYPES = objectToKeys(outdatedSeverity);
1482
1477
 
1483
1478
  // packages/plugin-js-packages/src/lib/runner/index.ts
1484
1479
  async function createRunnerConfig(scriptPath, config) {
1485
- await ensureDirectoryExists(dirname(PLUGIN_CONFIG_PATH));
1480
+ await ensureDirectoryExists(dirname2(PLUGIN_CONFIG_PATH));
1486
1481
  await writeFile(PLUGIN_CONFIG_PATH, JSON.stringify(config));
1487
1482
  return {
1488
1483
  command: "node",
@@ -1577,7 +1572,7 @@ async function normalizeConfig(config) {
1577
1572
  async function jsPackagesPlugin(config) {
1578
1573
  const { packageManager, checks, depGroups, ...jsPackagesPluginConfigRest } = await normalizeConfig(config);
1579
1574
  const runnerScriptPath = join4(
1580
- fileURLToPath(dirname2(import.meta.url)),
1575
+ fileURLToPath(dirname3(import.meta.url)),
1581
1576
  "bin.js"
1582
1577
  );
1583
1578
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@code-pushup/js-packages-plugin",
3
- "version": "0.54.0",
3
+ "version": "0.55.0",
4
4
  "description": "Code PushUp plugin for JavaScript packages 🛡️",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/code-pushup/cli/tree/main/packages/plugin-js-packages#readme",
@@ -39,8 +39,8 @@
39
39
  "main": "./index.js",
40
40
  "types": "./src/index.d.ts",
41
41
  "dependencies": {
42
- "@code-pushup/models": "0.54.0",
43
- "@code-pushup/utils": "0.54.0",
42
+ "@code-pushup/models": "0.55.0",
43
+ "@code-pushup/utils": "0.55.0",
44
44
  "build-md": "^0.4.1",
45
45
  "semver": "^7.6.0",
46
46
  "zod": "^3.22.4"