@scrymore/scry-deployer 0.6.1 → 0.7.0-next.20260926193255
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 +118 -65
- package/bin/cli.js +304 -48
- package/lib/config.js +11 -3
- package/lib/coverage.js +220 -11
- package/lib/metadataArchive.js +135 -0
- package/lib/telemetry.js +0 -67
- package/lib/templates.js +93 -50
- package/lib/update-workflows.js +8 -5
- package/lib/versionCheck.js +112 -0
- package/package.json +1 -1
- package/scripts/regenerate-workflow-templates.js +23 -0
package/README.md
CHANGED
|
@@ -2,31 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Deploy your Storybook to the cloud with one command. ⚡
|
|
4
4
|
|
|
5
|
-
##
|
|
6
|
-
|
|
7
|
-
From your application's repository, install the Scry setup skill:
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
npx skills add epinnock/scry-node --skill scry-setup
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
The current installer requires Node.js 22.20 or newer. Choose your assistant
|
|
14
|
-
(Claude Code, Codex, Cursor, or another compatible agent), then ask:
|
|
15
|
-
**“Set up Scry for this project and connect my assistant to its components.”**
|
|
16
|
-
|
|
17
|
-
The skill handles deployment configuration, GitHub Actions, component indexing,
|
|
18
|
-
MCP connections, and optional Figma linking. You can also ask for MCP alone.
|
|
19
|
-
Complete account sign-in in your browser and keep API keys in your environment
|
|
20
|
-
or CI secret store.
|
|
21
|
-
|
|
22
|
-
See the [setup guide](https://docs.scrymore.com/guide/skill) for installation
|
|
23
|
-
options, or inspect the [skill instructions](skills/scry-setup/SKILL.md).
|
|
24
|
-
|
|
25
|
-
## Set up directly with the CLI
|
|
26
|
-
|
|
27
|
-
`init` writes configuration and workflows, configures GitHub secrets, then
|
|
28
|
-
commits and pushes. For local preparation before publishing, use the skill or
|
|
29
|
-
the manual deployment path below. `--skip-gh-setup` still commits and pushes.
|
|
5
|
+
## 🎯 Quick Start (5 seconds)
|
|
30
6
|
|
|
31
7
|
### 1. Get your credentials
|
|
32
8
|
Visit the [Scry Dashboard](https://dashboard.scrymore.com) and:
|
|
@@ -102,7 +78,7 @@ This deploys your Storybook immediately without setting up GitHub Actions.
|
|
|
102
78
|
npx @scrymore/scry-deployer init --projectId xxx --apiKey yyy
|
|
103
79
|
|
|
104
80
|
# From GitHub (latest from main branch)
|
|
105
|
-
npx github:
|
|
81
|
+
npx github:scryorg/scry-node init --projectId xxx --apiKey yyy
|
|
106
82
|
```
|
|
107
83
|
|
|
108
84
|
### Installing as a Dependency
|
|
@@ -114,18 +90,18 @@ If you prefer to install it as a development dependency:
|
|
|
114
90
|
npm install @scrymore/scry-deployer --save-dev
|
|
115
91
|
|
|
116
92
|
# From GitHub
|
|
117
|
-
npm install github:
|
|
93
|
+
npm install github:scryorg/scry-node --save-dev
|
|
118
94
|
# or
|
|
119
|
-
pnpm add github:
|
|
95
|
+
pnpm add github:scryorg/scry-node -D
|
|
120
96
|
# or
|
|
121
|
-
yarn add github:
|
|
97
|
+
yarn add github:scryorg/scry-node --dev
|
|
122
98
|
```
|
|
123
99
|
|
|
124
100
|
After installation, you can run commands using:
|
|
125
101
|
|
|
126
102
|
```bash
|
|
127
|
-
# Using the
|
|
128
|
-
|
|
103
|
+
# Using the storybook-deployer binary
|
|
104
|
+
npx storybook-deployer init --projectId xxx --apiKey yyy
|
|
129
105
|
|
|
130
106
|
# Using the scry alias
|
|
131
107
|
npx scry init --projectId xxx --apiKey yyy
|
|
@@ -205,17 +181,50 @@ The CLI is configured through a combination of command-line options and environm
|
|
|
205
181
|
|----------------|---------------------------------------|--------------------------------------------------------------|----------|--------------------------------------|
|
|
206
182
|
| `--dir` | `STORYBOOK_DEPLOYER_DIR` | Path to the built Storybook directory (e.g., `storybook-static`). | Yes | - |
|
|
207
183
|
| `--api-key` | `STORYBOOK_DEPLOYER_API_KEY` | The API key for the deployment service. | No | - |
|
|
208
|
-
| `--api-url` | `STORYBOOK_DEPLOYER_API_URL` | Base URL for the deployment service API. | No | `https://
|
|
184
|
+
| `--api-url` | `STORYBOOK_DEPLOYER_API_URL` | Base URL for the deployment service API. | No | `https://storybook-deployment-service.epinnock.workers.dev` |
|
|
209
185
|
| `--project` | `STORYBOOK_DEPLOYER_PROJECT` | The project name/identifier. | No | `main` |
|
|
210
186
|
| `--version` | `STORYBOOK_DEPLOYER_VERSION` | The version identifier for the deployment. | No | `latest` |
|
|
211
|
-
| `--with-analysis` | `STORYBOOK_DEPLOYER_WITH_ANALYSIS` |
|
|
187
|
+
| `--with-analysis` | `STORYBOOK_DEPLOYER_WITH_ANALYSIS` / `SCRY_WITH_ANALYSIS` | Capture screenshots and metadata so components are searchable. **On by default since 0.7.0.** | No | on |
|
|
188
|
+
| `--no-analysis` | `STORYBOOK_DEPLOYER_ANALYSIS=false` | Host the Storybook without indexing it. The log says the build is NOT searchable. | No | - |
|
|
189
|
+
| `--max-dropped` | `SCRY_MAX_DROPPED` (or `maxDropped` in `.storybook-deployer.json`) | How many stories may fail to capture before the deploy ends red. The deployer always passes it to scry-sbcov (0.5.2+); the stories that did capture are uploaded and queued first. | No | `0`: any dropped story ends the deploy red |
|
|
212
190
|
| `--stories-dir` | `STORYBOOK_DEPLOYER_STORIES_DIR` | Path to stories directory (optional, auto-detects .stories.* files). | No | Auto-detect |
|
|
213
191
|
| `--screenshots-dir` | `STORYBOOK_DEPLOYER_SCREENSHOTS_DIR` | Directory for captured screenshots. | No | `./screenshots` |
|
|
214
192
|
| `--storybook-url` | `STORYBOOK_DEPLOYER_STORYBOOK_URL` | URL of running Storybook server for screenshot capture. | No | `http://localhost:6006` |
|
|
193
|
+
| `--capture-mode` | `SCRY_CAPTURE_MODE` | Screenshot framing forwarded to scry-sbcov: `root` (crop to the component) or `viewport`. | No | unset: sbcov decides (`root` from sbcov 0.6) |
|
|
194
|
+
| `--capture-scale` | `SCRY_CAPTURE_SCALE` | Screenshot device scale factor forwarded to scry-sbcov, `0 < n <= 4`. | No | unset: sbcov decides (`2` from sbcov 0.6) |
|
|
195
|
+
| `--capture-viewport` | `SCRY_CAPTURE_VIEWPORT` | Browser viewport `WIDTHxHEIGHT` forwarded to scry-sbcov. | No | unset: sbcov decides (`1280x720`) |
|
|
215
196
|
| `--verbose` | `STORYBOOK_DEPLOYER_VERBOSE` | Enable verbose logging for debugging purposes. | No | `false` |
|
|
197
|
+
| - | `SCRY_NO_UPDATE_CHECK=1` | Skip the check against npm `latest` (a one-line warning when this deployer is older; 2 s limit, never fails the deploy). | No | check on |
|
|
216
198
|
| `--help`, `-h` | - | Show the help message. | - | - |
|
|
217
199
|
| `--version`, `-v`| - | Show the version number. | - | - |
|
|
218
200
|
|
|
201
|
+
### Exit codes and indexing (0.7.0)
|
|
202
|
+
|
|
203
|
+
A deploy that was asked to index and will index nothing ends **red**. The Storybook is still
|
|
204
|
+
uploaded and hosted in every case below, so the preview link works; the red run is the signal.
|
|
205
|
+
|
|
206
|
+
| What happened | Log line | Exit code |
|
|
207
|
+
|---|---|---|
|
|
208
|
+
| Stories captured, metadata uploaded and queued | `⏳ Indexing has been queued, not finished.` | 0 |
|
|
209
|
+
| Metadata upload rejected by the service | `❌ The metadata upload failed (<reason>), so NOTHING WILL BE INDEXED.` | 1 |
|
|
210
|
+
| Metadata uploaded but not queued | `❌ Metadata was uploaded but not queued for processing, so NOTHING WILL BE INDEXED.` | 1 |
|
|
211
|
+
| Analysis captured 0 stories (the empty archive is not uploaded, no build is queued) | `❌ Analysis captured 0 of N stories, so NOTHING WILL BE INDEXED.` plus the first capture error | 1 |
|
|
212
|
+
| Analysis produced no archive (for example, no Playwright browser) | `❌ Analysis produced no metadata, so NOTHING WILL BE INDEXED.` | 1 |
|
|
213
|
+
| scry-sbcov exited non-zero but wrote an archive (exit 3: more stories dropped than `--max-dropped`, default 0) | the archive is queued, then `❌ scry-sbcov dropped more stories than --max-dropped allows (exit 3)…` and `N of M stories were not captured (timeout 40, …)` | 1 |
|
|
214
|
+
| scry-sbcov exited 0 but its `sbcov-manifest.json` lists more dropped stories than `--max-dropped` allows | the archive is queued, then `❌ N of M stories were not captured (…), more than --max-dropped K allows.` | 1 |
|
|
215
|
+
| Some stories dropped, within `--max-dropped` | `scry-sbcov: 417/461 stories captured, 44 not captured (timeout 40, render error 4).` then the queued line | 0 |
|
|
216
|
+
| scry-sbcov exited non-zero with no archive (exit 2: broken capture config) | `❌ Analysis produced no metadata…` with `Cause: scry-sbcov rejected the capture config (exit 2)` | 1 |
|
|
217
|
+
| `--no-analysis` (or `--no-coverage` / `--coverage-report <file>` without `--with-analysis`) | `ℹ️ Analysis skipped (--no-analysis): this build is hosted but NOT searchable.` | 0 |
|
|
218
|
+
| Any error before the upload (bad `--dir`, bad API key, invalid flag) | `❌ Error: …` | 1 |
|
|
219
|
+
|
|
220
|
+
scry-sbcov's own exit codes (0.5.2+): **0** ok, **2** the capture config is broken, misspelt or
|
|
221
|
+
unknown (no archive), **3** more stories dropped than `--max-dropped` (archive of the rest written).
|
|
222
|
+
The deployer passes `--max-dropped 0` unless you set a value; with a scry-sbcov older than 0.5.2,
|
|
223
|
+
which does not know the flag, it is not passed and the log says dropped stories cannot be counted.
|
|
224
|
+
|
|
225
|
+
Before 0.7.0 the metadata-upload failure, the "not queued" case, an empty archive, a non-zero
|
|
226
|
+
scry-sbcov exit and a workflow that simply forgot `--with-analysis` all ended green (ISSUES.md #50).
|
|
227
|
+
|
|
219
228
|
### Story File Auto-Detection
|
|
220
229
|
|
|
221
230
|
The analysis feature now automatically detects `.stories.*` files anywhere in your project! You no longer need to specify a stories directory - the system intelligently searches for story files with these features:
|
|
@@ -284,6 +293,15 @@ The configuration file (`.storybook-deployer.json`) is automatically created in
|
|
|
284
293
|
- `project` → `--project` CLI option
|
|
285
294
|
- `version` → `--version` CLI option
|
|
286
295
|
- `verbose` → `--verbose` CLI option
|
|
296
|
+
- `captureMode` → `--capture-mode` CLI option
|
|
297
|
+
- `captureScale` → `--capture-scale` CLI option
|
|
298
|
+
- `captureViewport` → `--capture-viewport` CLI option (`"390x844"` or `{ "width": 390, "height": 844 }`)
|
|
299
|
+
|
|
300
|
+
**Screenshot capture settings.** `captureMode`, `captureScale` and `captureViewport` are validated and passed to
|
|
301
|
+
scry-sbcov as `--capture-mode`, `--capture-scale` and `--capture-viewport`. Only the ones you set are passed, so
|
|
302
|
+
leaving them out keeps sbcov's defaults and any `scry-sbcov.config.*` in your project in charge. An invalid value
|
|
303
|
+
fails the run. To keep whole-window 1x screenshots, set `"captureMode": "viewport", "captureScale": 1`. For
|
|
304
|
+
`root` mode, mark the component with `data-scry-root` (see the scry-sbcov README, "Capture settings").
|
|
287
305
|
|
|
288
306
|
**See [`.storybook-deployer.example.json`](.storybook-deployer.example.json) for a complete configuration file with all available options and their default values.**
|
|
289
307
|
|
|
@@ -371,40 +389,61 @@ Without analysis, only the static site is zipped and uploaded as `{project}-{ver
|
|
|
371
389
|
|
|
372
390
|
## Example CI/CD Integration (GitHub Actions)
|
|
373
391
|
|
|
374
|
-
|
|
392
|
+
Let the deployer write the workflows for you (`init` for a new project, `update-workflows` to
|
|
393
|
+
refresh existing ones; see below). The steps it generates, after your Storybook is built:
|
|
375
394
|
|
|
376
|
-
**Basic deployment workflow:**
|
|
377
395
|
```yaml
|
|
378
|
-
- name:
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
- name:
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
396
|
+
- name: Install the Scry deployer
|
|
397
|
+
id: scry
|
|
398
|
+
# Its own folder and a floor of ^0.7.0: the repo's own pin cannot pick an older deployer.
|
|
399
|
+
run: |
|
|
400
|
+
set -o pipefail
|
|
401
|
+
mkdir -p "$RUNNER_TEMP/scry"
|
|
402
|
+
npm i --no-save --no-audit --no-fund --ignore-scripts --prefix "$RUNNER_TEMP/scry" @scrymore/scry-deployer@^0.7.0
|
|
403
|
+
cd "$RUNNER_TEMP/scry"
|
|
404
|
+
echo "version=$(node -p "require('@scrymore/scry-deployer/package.json').version")" >> "$GITHUB_OUTPUT"
|
|
405
|
+
PW="$(npx --no-install playwright --version | awk '{print $2}')"
|
|
406
|
+
[ -n "$PW" ] || { echo "::error::the deployer's Playwright was not found"; exit 1; }
|
|
407
|
+
echo "playwright=$PW" >> "$GITHUB_OUTPUT"
|
|
408
|
+
|
|
409
|
+
- name: Cache the deployer's Playwright browser
|
|
410
|
+
uses: actions/cache@v4
|
|
411
|
+
with:
|
|
412
|
+
path: ~/.cache/ms-playwright
|
|
413
|
+
key: scry-pw-${{ runner.os }}-${{ steps.scry.outputs.playwright }}
|
|
414
|
+
|
|
415
|
+
- name: Install the deployer's Playwright browser
|
|
416
|
+
working-directory: ${{ runner.temp }}/scry
|
|
417
|
+
run: npx --no-install playwright install --with-deps chromium-headless-shell
|
|
418
|
+
|
|
419
|
+
- name: Deploy to Scry
|
|
399
420
|
run: |
|
|
400
|
-
|
|
421
|
+
"$RUNNER_TEMP/scry/node_modules/.bin/scry-deployer" \
|
|
401
422
|
--dir ./storybook-static \
|
|
402
423
|
--with-analysis \
|
|
403
|
-
--
|
|
404
|
-
|
|
424
|
+
--coverage-base ${{ vars.SCRY_COVERAGE_BASE || github.event.before }}
|
|
425
|
+
env:
|
|
426
|
+
STORYBOOK_DEPLOYER_API_URL: ${{ vars.SCRY_API_URL }}
|
|
427
|
+
STORYBOOK_DEPLOYER_PROJECT: ${{ vars.SCRY_PROJECT_ID }}
|
|
428
|
+
STORYBOOK_DEPLOYER_API_KEY: ${{ secrets.SCRY_API_KEY }}
|
|
429
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
405
430
|
```
|
|
406
431
|
|
|
407
|
-
|
|
432
|
+
Why these steps and in this order:
|
|
433
|
+
|
|
434
|
+
- **The deployer goes into its own folder** (`$RUNNER_TEMP/scry`), so a version pinned in your
|
|
435
|
+
`package.json` or lockfile cannot select an old deployer, and a pnpm or yarn `node_modules`
|
|
436
|
+
is never touched. The same steps work for npm, pnpm, yarn and bun projects.
|
|
437
|
+
- **The browser comes from the deployer's own Playwright**, installed after the deployer.
|
|
438
|
+
A bare `npx playwright install` resolves whatever Playwright is newest (or your project's)
|
|
439
|
+
and can download a browser build the analyzer does not look for; every story then fails
|
|
440
|
+
and nothing is indexed.
|
|
441
|
+
- **Never call a bare `npx @scrymore/scry-deployer`** in CI: it runs whatever version your
|
|
442
|
+
repository pins, however old.
|
|
443
|
+
|
|
444
|
+
The full generated files are in [`templates/workflows/`](templates/workflows/). The PR
|
|
445
|
+
workflow also skips draft PRs, deploys when a PR is marked ready, and cancels a superseded run
|
|
446
|
+
for the same PR.
|
|
408
447
|
|
|
409
448
|
### PR Preview Deployments
|
|
410
449
|
|
|
@@ -450,12 +489,12 @@ If you're installing from GitHub, the workflow file is already included.
|
|
|
450
489
|
| Variable Name | Value | Example |
|
|
451
490
|
|--------------|-------|---------|
|
|
452
491
|
| `SCRY_PROJECT_ID` | Your project identifier | `my-storybook` or `company-design-system` |
|
|
453
|
-
| `SCRY_API_URL` | Backend API endpoint for uploads | `https://
|
|
492
|
+
| `SCRY_API_URL` | Backend API endpoint for uploads (the upload service) | `https://storybook-deployment-service.epinnock.workers.dev` |
|
|
454
493
|
| `SCRY_VIEW_URL` | Base URL where users view deployed Storybooks | `https://view.scrymore.com` |
|
|
455
494
|
|
|
456
495
|
**Note:** The `SCRY_VIEW_URL` is where users will access your deployed Storybook (e.g., `https://view.scrymore.com/{project}/pr-{number}/`). This is separate from `SCRY_API_URL`, which is the backend API endpoint used for uploads.
|
|
457
496
|
|
|
458
|
-
**Note:** Generated workflows
|
|
497
|
+
**Note:** Generated workflows pass `--with-analysis`, and since 0.7.0 analysis is on by default anyway. A deploy that indexes nothing ends red (see "Exit codes and indexing"). To host a Storybook without indexing it, change the flag to `--no-analysis`. Any story that fails to capture ends the deploy red (after the rest are queued); to allow some, set the repository variable `SCRY_MAX_DROPPED`.
|
|
459
498
|
|
|
460
499
|
**Step 3: Configure GitHub Actions Secrets (Optional)**
|
|
461
500
|
|
|
@@ -941,6 +980,20 @@ git remote set-url origin git@github.com:your-username/your-repo.git
|
|
|
941
980
|
}
|
|
942
981
|
```
|
|
943
982
|
|
|
983
|
+
### Regenerate your workflows (`update-workflows`)
|
|
984
|
+
|
|
985
|
+
Workflows written by an older deployer can be missing the browser step or run an old
|
|
986
|
+
deployer. Refresh them from the current templates, without an API key:
|
|
987
|
+
|
|
988
|
+
```bash
|
|
989
|
+
npx -y @scrymore/scry-deployer@^0.7.0 update-workflows # rewrite both files
|
|
990
|
+
npx -y @scrymore/scry-deployer@^0.7.0 update-workflows --commit # and commit them
|
|
991
|
+
```
|
|
992
|
+
|
|
993
|
+
It detects your package manager from the lockfile and your Storybook build script from
|
|
994
|
+
`package.json`, and overwrites `.github/workflows/deploy-storybook.yml` and
|
|
995
|
+
`.github/workflows/deploy-pr-preview.yml`. Review the diff if you customised them.
|
|
996
|
+
|
|
944
997
|
### Want to customize the generated workflows?
|
|
945
998
|
|
|
946
999
|
After running `init`, you can edit:
|
|
@@ -1040,6 +1093,6 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for detailed contribution guidelines.
|
|
|
1040
1093
|
## 🆘 Support
|
|
1041
1094
|
|
|
1042
1095
|
Need help?
|
|
1043
|
-
- 📖 [Documentation](https://github.com/
|
|
1044
|
-
- 🐛 [Report an issue](https://github.com/
|
|
1045
|
-
- 💬 [Discussions](https://github.com/
|
|
1096
|
+
- 📖 [Documentation](https://github.com/scryorg/scry-node)
|
|
1097
|
+
- 🐛 [Report an issue](https://github.com/scryorg/scry-node/issues)
|
|
1098
|
+
- 💬 [Discussions](https://github.com/scryorg/scry-node/discussions)
|