periderm-cli 0.1.62 → 0.1.63

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.
@@ -25,9 +25,9 @@ function isMarketingRoute(rel) {
25
25
  return false;
26
26
  if (/_authenticated|admin|dashboard|api\//.test(rel))
27
27
  return false;
28
- return /(?:^|\/)index\.(tsx|jsx)$/.test(rel)
29
- || /routes\/(?:index|__root)\.(tsx|jsx)$/.test(rel)
30
- || !/_authenticated|admin/.test(rel);
28
+ return (/(?:^|\/)index\.(tsx|jsx)$/.test(rel) ||
29
+ /routes\/(?:index|__root)\.(tsx|jsx)$/.test(rel) ||
30
+ !/_authenticated|admin/.test(rel));
31
31
  }
32
32
  export const SEO_CHECK_COUNT = 5;
33
33
  export async function runSeoChecks(root, files) {
@@ -46,14 +46,19 @@ export async function runSeoChecks(root, files) {
46
46
  routeSources.push({ rel, content });
47
47
  }
48
48
  // ── og:image on public-facing routes ──────────────────────────────────
49
- const socialMetaSource = await readMaybe(path.join(root, "src/lib/social-meta.ts"))
50
- ?? await readMaybe(path.join(root, "src/lib/social-meta.tsx"));
51
- const hasOgImageMeta = (content) => /og:image|property:\s*["']og:image["']/i.test(content)
52
- || (/socialMeta|social-meta/.test(content) && !!socialMetaSource && /og:image/.test(socialMetaSource));
49
+ const socialMetaSource = (await readMaybe(path.join(root, "src/lib/social-meta.ts"))) ??
50
+ (await readMaybe(path.join(root, "src/lib/social-meta.tsx")));
51
+ const hasOgImageMeta = (content) => /og:image|property:\s*["']og:image["']/i.test(content) ||
52
+ (/socialMeta|social-meta/.test(content) &&
53
+ !!socialMetaSource &&
54
+ /og:image/.test(socialMetaSource));
53
55
  const marketingRoutes = routeSources.filter((r) => isMarketingRoute(r.rel));
54
56
  const routesMissingOgImage = marketingRoutes.filter((r) => !hasOgImageMeta(r.content));
55
57
  if (routesMissingOgImage.length > 0) {
56
- const names = routesMissingOgImage.map((r) => r.rel).slice(0, 3).join(", ");
58
+ const names = routesMissingOgImage
59
+ .map((r) => r.rel)
60
+ .slice(0, 3)
61
+ .join(", ");
57
62
  out.push({
58
63
  id: "missing-og-image",
59
64
  category: "SEO & Discoverability",
@@ -62,19 +67,21 @@ export async function runSeoChecks(root, files) {
62
67
  line: 1,
63
68
  message: "Public route(s) missing og:image — link previews will show no image.",
64
69
  why: "When someone shares your URL on Slack, Twitter, or iMessage, it looks broken without a preview image. First impressions matter.",
65
- fix: "Add a 1200×630 og:image (PNG or JPG) to /public, then add { property: \"og:image\", content: \"https://your-domain.com/og.png\" } to the route head().",
70
+ fix: 'Add a 1200×630 og:image (PNG or JPG) to /public, then add { property: "og:image", content: "https://your-domain.com/og.png" } to the route head().',
66
71
  aiPrompt: `In ${names}, add og:image and twitter:card meta tags pointing at a 1200×630 social preview image in /public.`,
67
72
  });
68
73
  }
69
74
  // ── missing critical OG tags on landing pages ──────────────────────────
70
75
  const checkTags = ["og:url", "og:logo", "og:title", "og:description"];
71
76
  for (const tag of checkTags) {
72
- const hasTag = (content) => new RegExp(`(?:${tag}|property:\\s*["']${tag}["'])`, "i").test(content)
73
- || (/socialMeta|social-meta/.test(content) && !!socialMetaSource && new RegExp(tag, "i").test(socialMetaSource));
77
+ const hasTag = (content) => new RegExp(`(?:${tag}|property:\\s*["']${tag}["'])`, "i").test(content) ||
78
+ (/socialMeta|social-meta/.test(content) &&
79
+ !!socialMetaSource &&
80
+ new RegExp(tag, "i").test(socialMetaSource));
74
81
  const missingRoutes = marketingRoutes.filter((r) => !hasTag(r.content));
75
82
  if (missingRoutes.length > 0) {
76
83
  out.push({
77
- id: `missing-${tag.replace(':', '-')}`,
84
+ id: `missing-${tag.replace(":", "-")}`,
78
85
  category: "SEO & Discoverability",
79
86
  severity: "medium",
80
87
  file: missingRoutes[0].rel,
@@ -82,13 +89,16 @@ export async function runSeoChecks(root, files) {
82
89
  message: `Landing page(s) missing ${tag}.`,
83
90
  why: `The ${tag} tag is critical for proper previews and branding when shared on platforms like LinkedIn, Slack, and Twitter.`,
84
91
  fix: `Add <meta property="${tag}" content="..." /> or configure it in your framework's metadata object.`,
85
- aiPrompt: `In ${missingRoutes.slice(0, 3).map(r => r.rel).join(", ")}, add the missing ${tag} meta tag to the page head or metadata object.`,
92
+ aiPrompt: `In ${missingRoutes
93
+ .slice(0, 3)
94
+ .map((r) => r.rel)
95
+ .join(", ")}, add the missing ${tag} meta tag to the page head or metadata object.`,
86
96
  });
87
97
  }
88
98
  }
89
99
  // ── sitemap ───────────────────────────────────────────────────────────
90
- const hasSitemap = (await exists(path.join(root, "public/sitemap.xml")))
91
- || relFiles.some((f) => /sitemap\.(?:xml|ts|tsx|js)$/i.test(f));
100
+ const hasSitemap = (await exists(path.join(root, "public/sitemap.xml"))) ||
101
+ relFiles.some((f) => /sitemap\.(?:xml|ts|tsx|js)$/i.test(f));
92
102
  const hasRobots = await exists(path.join(root, "public/robots.txt"));
93
103
  if (hasRobots && !hasSitemap) {
94
104
  const robots = await readMaybe(path.join(root, "public/robots.txt"));
@@ -13,10 +13,10 @@ export async function walk(root, extraIgnores = []) {
13
13
  "!**/packages/cli/**", // never scan the scanner itself
14
14
  ];
15
15
  // Cloud policy ignores: normalize to negated globs
16
- const cloudIgnoreGlobs = extraIgnores.map((ig) => ig.startsWith("!") ? ig : `!${ig}`);
17
- return fg([
18
- "**/*.{ts,tsx,js,jsx,mjs,cjs,dart,swift}",
19
- ...baseIgnores,
20
- ...cloudIgnoreGlobs,
21
- ], { cwd: root, absolute: true, dot: false });
16
+ const cloudIgnoreGlobs = extraIgnores.map((ig) => (ig.startsWith("!") ? ig : `!${ig}`));
17
+ return fg(["**/*.{ts,tsx,js,jsx,mjs,cjs,dart,swift}", ...baseIgnores, ...cloudIgnoreGlobs], {
18
+ cwd: root,
19
+ absolute: true,
20
+ dot: false,
21
+ });
22
22
  }
@@ -29,7 +29,7 @@ export async function checkUpdate() {
29
29
  clearTimeout(timeoutId);
30
30
  if (!res || !res.ok)
31
31
  return null;
32
- const data = await res.json();
32
+ const data = (await res.json());
33
33
  const latestVersion = data.version;
34
34
  if (!latestVersion || latestVersion === currentVersion)
35
35
  return null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "periderm-cli",
3
- "version": "0.1.62",
3
+ "version": "0.1.63",
4
4
  "description": "Periderm CLI: A pre-launch checklist to catch user-losing bugs, legal liabilities, revenue leaks, runaway cloud bills and so many more before you ship.",
5
5
  "type": "module",
6
6
  "preferGlobal": true,