heroshot 0.2.0 → 0.4.0

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 CHANGED
@@ -5,18 +5,43 @@
5
5
  <h1 align="center">heroshot</h1>
6
6
 
7
7
  <p align="center">
8
- <strong>Screenshots that stay true.</strong><br>
9
- Your UI evolves. Heroshot keeps your docs and marketing in sync - automatically.
8
+ <a href="https://www.npmjs.com/package/heroshot"><img src="https://img.shields.io/npm/v/heroshot?style=for-the-badge&logo=npm" alt="npm version"></a>
9
+ <a href="https://github.com/omachala/heroshot/blob/main/LICENSE"><img src="https://img.shields.io/npm/l/heroshot?style=for-the-badge" alt="license"></a>
10
+ <a href="https://codecov.io/gh/omachala/heroshot"><img src="https://img.shields.io/codecov/c/github/omachala/heroshot?style=for-the-badge" alt="coverage"></a>
11
+ <a href="https://sonarcloud.io/summary/new_code?id=omachala_heroshot"><img src="https://img.shields.io/sonar/quality_gate/omachala_heroshot?server=https%3A%2F%2Fsonarcloud.io&style=for-the-badge&logo=sonarcloud" alt="quality gate"></a>
12
+ <a href="https://heroshot.sh"><img src="https://img.shields.io/badge/docs-heroshot.sh-blue?style=for-the-badge" alt="docs"></a>
10
13
  </p>
11
14
 
12
- <p align="center">
13
- <a href="https://www.npmjs.com/package/heroshot"><img src="https://img.shields.io/npm/v/heroshot" alt="npm"></a>
14
- <a href="https://heroshot.sh"><img src="https://img.shields.io/badge/docs-heroshot.sh-blue" alt="docs"></a>
15
- </p>
16
-
17
- <p align="center">
18
- <img src="https://github.com/omachala/heroshot/blob/main/toolbar/tests/snapshots/manage-screenshots.test.ts/after-rename.png?raw=true" alt="heroshot toolbar demo" width="800">
19
- </p>
15
+ Your app changes constantly. New features, design tweaks, bug fixes. Meanwhile, the screenshots in your README and docs quietly become lies.
16
+
17
+ The manual fix is tedious: open browser, navigate, log in, screenshot, crop, save, commit. Now do that for every image. Now do it again next month.
18
+
19
+ **Heroshot fixes this.** Define your screenshots once - point and click, no CSS selectors - and regenerate them with one command whenever you need.
20
+
21
+ <table align="center">
22
+ <tr>
23
+ <th></th>
24
+ <th>Light</th>
25
+ <th>Dark</th>
26
+ </tr>
27
+ <tr>
28
+ <th>Desktop</th>
29
+ <td><img src="https://github.com/omachala/heroshot/blob/main/docs/public/screenshots/hero-desktop-light.png?raw=true" alt="Desktop Light"></td>
30
+ <td><img src="https://github.com/omachala/heroshot/blob/main/docs/public/screenshots/hero-desktop-dark.png?raw=true" alt="Desktop Dark"></td>
31
+ </tr>
32
+ <tr>
33
+ <th>Tablet</th>
34
+ <td><img src="https://github.com/omachala/heroshot/blob/main/docs/public/screenshots/hero-tablet-light.png?raw=true" alt="Tablet Light"></td>
35
+ <td><img src="https://github.com/omachala/heroshot/blob/main/docs/public/screenshots/hero-tablet-dark.png?raw=true" alt="Tablet Dark"></td>
36
+ </tr>
37
+ <tr>
38
+ <th>Mobile</th>
39
+ <td><img src="https://github.com/omachala/heroshot/blob/main/docs/public/screenshots/hero-mobile-light.png?raw=true" alt="Mobile Light"></td>
40
+ <td><img src="https://github.com/omachala/heroshot/blob/main/docs/public/screenshots/hero-mobile-dark.png?raw=true" alt="Mobile Dark"></td>
41
+ </tr>
42
+ </table>
43
+
44
+ <p align="center"><em>6 screenshots from one config entry - always in sync with the live site.</em></p>
20
45
 
21
46
  ## Get Started
22
47
 
@@ -24,51 +49,40 @@
24
49
  npx heroshot
