@code-pushup/js-packages-plugin 0.35.0 → 0.39.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 (4) hide show
  1. package/README.md +17 -3
  2. package/bin.js +11 -6
  3. package/index.js +8 -4
  4. package/package.json +3 -3
package/README.md CHANGED
@@ -22,7 +22,21 @@ It supports the following package managers:
22
22
 
23
23
  1. If you haven't already, install [@code-pushup/cli](../cli/README.md) and create a configuration file.
24
24
 
25
- 2. Insert plugin configuration with your package manager. By default, both `audit` and `outdated` checks will be run. The result should look as follows:
25
+ 2. Install as a dev dependency with your package manager:
26
+
27
+ ```sh
28
+ npm install --save-dev @code-pushup/js-packages-plugin
29
+ ```
30
+
31
+ ```sh
32
+ yarn add --dev @code-pushup/js-packages-plugin
33
+ ```
34
+
35
+ ```sh
36
+ pnpm add --save-dev @code-pushup/js-packages-plugin
37
+ ```
38
+
39
+ 3. Insert plugin configuration with your package manager. By default, both `audit` and `outdated` checks will be run. The result should look as follows:
26
40
 
27
41
  ```js
28
42
  import jsPackagesPlugin from '@code-pushup/js-packages-plugin';
@@ -50,7 +64,7 @@ It supports the following package managers:
50
64
  };
51
65
  ```
52
66
 
53
- 3. (Optional) Reference individual audits or the provided plugin groups which you wish to include in custom categories (use `npx code-pushup print-config` to list audits and groups).
67
+ 4. (Optional) Reference individual audits or the provided plugin groups which you wish to include in custom categories (use `npx code-pushup print-config` to list audits and groups).
54
68
 
55
69
  💡 Assign weights based on what influence each command should have on the overall category score (assign weight 0 to only include as extra info, without influencing category score).
56
70
 
@@ -88,7 +102,7 @@ It supports the following package managers:
88
102
  };
89
103
  ```
90
104
 
91
- 4. Run the CLI with `npx code-pushup collect` and view or upload report (refer to [CLI docs](../cli/README.md)).
105
+ 5. Run the CLI with `npx code-pushup collect` and view or upload report (refer to [CLI docs](../cli/README.md)).
92
106
 
93
107
  ## Plugin architecture
94
108
 
package/bin.js CHANGED
@@ -578,10 +578,14 @@ function makeArraysComparisonSchema(diffSchema, resultSchema, description) {
578
578
  { description }
579
579
  );
580
580
  }
581
- var scorableMetaSchema = z14.object({ slug: slugSchema, title: titleSchema });
581
+ var scorableMetaSchema = z14.object({
582
+ slug: slugSchema,
583
+ title: titleSchema,
584
+ docsUrl: docsUrlSchema
585
+ });
582
586
  var scorableWithPluginMetaSchema = scorableMetaSchema.merge(
583
587
  z14.object({
584
- plugin: pluginMetaSchema.pick({ slug: true, title: true }).describe("Plugin which defines it")
588
+ plugin: pluginMetaSchema.pick({ slug: true, title: true, docsUrl: true }).describe("Plugin which defines it")
585
589
  })
586
590
  );
587
591
  var scorableDiffSchema = scorableMetaSchema.merge(
@@ -725,7 +729,7 @@ async function ensureDirectoryExists(baseDir) {
725
729
  await mkdir(baseDir, { recursive: true });
726
730
  return;
727
731
  } catch (error) {
728
- ui().logger.error(error.message);
732
+ ui().logger.info(error.message);
729
733
  if (error.code !== "EEXIST") {
730
734
  throw error;
731
735
  }
@@ -1377,8 +1381,8 @@ function outdatedResultToAuditOutput(result, packageManager, depGroup) {
1377
1381
  const relevantDependencies = result.filter(
1378
1382
  (dep) => dep.type === dependencyGroupToLong[depGroup]
1379
1383
  );
1380
- const outdatedDependencies = relevantDependencies.filter(
1381
- (dep) => dep.current !== dep.latest
1384
+ const outdatedDependencies = relevantDependencies.filter((dep) => dep.current !== dep.latest).filter(
1385
+ (dep) => dep.current.split("-")[0]?.toString() !== dep.latest.split("-")[0]?.toString()
1382
1386
  );
1383
1387
  const outdatedStats = outdatedDependencies.reduce(
1384
1388
  (acc, dep) => {
@@ -1444,7 +1448,8 @@ function getOutdatedLevel(currentFullVersion, latestFullVersion) {
1444
1448
  throw new Error("Package is not outdated.");
1445
1449
  }
1446
1450
  function splitPackageVersion(fullVersion) {
1447
- const [major, minor, patch] = fullVersion.split(".").map(Number);
1451
+ const semanticVersion = String(fullVersion.split("-")[0]);
1452
+ const [major, minor, patch] = semanticVersion.split(".").map(Number);
1448
1453
  if (major == null || minor == null || patch == null) {
1449
1454
  throw new Error(`Invalid version description ${fullVersion}`);
1450
1455
  }
package/index.js CHANGED
@@ -4,7 +4,7 @@ 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.35.0";
7
+ var version = "0.39.0";
8
8
 
9
9
  // packages/plugin-js-packages/src/lib/config.ts
10
10
  import { z as z15 } from "zod";
@@ -585,10 +585,14 @@ function makeArraysComparisonSchema(diffSchema, resultSchema, description) {
585
585
  { description }
586
586
  );
587
587
  }
588
- var scorableMetaSchema = z14.object({ slug: slugSchema, title: titleSchema });
588
+ var scorableMetaSchema = z14.object({
589
+ slug: slugSchema,
590
+ title: titleSchema,
591
+ docsUrl: docsUrlSchema
592
+ });
589
593
  var scorableWithPluginMetaSchema = scorableMetaSchema.merge(
590
594
  z14.object({
591
- plugin: pluginMetaSchema.pick({ slug: true, title: true }).describe("Plugin which defines it")
595
+ plugin: pluginMetaSchema.pick({ slug: true, title: true, docsUrl: true }).describe("Plugin which defines it")
592
596
  })
593
597
  );
594
598
  var scorableDiffSchema = scorableMetaSchema.merge(
@@ -798,7 +802,7 @@ async function ensureDirectoryExists(baseDir) {
798
802
  await mkdir(baseDir, { recursive: true });
799
803
  return;
800
804
  } catch (error) {
801
- ui().logger.error(error.message);
805
+ ui().logger.info(error.message);
802
806
  if (error.code !== "EEXIST") {
803
807
  throw error;
804
808
  }
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@code-pushup/js-packages-plugin",
3
- "version": "0.35.0",
3
+ "version": "0.39.0",
4
4
  "dependencies": {
5
- "@code-pushup/models": "0.35.0",
6
- "@code-pushup/utils": "0.35.0",
5
+ "@code-pushup/models": "0.39.0",
6
+ "@code-pushup/utils": "0.39.0",
7
7
  "zod": "^3.22.4"
8
8
  },
9
9
  "license": "MIT",