@cms-lab/cli 1.2.4 → 1.2.5

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/README.md CHANGED
@@ -39,7 +39,7 @@ cms-lab explain CMS-ROUTE-404
39
39
  cms-lab supports Next.js App Router and Pages Router projects using Prismic,
40
40
  Strapi, Directus, WordPress, Contentful, and Sanity. It validates configured CMS
41
41
  route mappings, route reachability, UID gaps, SEO metadata, image alt text, and
42
- project-specific required fields.
42
+ project-specific required fields and relationship minimums.
43
43
 
44
44
  `cms-lab init --cms strapi --router pages` writes a Strapi starter config with
45
45
  collections, single types, route examples, and the Strapi relation route helper.
package/dist/bin.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  runCli
4
- } from "./chunk-R7T3O3TT.js";
4
+ } from "./chunk-4XXHRNEA.js";
5
5
 
6
6
  // src/bin.ts
7
7
  var exitCode = await runCli(process.argv.slice(2));
@@ -100,6 +100,9 @@ function groupForDiagnostic(diagnostic) {
100
100
  if (diagnostic.code.startsWith("CMS-FIELD")) {
101
101
  return "fields";
102
102
  }
103
+ if (diagnostic.code.startsWith("CMS-RELATIONSHIP")) {
104
+ return "relationships";
105
+ }
103
106
  if (diagnostic.code.startsWith("SEO-")) {
104
107
  return "seo";
105
108
  }
@@ -372,7 +375,8 @@ function checksSummary(config) {
372
375
  `- Routes: ${checkState(checks?.routes)}`,
373
376
  `- SEO: ${checkState(checks?.seo)}`,
374
377
  `- Image alt text: ${checkState(checks?.a11y ?? checks?.images)}`,
375
- `- Required fields: ${requiredFieldsSummary(config)}`
378
+ `- Required fields: ${requiredFieldsSummary(config)}`,
379
+ `- Relationship rules: ${relationshipRulesSummary(config)}`
376
380
  ];
377
381
  return lines.join("\n");
378
382
  }
@@ -398,6 +402,15 @@ function requiredFieldsSummary(config) {
398
402
  (field) => `${field.type}.${field.path} (${field.severity ?? "error"})`
399
403
  ).join(", ");
400
404
  }
405
+ function relationshipRulesSummary(config) {
406
+ const relationships = config.checks?.relationships ?? [];
407
+ if (relationships.length === 0) {
408
+ return "default";
409
+ }
410
+ return relationships.map(
411
+ (rule) => `${rule.from} -> ${rule.to} (${rule.where.fromField} = ${rule.where.toField}, min ${rule.min ?? 1}, ${rule.severity ?? "warning"})`
412
+ ).join(", ");
413
+ }
401
414
  function projectLabel(project) {
402
415
  if (project.framework === "next" && project.router === "app") {
403
416
  return "Next.js App Router";
@@ -565,7 +578,7 @@ var noColor = {
565
578
  // src/index.ts
566
579
  async function runCli(argv, dependencies = {}) {
567
580
  let exitCode = 0;
568
- const program = new Command().name("cms-lab").description("Catch CMS bugs before deploy.").version("1.2.4").exitOverride().configureOutput({
581
+ const program = new Command().name("cms-lab").description("Catch CMS bugs before deploy.").version("1.2.5").exitOverride().configureOutput({
569
582
  writeOut: (text) => writeStdout(dependencies, text),
570
583
  writeErr: (text) => writeStderr(dependencies, text)
571
584
  });
@@ -1404,7 +1417,14 @@ function assertTypeFilterMatched(documents, types) {
1404
1417
  );
1405
1418
  }
1406
1419
  function parseCheckGroups(values) {
1407
- const allowed = /* @__PURE__ */ new Set(["routes", "seo", "a11y", "images", "fields"]);
1420
+ const allowed = /* @__PURE__ */ new Set([
1421
+ "routes",
1422
+ "seo",
1423
+ "a11y",
1424
+ "images",
1425
+ "fields",
1426
+ "relationships"
1427
+ ]);
1408
1428
  const groups = splitList(values);
1409
1429
  for (const group of groups) {
1410
1430
  if (!allowed.has(group)) {
@@ -1730,6 +1750,15 @@ export default defineConfig({
1730
1750
  { type: "pricing", path: "is_available", severity: "warning" },
1731
1751
  ],
1732
1752
  },
1753
+ relationships: [
1754
+ {
1755
+ from: "menu_item",
1756
+ to: "pricing",
1757
+ where: { fromField: "id", toField: "menu_item_id" },
1758
+ min: 1,
1759
+ severity: "warning",
1760
+ },
1761
+ ],
1733
1762
  },
1734
1763
  });
1735
1764
  `;
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  runCli
3
- } from "./chunk-R7T3O3TT.js";
3
+ } from "./chunk-4XXHRNEA.js";
4
4
  export {
5
5
  runCli
6
6
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cms-lab/cli",
3
- "version": "1.2.4",
3
+ "version": "1.2.5",
4
4
  "type": "module",
5
5
  "description": "Catch CMS bugs before deploy.",
6
6
  "license": "MIT",
@@ -47,15 +47,15 @@
47
47
  "dependencies": {
48
48
  "commander": "^14.0.2",
49
49
  "picocolors": "^1.1.1",
50
- "@cms-lab/contentful": "1.2.4",
51
- "@cms-lab/next": "1.2.4",
52
- "@cms-lab/directus": "1.2.4",
53
- "@cms-lab/core": "1.2.4",
54
- "@cms-lab/reporter": "1.2.4",
55
- "@cms-lab/sanity": "1.2.4",
56
- "@cms-lab/prismic": "1.2.4",
57
- "@cms-lab/strapi": "1.2.4",
58
- "@cms-lab/wordpress": "1.2.4"
50
+ "@cms-lab/contentful": "1.2.5",
51
+ "@cms-lab/core": "1.2.5",
52
+ "@cms-lab/directus": "1.2.5",
53
+ "@cms-lab/next": "1.2.5",
54
+ "@cms-lab/prismic": "1.2.5",
55
+ "@cms-lab/reporter": "1.2.5",
56
+ "@cms-lab/sanity": "1.2.5",
57
+ "@cms-lab/strapi": "1.2.5",
58
+ "@cms-lab/wordpress": "1.2.5"
59
59
  },
60
60
  "author": "Afaq Rashid",
61
61
  "scripts": {