@code-pushup/core 0.53.0 → 0.54.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 (2) hide show
  1. package/index.js +11 -11
  2. package/package.json +39 -17
package/index.js CHANGED
@@ -12,7 +12,7 @@ var MAX_ISSUE_MESSAGE_LENGTH = 1024;
12
12
  var slugRegex = /^[a-z\d]+(?:-[a-z\d]+)*$/;
13
13
  var filenameRegex = /^(?!.*[ \\/:*?"<>|]).+$/;
14
14
  function hasDuplicateStrings(strings) {
15
- const sortedStrings = [...strings].sort();
15
+ const sortedStrings = strings.toSorted();
16
16
  const duplStrings = sortedStrings.filter(
17
17
  (item, index) => index !== 0 && item === sortedStrings[index - 1]
18
18
  );
@@ -106,7 +106,6 @@ var fileNameSchema = z.string().trim().regex(filenameRegex, {
106
106
  message: `The filename has to be valid`
107
107
  }).min(1, { message: "file name is invalid" });
108
108
  var positiveIntSchema = z.number().int().positive();
109
- var nonnegativeIntSchema = z.number().int().nonnegative();
110
109
  var nonnegativeNumberSchema = z.number().nonnegative();
111
110
  function packageVersionSchema(options) {
112
111
  const { versionDescription = "NPM version of the package", required } = options ?? {};
@@ -654,7 +653,7 @@ var auditDiffSchema = scorableWithPluginDiffSchema.merge(
654
653
  z16.object({
655
654
  values: makeComparisonSchema(auditValueSchema).merge(
656
655
  z16.object({
657
- diff: z16.number().int().describe("Value change (`values.after - values.before`)")
656
+ diff: z16.number().describe("Value change (`values.after - values.before`)")
658
657
  })
659
658
  ).describe("Audit `value` comparison"),
660
659
  displayValues: makeComparisonSchema(auditDisplayValueSchema).describe(
@@ -1000,6 +999,7 @@ function executeProcess(cfg) {
1000
999
  return new Promise((resolve, reject) => {
1001
1000
  const spawnedProcess = spawn(command, args ?? [], {
1002
1001
  shell: true,
1002
+ windowsHide: true,
1003
1003
  ...options
1004
1004
  });
1005
1005
  let stdout = "";
@@ -1474,7 +1474,7 @@ function getColumnAlignments(tableData) {
1474
1474
  (_, idx) => getColumnAlignmentForIndex(idx, columns)
1475
1475
  );
1476
1476
  }
1477
- const biggestRow = [...rows].sort((a, b) => Object.keys(a).length - Object.keys(b).length).at(-1);
1477
+ const biggestRow = rows.toSorted((a, b) => Object.keys(a).length - Object.keys(b).length).at(-1);
1478
1478
  if (columns.length > 0) {
1479
1479
  return columns.map(
1480
1480
  (column, idx) => typeof column === "string" ? column : getColumnAlignmentForKeyAndIndex(
@@ -1653,7 +1653,7 @@ function getSortableGroupByRef({ plugin, slug, weight }, plugins) {
1653
1653
  throwIsNotPresentError(`Group ${slug}`, groupPlugin.slug);
1654
1654
  }
1655
1655
  const sortedAudits = getSortedGroupAudits(group, groupPlugin.slug, plugins);
1656
- const sortedAuditRefs = [...group.refs].sort((a, b) => {
1656
+ const sortedAuditRefs = group.refs.toSorted((a, b) => {
1657
1657
  const aIndex = sortedAudits.findIndex((ref) => ref.slug === a.slug);
1658
1658
  const bIndex = sortedAudits.findIndex((ref) => ref.slug === b.slug);
1659
1659
  return aIndex - bIndex;
@@ -1682,7 +1682,7 @@ function sortReport(report) {
1682
1682
  const sortedAuditsAndGroups = [...audits, ...groups].sort(
1683
1683
  compareCategoryAuditsAndGroups
1684
1684
  );
1685
- const sortedRefs = [...category.refs].sort((a, b) => {
1685
+ const sortedRefs = category.refs.toSorted((a, b) => {
1686
1686
  const aIndex = sortedAuditsAndGroups.findIndex(
1687
1687
  (ref) => ref.slug === a.slug && ref.plugin === a.plugin
1688
1688
  );
@@ -1702,12 +1702,12 @@ function sortReport(report) {
1702
1702
  function sortPlugins(plugins) {
1703
1703
  return plugins.map((plugin) => ({
1704
1704
  ...plugin,
1705
- audits: [...plugin.audits].sort(compareAudits).map(
1705
+ audits: plugin.audits.toSorted(compareAudits).map(
1706
1706
  (audit) => audit.details?.issues ? {
1707
1707
  ...audit,
1708
1708
  details: {
1709
1709
  ...audit.details,
1710
- issues: [...audit.details.issues].sort(compareIssues)
1710
+ issues: audit.details.issues.toSorted(compareIssues)
1711
1711
  }
1712
1712
  } : audit
1713
1713
  )
@@ -1984,7 +1984,7 @@ function formatPortalLink(portalUrl) {
1984
1984
  return portalUrl && md5.link(portalUrl, "\u{1F575}\uFE0F See full comparison in Code PushUp portal \u{1F50D}");
1985
1985
  }
1986
1986
  function sortChanges(changes) {
1987
- return [...changes].sort(
1987
+ return changes.toSorted(
1988
1988
  (a, b) => Math.abs(b.scores.diff) - Math.abs(a.scores.diff) || Math.abs(b.values?.diff ?? 0) - Math.abs(a.values?.diff ?? 0)
1989
1989
  );
1990
1990
  }
@@ -2265,7 +2265,7 @@ function reportToHeaderSection(report) {
2265
2265
  function logPlugins(plugins, verbose) {
2266
2266
  plugins.forEach((plugin) => {
2267
2267
  const { title, audits } = plugin;
2268
- const filteredAudits = verbose ? audits : audits.filter(({ score }) => score !== 1);
2268
+ const filteredAudits = verbose || audits.length === 1 ? audits : audits.filter(({ score }) => score !== 1);
2269
2269
  const diff = audits.length - filteredAudits.length;
2270
2270
  logAudits(title, filteredAudits);
2271
2271
  if (diff > 0) {
@@ -2450,7 +2450,7 @@ var verboseUtils = (verbose = false) => ({
2450
2450
 
2451
2451
  // packages/core/package.json
2452
2452
  var name = "@code-pushup/core";
2453
- var version = "0.53.0";
2453
+ var version = "0.54.0";
2454
2454
 
2455
2455
  // packages/core/src/lib/implementation/execute-plugin.ts
2456
2456
  import { bold as bold5 } from "ansis";
package/package.json CHANGED
@@ -1,34 +1,56 @@
1
1
  {
2
2
  "name": "@code-pushup/core",
3
- "version": "0.53.0",
3
+ "version": "0.54.0",
4
4
  "license": "MIT",
5
5
  "description": "Core business logic for the used by the Code PushUp CLI",
6
- "dependencies": {
7
- "@code-pushup/models": "0.53.0",
8
- "@code-pushup/utils": "0.53.0",
9
- "ansis": "^3.3.0"
10
- },
11
- "peerDependencies": {
12
- "@code-pushup/portal-client": "^0.9.0"
13
- },
14
- "peerDependenciesMeta": {
15
- "@code-pushup/portal-client": {
16
- "optional": true
17
- }
18
- },
19
6
  "homepage": "https://github.com/code-pushup/cli/tree/main/packages/core#readme",
20
7
  "bugs": {
21
- "url": "https://github.com/code-pushup/cli/issues"
8
+ "url": "https://github.com/code-pushup/cli/issues?q=is%3Aissue%20state%3Aopen%20type%3ABug%20label%3A\"🧩%20core\""
22
9
  },
23
10
  "repository": {
24
11
  "type": "git",
25
12
  "url": "git+https://github.com/code-pushup/cli.git",
26
13
  "directory": "packages/core"
27
14
  },
15
+ "keywords": [
16
+ "CLI",
17
+ "Code PushUp",
18
+ "automation",
19
+ "developer tools",
20
+ "code quality",
21
+ "conformance",
22
+ "build tools",
23
+ "KPI tracking",
24
+ "tech debt",
25
+ "automated feedback",
26
+ "regression guard",
27
+ "CI integration",
28
+ "code management",
29
+ "actionable feedback",
30
+ "trend analysis",
31
+ "static analysis",
32
+ "linting",
33
+ "audit",
34
+ "performance",
35
+ "score monitoring"
36
+ ],
28
37
  "publishConfig": {
29
38
  "access": "public"
30
39
  },
31
40
  "type": "module",
32
41
  "main": "./index.js",
33
- "types": "./src/index.d.ts"
34
- }
42
+ "types": "./src/index.d.ts",
43
+ "dependencies": {
44
+ "@code-pushup/models": "0.54.0",
45
+ "@code-pushup/utils": "0.54.0",
46
+ "ansis": "^3.3.0"
47
+ },
48
+ "peerDependencies": {
49
+ "@code-pushup/portal-client": "^0.9.0"
50
+ },
51
+ "peerDependenciesMeta": {
52
+ "@code-pushup/portal-client": {
53
+ "optional": true
54
+ }
55
+ }
56
+ }