@majordigital/create-acorn 1.6.0 → 1.6.2
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 +34 -0
- package/package.json +1 -1
- package/template/scripts/check-links.mjs +17 -2
package/README.md
CHANGED
|
@@ -36,6 +36,35 @@ Every Acorn project ships with a carefully curated stack:
|
|
|
36
36
|
- **SVG-as-components** — Inline SVG imports via `@svgr/webpack` for both Webpack and Turbopack
|
|
37
37
|
- **Bundle Analysis** — `@next/bundle-analyzer` ready to go with `ANALYZE=true`
|
|
38
38
|
|
|
39
|
+
## Pre-Deploy Validation
|
|
40
|
+
|
|
41
|
+
Every Acorn project ships with a built-in pre-deployment validation suite. Run it with the `/pre-deploy` slash command in Claude Code to get a full readiness report before going live.
|
|
42
|
+
|
|
43
|
+
The suite covers 7 phases:
|
|
44
|
+
|
|
45
|
+
1. **Static code checks** — console logs, placeholder analytics IDs, missing favicon, robots.txt, sitemap, metadata, and legal pages
|
|
46
|
+
2. **Browser checks** — screenshots every core page at desktop and mobile viewports using agent-browser
|
|
47
|
+
3. **Lighthouse audit** — mobile + desktop scores across Performance, Accessibility, Best Practices, and SEO
|
|
48
|
+
4. **Broken link check** — crawls the full site and reports every broken internal link
|
|
49
|
+
5. **Cross-browser compatibility** — screenshots across Chromium, Firefox, and WebKit
|
|
50
|
+
6. **Final report** — saves a dated markdown report to `.claude/pre-deployment-result/`
|
|
51
|
+
|
|
52
|
+
Results and screenshots are saved to `.claude/pre-deployment-result/` for review and historical comparison.
|
|
53
|
+
|
|
54
|
+
### Adding pre-deploy to an existing project
|
|
55
|
+
|
|
56
|
+
The suite is included automatically in every new project. If you have an existing acorn project that predates v1.6.0, you can add it without re-running the full setup:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
# Full new project — pre-deploy included automatically
|
|
60
|
+
npx @majordigital/create-acorn@latest
|
|
61
|
+
|
|
62
|
+
# Add pre-deploy to an existing project only
|
|
63
|
+
npx @majordigital/create-acorn@latest --add-pre-deploy
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
The `--add-pre-deploy` flag copies the scripts, installs the dependencies (`lighthouse`, `chrome-launcher`, `playwright`, `linkinator`), and adds the npm scripts to your `package.json`. It skips silently if the tooling is already present.
|
|
67
|
+
|
|
39
68
|
## Acorn Component Architecture
|
|
40
69
|
|
|
41
70
|
The Acorn library follows a layered component hierarchy designed for consistency and reuse across projects:
|
|
@@ -87,6 +116,11 @@ Beyond the component library, every project includes:
|
|
|
87
116
|
| `.env.example` | CMS-specific environment variable template |
|
|
88
117
|
| `.npmrc` | Legacy peer deps for React 19 compatibility |
|
|
89
118
|
| `README.md` | Project-specific documentation based on CMS choice |
|
|
119
|
+
| `scripts/lighthouse-audit.mjs` | Lighthouse audit runner (mobile + desktop, concurrent Chrome workers) |
|
|
120
|
+
| `scripts/cross-browser-check.mjs` | Cross-browser screenshots via Playwright (Chromium, Firefox, WebKit) |
|
|
121
|
+
| `scripts/check-links.mjs` | Broken internal link crawler using linkinator |
|
|
122
|
+
| `scripts/cleanup-screenshots.mjs` | Removes pre-deploy artifacts older than 1 month |
|
|
123
|
+
| `.claude/commands/pre-deploy.md` | `/pre-deploy` slash command for Claude Code |
|
|
90
124
|
|
|
91
125
|
## npm
|
|
92
126
|
|
package/package.json
CHANGED
|
@@ -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,16 +44,19 @@ 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
|
|
54
|
+
concurrency,
|
|
41
55
|
timeout: 30000,
|
|
56
|
+
headers,
|
|
42
57
|
// Skip external links to avoid false positives from rate limiting
|
|
43
58
|
linksToSkip: [
|
|
44
|
-
|
|
59
|
+
`^(?!(${baseUrl.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}))`,
|
|
45
60
|
],
|
|
46
61
|
});
|
|
47
62
|
|