@se-studio/skills 1.0.3 → 1.0.4
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/CHANGELOG.md +6 -0
- package/package.json +1 -1
- package/skills/performance-audit/SKILL.md +43 -38
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -117,39 +117,44 @@ Large client-only packages here inflate server cold-start time. Check for missin
|
|
|
117
117
|
| 20.19+ or 22+ | `lighthouse@13` |
|
|
118
118
|
|
|
119
119
|
Chrome path:
|
|
120
|
-
- Linux / WSL: `/usr/bin/google-chrome`
|
|
120
|
+
- Linux / WSL: `google-chrome-stable` (binary is `/usr/bin/google-chrome-stable`)
|
|
121
121
|
- macOS: Lighthouse finds it automatically
|
|
122
122
|
|
|
123
123
|
### Run against key page types
|
|
124
124
|
|
|
125
|
-
|
|
125
|
+
Use the script-based approach. It spawns one Chrome instance, audits all pages, then prints a delta table vs the previous run.
|
|
126
|
+
|
|
127
|
+
**Setup — copy the script template:**
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
mkdir -p scripts
|
|
131
|
+
cp node_modules/@se-studio/skills/skills/performance-audit/lighthouse.ts scripts/lighthouse.ts
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
Or copy from `apps/example-se2026/scripts/lighthouse.ts` in the se-core-product monorepo if you have it available.
|
|
135
|
+
|
|
136
|
+
**Customise `PAGES` for the project** — edit the `PAGES` array near the top of the script. Choose representative pages: homepage, a list/index page, and a detail page. Use the sitemap to identify good candidates:
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
curl -s <SITE_URL>/sitemap.xml | grep -oP 'https://[^<]+'
|
|
140
|
+
# or for this stack:
|
|
141
|
+
curl -s <SITE_URL>/marketing/sitemap.xml | grep -oP 'https://[^<]+'
|
|
142
|
+
curl -s <SITE_URL>/marketing/sitemap-unindexed.xml | grep -oP 'https://[^<]+'
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
**Install dependencies (if not present):**
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
pnpm add -D lighthouse tsx
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
**Run:**
|
|
126
152
|
|
|
127
153
|
```bash
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
# Homepage
|
|
131
|
-
npx lighthouse@12 <SITE_URL>/ \
|
|
132
|
-
--chrome-path /usr/bin/google-chrome \
|
|
133
|
-
--chrome-flags="--headless=new --no-sandbox --disable-gpu --disable-dev-shm-usage" \
|
|
134
|
-
--only-categories=performance,accessibility,best-practices,seo \
|
|
135
|
-
--output json --output-path .lighthouse/home.json --quiet
|
|
136
|
-
|
|
137
|
-
# A list or index page
|
|
138
|
-
npx lighthouse@12 <SITE_URL>/blog/ \
|
|
139
|
-
--chrome-path /usr/bin/google-chrome \
|
|
140
|
-
--chrome-flags="--headless=new --no-sandbox --disable-gpu --disable-dev-shm-usage" \
|
|
141
|
-
--only-categories=performance,accessibility,best-practices,seo \
|
|
142
|
-
--output json --output-path .lighthouse/list.json --quiet
|
|
143
|
-
|
|
144
|
-
# A detail page (pick a URL from the sitemap)
|
|
145
|
-
npx lighthouse@12 <DETAIL_URL> \
|
|
146
|
-
--chrome-path /usr/bin/google-chrome \
|
|
147
|
-
--chrome-flags="--headless=new --no-sandbox --disable-gpu --disable-dev-shm-usage" \
|
|
148
|
-
--only-categories=performance,accessibility,best-practices,seo \
|
|
149
|
-
--output json --output-path .lighthouse/detail.json --quiet
|
|
154
|
+
npx tsx scripts/lighthouse.ts
|
|
150
155
|
```
|
|
151
156
|
|
|
152
|
-
|
|
157
|
+
The script writes JSON to `.lighthouse/<page>.json`, overwrites each run, and prints a delta table showing score changes vs the previous run.
|
|
153
158
|
|
|
154
159
|
### Extract scores from JSON
|
|
155
160
|
|
|
@@ -309,21 +314,20 @@ Verify audience browser share before applying — check analytics for any legacy
|
|
|
309
314
|
|
|
310
315
|
## Tracking baselines
|
|
311
316
|
|
|
312
|
-
|
|
317
|
+
The script shows score deltas automatically each run — no separate comparison script needed. The delta column (`▲`/`▼`/`·`) reflects the difference from the JSON that existed before the run started.
|
|
313
318
|
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
const lcp = a => (a.audits['largest-contentful-paint'].numericValue/1000).toFixed(2)+'s';
|
|
320
|
-
const perf = a => Math.round(a.categories.performance.score * 100);
|
|
321
|
-
console.log('Home LCP: v1=' + lcp(v1) + ' → v2=' + lcp(v2));
|
|
322
|
-
console.log('Home Perf: v1=' + perf(v1) + ' → v2=' + perf(v2));
|
|
323
|
-
"
|
|
319
|
+
Add `.lighthouse/` to `.gitignore` — committing it adds large JSON files that the script already overwrites each run:
|
|
320
|
+
|
|
321
|
+
```
|
|
322
|
+
# .gitignore
|
|
323
|
+
.lighthouse/
|
|
324
324
|
```
|
|
325
325
|
|
|
326
|
-
|
|
326
|
+
To preserve a snapshot before a major deploy, copy it manually:
|
|
327
|
+
|
|
328
|
+
```bash
|
|
329
|
+
cp -r .lighthouse .lighthouse-pre-deploy
|
|
330
|
+
```
|
|
327
331
|
|
|
328
332
|
---
|
|
329
333
|
|
|
@@ -331,7 +335,8 @@ Commit `.lighthouse/` to git for team-visible historical baselines.
|
|
|
331
335
|
|
|
332
336
|
| Error | Cause | Fix |
|
|
333
337
|
|---|---|---|
|
|
334
|
-
| `
|
|
338
|
+
| `tcp_socket_win.cc: bind() … Only one usage of each socket address` or Chrome fails to start in WSL | WSL PATH resolves the **Windows** Chrome binary, which spawns as a Windows process and can't bind the DevTools port — passing `--chrome-path` to a one-shot `npx lighthouse` call doesn't help | Use the script approach: spawn `google-chrome-stable` (Linux binary) directly with `--no-sandbox --remote-debugging-port=9222`, then connect Lighthouse via `--port=9222` (see the script template above) |
|
|
339
|
+
| `Unable to connect to Chrome` (non-WSL) | Lighthouse can't find Chrome binary | Set `CHROME_BIN` in the script to the correct binary path |
|
|
335
340
|
| Lighthouse fails on Node 20.18.x | Requires lighthouse@12 | Use `npm i -g lighthouse@12` |
|
|
336
341
|
| `ANALYZE=true next build` fails | `next.config.ts` export not wrapped | Ensure `export default withBundleAnalyzer(nextConfig)` |
|
|
337
342
|
| Speed Insights shows no data | Wrong layout, or not deployed to production | Must be in root `src/app/layout.tsx`; requires production traffic |
|