|
| 1 | +# Performance Scout |
| 2 | + |
| 3 | +A TypeScript CLI tool that discovers UK Shopify sites and tests their performance using Lighthouse. |
| 4 | + |
| 5 | +## Features |
| 6 | + |
| 7 | +- Discovers candidate Shopify sites from a local file OR Serper API |
| 8 | +- Verifies sites are actually Shopify stores |
| 9 | +- Runs Lighthouse performance tests (desktop and mobile) |
| 10 | +- Filters sites below a configurable performance threshold |
| 11 | +- Outputs results as a markdown table |
| 12 | + |
| 13 | +## Setup |
| 14 | + |
| 15 | +### Prerequisites |
| 16 | + |
| 17 | +- Node.js (v18 or higher recommended) |
| 18 | +- npm or yarn |
| 19 | +- Chrome/Chromium (required by Lighthouse) |
| 20 | + |
| 21 | +### Installation |
| 22 | + |
| 23 | +1. Install dependencies: |
| 24 | + |
| 25 | +```bash |
| 26 | +npm install |
| 27 | +``` |
| 28 | + |
| 29 | +2. Set your Serper API key (required only if using `--use-serper`): |
| 30 | + |
| 31 | +```bash |
| 32 | +export SERPER_API_KEY=your_api_key_here |
| 33 | +``` |
| 34 | + |
| 35 | +### Configuration |
| 36 | + |
| 37 | +Edit `config.json` to adjust settings: |
| 38 | + |
| 39 | +- `THRESHOLD`: Performance score threshold (0-100). Sites scoring below this on desktop OR mobile are included in results. Default: 50 |
| 40 | +- `MAX_RESULTS`: Maximum number of results to collect. Default: 10 |
| 41 | + |
| 42 | +### Candidates File |
| 43 | + |
| 44 | +Add domains (one per line) to `candidates.txt`: |
| 45 | + |
| 46 | +``` |
| 47 | +example.co.uk |
| 48 | +shop.example.com |
| 49 | +another-shop.co.uk |
| 50 | +``` |
| 51 | + |
| 52 | +## Usage |
| 53 | + |
| 54 | +### Scan using candidates.txt (default) |
| 55 | + |
| 56 | +```bash |
| 57 | +npm run scan |
| 58 | +``` |
| 59 | + |
| 60 | +### Scan using Serper API |
| 61 | + |
| 62 | +```bash |
| 63 | +npm run scan:serper |
| 64 | +``` |
| 65 | + |
| 66 | +Or with the flag directly: |
| 67 | + |
| 68 | +```bash |
| 69 | +npm run scan -- --use-serper |
| 70 | +``` |
| 71 | + |
| 72 | +The tool will: |
| 73 | + |
| 74 | +1. Load candidates from either `candidates.txt` (default) or Serper API (if `--use-serper` flag is used) |
| 75 | +2. Verify each candidate is a Shopify site |
| 76 | +3. Run Lighthouse tests (desktop and mobile) on verified sites |
| 77 | +4. Keep only sites scoring below the threshold |
| 78 | +5. Stop after finding `MAX_RESULTS` qualifying sites |
| 79 | +6. Output a markdown table to `results.md` and console |
| 80 | + |
| 81 | +## Output |
| 82 | + |
| 83 | +Results are saved to `results.md` in the following format: |
| 84 | + |
| 85 | +| Site | Desktop Perf | Mobile Perf | |
| 86 | +| ---------------- | ------------ | ----------- | |
| 87 | +| example.co.uk | 45 | 38 | |
| 88 | +| shop.example.com | 52 | 41 | |
| 89 | + |
| 90 | +Performance scores range from 0-100, where higher is better. |
| 91 | + |
| 92 | +## Notes |
| 93 | + |
| 94 | +- Built with TypeScript and runs using tsx (no build step required) |
| 95 | +- Serper API results are cached in `.serper-cache.json` to avoid repeated API calls |
| 96 | +- Lighthouse tests can take 30-60 seconds per site |
| 97 | +- Sites that cannot be reached or verified as Shopify stores are skipped |
| 98 | +- If fewer than `MAX_RESULTS` qualifying sites are found, the tool outputs what it has |
0 commit comments