@majordigital/create-acorn 1.6.1 → 1.6.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@majordigital/create-acorn",
3
- "version": "1.6.1",
3
+ "version": "1.6.3",
4
4
  "description": "Interactive starter CLI for Acorn with Storyblok/Prismic/DatoCMS, TypeScript, and Tailwind.",
5
5
  "bin": {
6
6
  "create-acorn": "bin/create-acorn.mjs",
@@ -21,6 +21,18 @@ const outputDir = process.argv[3] || ".claude/pre-deployment-result";
21
21
 
22
22
  mkdirSync(outputDir, { recursive: true });
23
23
 
24
+ // Lower concurrency for localhost — the Next.js dev server + CMS API calls
25
+ // can't handle many parallel requests and returns 500s under concurrent load.
26
+ const isLocalhost = baseUrl.includes("localhost") || baseUrl.includes("127.0.0.1");
27
+ const concurrency = isLocalhost ? 2 : 5;
28
+
29
+ // Support Netlify Basic Auth (password-protected preview deploys).
30
+ // Set NETLIFY_AUTH=user:password in your environment before running.
31
+ const netlifyAuth = process.env.NETLIFY_AUTH;
32
+ const headers = netlifyAuth
33
+ ? { Authorization: `Basic ${Buffer.from(netlifyAuth).toString("base64")}` }
34
+ : {};
35
+
24
36
  const checker = new LinkChecker();
25
37
 
26
38
  checker.on("link", (result) => {
@@ -32,19 +44,33 @@ checker.on("link", (result) => {
32
44
  });
33
45
 
34
46
  console.log(`Checking links on: ${baseUrl}`);
47
+ if (netlifyAuth) console.log("Using Basic Auth from NETLIFY_AUTH env var");
48
+ console.log(`Concurrency: ${concurrency}`);
35
49
  console.log("This may take several minutes...\n");
36
50
 
37
51
  const result = await checker.check({
38
52
  path: baseUrl,
39
53
  recurse: true,
40
- concurrency: 10,
54
+ concurrency,
41
55
  timeout: 30000,
42
- // Skip external links to avoid false positives from rate limiting
56
+ headers,
43
57
  linksToSkip: [
44
- "^(?!(" + baseUrl.replace(/[.*+?^${}()|[\]\\]/g, "\\$&") + "))",
58
+ // Skip external links to avoid false positives from rate limiting
59
+ `^(?!(${baseUrl.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}))`,
60
+ // Skip multi-filter URLs — the filter UI generates combinatorial links
61
+ // (e.g. ?filter=a%2Cb%2Cc) that cause a crawl explosion. Not real links.
62
+ ".*[?&]filter=.*%2C.*",
45
63
  ],
46
64
  });
47
65
 
66
+ process.on("uncaughtException", (err) => {
67
+ if (err.name === "TimeoutError" || err.name === "AbortError") {
68
+ console.error("\nWarning: crawl timed out — some pages may be slow or unresponsive.");
69
+ process.exit(1);
70
+ }
71
+ throw err;
72
+ });
73
+
48
74
  const broken = result.links.filter((l) => l.state === "BROKEN");
49
75
  const ok = result.links.filter((l) => l.state === "OK");
50
76
  const skipped = result.links.filter((l) => l.state === "SKIPPED");