25
50
  ```
26
51
 
27
- **First run** opens an interactive browser:
52
+ That's it. First time, a browser opens with a visual picker. Navigate to your app, click on elements you want to capture, name them, close when done.
28
53
 
29
- 1. Navigate to any URL
30
- 2. Click on elements you want to screenshot
31
- 3. Name your screenshots and adjust settings
32
- 4. Close the browser when done
54
+ Your screenshots land in `heroshots/` and a config is saved to `.heroshot/config.json`.
33
55
 
34
- **Subsequent runs** regenerate all screenshots headlessly:
35
-
36
- ```bash
37
- npx heroshot
38
- ```
56
+ Next time you run `npx heroshot`, it regenerates everything headlessly. No browser, no clicking - just fresh screenshots.
39
57
 
40
- **Reconfigure** anytime by running:
58
+ ## What Makes It Useful
41
59
 
42
- ```bash
43
- npx heroshot config
44
- ```
60
+ **Point and click, not CSS selectors.** The visual picker figures out how to find elements. You just click what you want.
45
61
 
46
- ## Why heroshot?
62
+ **Light and dark mode in one go.** If your site has themes, heroshot captures both variants automatically. One config, two screenshots.
47
63
 
48
- Heroshot automates **documentation screenshots** - not visual regression testing. Define once, generate everywhere.
64
+ **Desktop, tablet, mobile from one definition.** Add `"viewports": ["desktop", "tablet", "mobile"]` and get all three sizes. Combined with both color schemes, that's 6 screenshots from one entry.
49
65
 
50
- **The math:** 3 components × 5 pages × 3 viewports × 2 color schemes = **90 screenshots** from one config.
66
+ **Log in once, capture forever.** First time, log into your app manually. Heroshot encrypts and saves your session. Headless runs are already authenticated - no login scripts needed.
51
67
 
52
- - **Visual picker** - Point and click to select elements, no DevTools needed
53
- - **Viewport variants** - Desktop, tablet, mobile from a single definition
54
- - **Light & Dark mode** - Both color schemes captured automatically
55
- - **Pixel-perfect** - Element-precise capture with masked padding
56
- - **One command** - Regenerate all screenshots when your UI changes
57
- - **CI ready** - Automate updates with encrypted session support
68
+ **CI-ready.** Export your session key, add it to GitHub secrets, run `heroshot` in a workflow. Screenshots update automatically.
58
69
 
59
70
  ## Automated Updates
60
71
 
61
- Run heroshot in CI to keep screenshots always current. See the [full guide](https://heroshot.sh/guide/automated-updates).
72
+ Keep screenshots always current by running heroshot in CI. Quick setup:
62
73
 
63
- **Quick setup:**
74
+ ```bash
75
+ # Get your session key (for authenticated sites)
76
+ npx heroshot session-key
77
+
78
+ # Add to GitHub secrets
79
+ gh secret set HEROSHOT_SESSION_KEY
80
+ ```
64
81
 
65
- 1. Get your session key: `npx heroshot session-key`
66
- 2. Add as GitHub secret: `gh secret set HEROSHOT_SESSION_KEY`
67
- 3. Create workflow:
82
+ Then create `.github/workflows/heroshot.yml`:
68
83
 
69
84
  ```yaml
70
- # .github/workflows/heroshot.yaml
71
- name: Heroshot
85
+ name: Update Screenshots
72
86
 
73
87
  on:
74
88
  workflow_dispatch:
@@ -81,7 +95,9 @@ jobs:
81
95
  - uses: actions/setup-node@v4
82
96
  with:
83
97
  node-version: 20
84
- - run: npx heroshot --session-key=${{ secrets.HEROSHOT_SESSION_KEY }}
98
+ - run: npx heroshot
99
+ env:
100
+ HEROSHOT_SESSION_KEY: ${{ secrets.HEROSHOT_SESSION_KEY }}
85
101
  - run: |
86
102
  git config user.name "github-actions[bot]"
87
103
  git config user.email "github-actions[bot]@users.noreply.github.com"
@@ -89,12 +105,16 @@ jobs:
89
105
  git diff --staged --quiet || git commit -m "chore: update screenshots" && git push
90
106
  ```
91
107
 
92
- ---
108
+ Go to Actions → Update Screenshots → Run workflow. Done.
93
109
 
94
- **Status:** Early alpha. [See releases](https://github.com/omachala/heroshot/releases) for current version.
110
+ For more options (scheduled runs, PR creation, debugging), see the [full CI guide](https://heroshot.sh/docs/guide/automated-updates).
111
+
112
+ ## Learn More
95
113
 
96
114
  **Docs:** [heroshot.sh](https://heroshot.sh)
97
115
 
116
+ **Status:** Early alpha. [See releases](https://github.com/omachala/heroshot/releases) for current version.
117
+
98
118
  ## License
99
119
 
100
120
  MIT