@code-pushup/cli 0.8.20 → 0.8.21

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 +13 -24
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -30,59 +30,48 @@ var MAX_DESCRIPTION_LENGTH = 65536;
30
30
  var MAX_ISSUE_MESSAGE_LENGTH = 1024;
31
31
 
32
32
  // packages/models/src/lib/implementation/utils.ts
33
- var slugRegex = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
33
+ var slugRegex = /^[a-z\d]+(?:-[a-z\d]+)*$/;
34
34
  var filenameRegex = /^(?!.*[ \\/:*?"<>|]).+$/;
35
35
  function hasDuplicateStrings(strings) {
36
- const uniqueStrings = Array.from(new Set(strings));
37
- const duplicatedStrings = strings.filter(
38
- /* @__PURE__ */ ((i) => (v) => uniqueStrings[i] !== v || !++i)(0)
36
+ const sortedStrings = [...strings].sort();
37
+ const duplStrings = sortedStrings.filter(
38
+ (item, index) => index !== 0 && item === sortedStrings[index - 1]
39
39
  );
40
- return duplicatedStrings.length === 0 ? false : duplicatedStrings;
40
+ return duplStrings.length === 0 ? false : [...new Set(duplStrings)];
41
41
  }
42
42
  function hasMissingStrings(toCheck, existing) {
43
43
  const nonExisting = toCheck.filter((s) => !existing.includes(s));
44
44
  return nonExisting.length === 0 ? false : nonExisting;
45
45
  }
46
- function errorItems(items, transform = (items2) => items2.join(", ")) {
47
- const paredItems = items ? items : [];
48
- return transform(paredItems);
46
+ function errorItems(items, transform = (itemArr) => itemArr.join(", ")) {
47
+ return transform(items || []);
49
48
  }
50
49
  function exists(value) {
51
50
  return value != null;
52
51
  }
53
52
  function getMissingRefsForCategories(categories, plugins) {
54
- const missingRefs = [];
55
53
  const auditRefsFromCategory = categories.flatMap(
56
54
  ({ refs }) => refs.filter(({ type }) => type === "audit").map(({ plugin, slug }) => `${plugin}/${slug}`)
57
55
  );
58
56
  const auditRefsFromPlugins = plugins.flatMap(
59
- ({ audits, slug: pluginSlug }) => {
60
- return audits.map(({ slug }) => `${pluginSlug}/${slug}`);
61
- }
57
+ ({ audits, slug: pluginSlug }) => audits.map(({ slug }) => `${pluginSlug}/${slug}`)
62
58
  );
63
59
  const missingAuditRefs = hasMissingStrings(
64
60
  auditRefsFromCategory,
65
61
  auditRefsFromPlugins
66
62
  );
67
- if (Array.isArray(missingAuditRefs) && missingAuditRefs.length > 0) {
68
- missingRefs.push(...missingAuditRefs);
69
- }
70
63
  const groupRefsFromCategory = categories.flatMap(
71
64
  ({ refs }) => refs.filter(({ type }) => type === "group").map(({ plugin, slug }) => `${plugin}#${slug} (group)`)
72
65
  );
73
66
  const groupRefsFromPlugins = plugins.flatMap(
74
- ({ groups, slug: pluginSlug }) => {
75
- return Array.isArray(groups) ? groups.map(({ slug }) => `${pluginSlug}#${slug} (group)`) : [];
76
- }
67
+ ({ groups, slug: pluginSlug }) => Array.isArray(groups) ? groups.map(({ slug }) => `${pluginSlug}#${slug} (group)`) : []
77
68
  );
78
69
  const missingGroupRefs = hasMissingStrings(
79
70
  groupRefsFromCategory,
80
71
  groupRefsFromPlugins
81
72
  );
82
- if (Array.isArray(missingGroupRefs) && missingGroupRefs.length > 0) {
83
- missingRefs.push(...missingGroupRefs);
84
- }
85
- return missingRefs.length ? missingRefs : false;
73
+ const missingRefs = [missingAuditRefs, missingGroupRefs].filter((refs) => Array.isArray(refs) && refs.length > 0).flat();
74
+ return missingRefs.length > 0 ? missingRefs : false;
86
75
  }
87
76
  function missingRefsForCategoriesErrorMsg(categories, plugins) {
88
77
  const missingRefs = getMissingRefsForCategories(categories, plugins);
@@ -126,7 +115,7 @@ function metaSchema(options2) {
126
115
  titleDescription,
127
116
  docsUrlDescription,
128
117
  description
129
- } = options2 || {};
118
+ } = options2 ?? {};
130
119
  return z.object(
131
120
  {
132
121
  title: titleSchema(titleDescription),
@@ -1725,7 +1714,7 @@ function auditOutputsCorrelateWithPluginOutput(auditOutputs, pluginConfigAudits)
1725
1714
 
1726
1715
  // packages/core/package.json
1727
1716
  var name = "@code-pushup/core";
1728
- var version = "0.8.20";
1717
+ var version = "0.8.21";
1729
1718
 
1730
1719
  // packages/core/src/lib/implementation/collect.ts
1731
1720
  async function collect(options2) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@code-pushup/cli",
3
- "version": "0.8.20",
3
+ "version": "0.8.21",
4
4
  "bin": {
5
5
  "code-pushup": "index.js"
6
6
  },