@scrymore/scry-deployer 0.7.0-next.20260926151750 → 0.7.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 +121 -32
- package/bin/cli.js +273 -47
- package/lib/config.js +7 -3
- package/lib/coverage.js +151 -11
- package/lib/metadataArchive.js +135 -0
- package/lib/telemetry.js +67 -0
- 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,7 +2,31 @@
|
|
|
2
2
|
|
|
3
3
|
Deploy your Storybook to the cloud with one command. ⚡
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Set up with your AI assistant
|
|
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.
|
|
6
30
|
|
|
7
31
|
### 1. Get your credentials
|
|
8
32
|
Visit the [Scry Dashboard](https://dashboard.scrymore.com) and:
|
|
@@ -100,8 +124,8 @@ yarn add github:scryorg/scry-node --dev
|
|
|
100
124
|
After installation, you can run commands using:
|
|
101
125
|
|
|
102
126
|
```bash
|
|
103
|
-
# Using the
|
|
104
|
-
|
|
127
|
+
# Using the scry-deployer binary
|
|
128
|
+
npm exec -- scry-deployer init --projectId xxx --apiKey yyy
|
|
105
129
|
|
|
106
130
|
# Using the scry alias
|
|
107
131
|
npx scry init --projectId xxx --apiKey yyy
|
|
@@ -184,7 +208,9 @@ The CLI is configured through a combination of command-line options and environm
|
|
|
184
208
|
| `--api-url` | `STORYBOOK_DEPLOYER_API_URL` | Base URL for the deployment service API. | No | `https://storybook-deployment-service.epinnock.workers.dev` |
|
|
185
209
|
| `--project` | `STORYBOOK_DEPLOYER_PROJECT` | The project name/identifier. | No | `main` |
|
|
186
210
|
| `--version` | `STORYBOOK_DEPLOYER_VERSION` | The version identifier for the deployment. | No | `latest` |
|
|
187
|
-
| `--with-analysis` | `STORYBOOK_DEPLOYER_WITH_ANALYSIS` |
|
|
211
|
+
| `--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 |
|
|
212
|
+
| `--no-analysis` | `STORYBOOK_DEPLOYER_ANALYSIS=false` | Host the Storybook without indexing it. The log says the build is NOT searchable. | No | - |
|
|
213
|
+
| `--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 |
|
|
188
214
|
| `--stories-dir` | `STORYBOOK_DEPLOYER_STORIES_DIR` | Path to stories directory (optional, auto-detects .stories.* files). | No | Auto-detect |
|
|
189
215
|
| `--screenshots-dir` | `STORYBOOK_DEPLOYER_SCREENSHOTS_DIR` | Directory for captured screenshots. | No | `./screenshots` |
|
|
190
216
|
| `--storybook-url` | `STORYBOOK_DEPLOYER_STORYBOOK_URL` | URL of running Storybook server for screenshot capture. | No | `http://localhost:6006` |
|
|
@@ -192,9 +218,37 @@ The CLI is configured through a combination of command-line options and environm
|
|
|
192
218
|
| `--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) |
|
|
193
219
|
| `--capture-viewport` | `SCRY_CAPTURE_VIEWPORT` | Browser viewport `WIDTHxHEIGHT` forwarded to scry-sbcov. | No | unset: sbcov decides (`1280x720`) |
|
|
194
220
|
| `--verbose` | `STORYBOOK_DEPLOYER_VERBOSE` | Enable verbose logging for debugging purposes. | No | `false` |
|
|
221
|
+
| - | `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 |
|
|
195
222
|
| `--help`, `-h` | - | Show the help message. | - | - |
|
|
196
223
|
| `--version`, `-v`| - | Show the version number. | - | - |
|
|
197
224
|
|
|
225
|
+
### Exit codes and indexing (0.7.0)
|
|
226
|
+
|
|
227
|
+
A deploy that was asked to index and will index nothing ends **red**. The Storybook is still
|
|
228
|
+
uploaded and hosted in every case below, so the preview link works; the red run is the signal.
|
|
229
|
+
|
|
230
|
+
| What happened | Log line | Exit code |
|
|
231
|
+
|---|---|---|
|
|
232
|
+
| Stories captured, metadata uploaded and queued | `⏳ Indexing has been queued, not finished.` | 0 |
|
|
233
|
+
| Metadata upload rejected by the service | `❌ The metadata upload failed (<reason>), so NOTHING WILL BE INDEXED.` | 1 |
|
|
234
|
+
| Metadata uploaded but not queued | `❌ Metadata was uploaded but not queued for processing, so NOTHING WILL BE INDEXED.` | 1 |
|
|
235
|
+
| 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 |
|
|
236
|
+
| Analysis produced no archive (for example, no Playwright browser) | `❌ Analysis produced no metadata, so NOTHING WILL BE INDEXED.` | 1 |
|
|
237
|
+
| 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 |
|
|
238
|
+
| 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 |
|
|
239
|
+
| 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 |
|
|
240
|
+
| 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 |
|
|
241
|
+
| `--no-analysis` (or `--no-coverage` / `--coverage-report <file>` without `--with-analysis`) | `ℹ️ Analysis skipped (--no-analysis): this build is hosted but NOT searchable.` | 0 |
|
|
242
|
+
| Any error before the upload (bad `--dir`, bad API key, invalid flag) | `❌ Error: …` | 1 |
|
|
243
|
+
|
|
244
|
+
scry-sbcov's own exit codes (0.5.2+): **0** ok, **2** the capture config is broken, misspelt or
|
|
245
|
+
unknown (no archive), **3** more stories dropped than `--max-dropped` (archive of the rest written).
|
|
246
|
+
The deployer passes `--max-dropped 0` unless you set a value; with a scry-sbcov older than 0.5.2,
|
|
247
|
+
which does not know the flag, it is not passed and the log says dropped stories cannot be counted.
|
|
248
|
+
|
|
249
|
+
Before 0.7.0 the metadata-upload failure, the "not queued" case, an empty archive, a non-zero
|
|
250
|
+
scry-sbcov exit and a workflow that simply forgot `--with-analysis` all ended green (ISSUES.md #50).
|
|
251
|
+
|
|
198
252
|
### Story File Auto-Detection
|
|
199
253
|
|
|
200
254
|
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:
|
|
@@ -359,40 +413,61 @@ Without analysis, only the static site is zipped and uploaded as `{project}-{ver
|
|
|
359
413
|
|
|
360
414
|
## Example CI/CD Integration (GitHub Actions)
|
|
361
415
|
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
**Basic deployment workflow:**
|
|
365
|
-
```yaml
|
|
366
|
-
- name: Deploy Storybook
|
|
367
|
-
env:
|
|
368
|
-
STORYBOOK_DEPLOYER_API_URL: https://storybook-deployment-service.epinnock.workers.dev
|
|
369
|
-
STORYBOOK_DEPLOYER_PROJECT: ${{ github.event.repository.name }}
|
|
370
|
-
STORYBOOK_DEPLOYER_VERSION: ${{ github.sha }}
|
|
371
|
-
run: npx storybook-deploy --dir ./storybook-static
|
|
372
|
-
```
|
|
416
|
+
Let the deployer write the workflows for you (`init` for a new project, `update-workflows` to
|
|
417
|
+
refresh existing ones; see below). The steps it generates, after your Storybook is built:
|
|
373
418
|
|
|
374
|
-
**Deployment with analysis:**
|
|
375
419
|
```yaml
|
|
376
|
-
- name:
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
420
|
+
- name: Install the Scry deployer
|
|
421
|
+
id: scry
|
|
422
|
+
# Its own folder and a floor of ^0.7.0: the repo's own pin cannot pick an older deployer.
|
|
423
|
+
run: |
|
|
424
|
+
set -o pipefail
|
|
425
|
+
mkdir -p "$RUNNER_TEMP/scry"
|
|
426
|
+
npm i --no-save --no-audit --no-fund --ignore-scripts --prefix "$RUNNER_TEMP/scry" @scrymore/scry-deployer@^0.7.0
|
|
427
|
+
cd "$RUNNER_TEMP/scry"
|
|
428
|
+
echo "version=$(node -p "require('@scrymore/scry-deployer/package.json').version")" >> "$GITHUB_OUTPUT"
|
|
429
|
+
PW="$(npx --no-install playwright --version | awk '{print $2}')"
|
|
430
|
+
[ -n "$PW" ] || { echo "::error::the deployer's Playwright was not found"; exit 1; }
|
|
431
|
+
echo "playwright=$PW" >> "$GITHUB_OUTPUT"
|
|
432
|
+
|
|
433
|
+
- name: Cache the deployer's Playwright browser
|
|
434
|
+
uses: actions/cache@v4
|
|
435
|
+
with:
|
|
436
|
+
path: ~/.cache/ms-playwright
|
|
437
|
+
key: scry-pw-${{ runner.os }}-${{ steps.scry.outputs.playwright }}
|
|
438
|
+
|
|
439
|
+
- name: Install the deployer's Playwright browser
|
|
440
|
+
working-directory: ${{ runner.temp }}/scry
|
|
441
|
+
run: npx --no-install playwright install --with-deps chromium-headless-shell
|
|
442
|
+
|
|
443
|
+
- name: Deploy to Scry
|
|
387
444
|
run: |
|
|
388
|
-
|
|
445
|
+
"$RUNNER_TEMP/scry/node_modules/.bin/scry-deployer" \
|
|
389
446
|
--dir ./storybook-static \
|
|
390
447
|
--with-analysis \
|
|
391
|
-
--
|
|
392
|
-
|
|
448
|
+
--coverage-base ${{ vars.SCRY_COVERAGE_BASE || github.event.before }}
|
|
449
|
+
env:
|
|
450
|
+
STORYBOOK_DEPLOYER_API_URL: ${{ vars.SCRY_API_URL }}
|
|
451
|
+
STORYBOOK_DEPLOYER_PROJECT: ${{ vars.SCRY_PROJECT_ID }}
|
|
452
|
+
STORYBOOK_DEPLOYER_API_KEY: ${{ secrets.SCRY_API_KEY }}
|
|
453
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
393
454
|
```
|
|
394
455
|
|
|
395
|
-
|
|
456
|
+
Why these steps and in this order:
|
|
457
|
+
|
|
458
|
+
- **The deployer goes into its own folder** (`$RUNNER_TEMP/scry`), so a version pinned in your
|
|
459
|
+
`package.json` or lockfile cannot select an old deployer, and a pnpm or yarn `node_modules`
|
|
460
|
+
is never touched. The same steps work for npm, pnpm, yarn and bun projects.
|
|
461
|
+
- **The browser comes from the deployer's own Playwright**, installed after the deployer.
|
|
462
|
+
A bare `npx playwright install` resolves whatever Playwright is newest (or your project's)
|
|
463
|
+
and can download a browser build the analyzer does not look for; every story then fails
|
|
464
|
+
and nothing is indexed.
|
|
465
|
+
- **Never call a bare `npx @scrymore/scry-deployer`** in CI: it runs whatever version your
|
|
466
|
+
repository pins, however old.
|
|
467
|
+
|
|
468
|
+
The full generated files are in [`templates/workflows/`](templates/workflows/). The PR
|
|
469
|
+
workflow also skips draft PRs, deploys when a PR is marked ready, and cancels a superseded run
|
|
470
|
+
for the same PR.
|
|
396
471
|
|
|
397
472
|
### PR Preview Deployments
|
|
398
473
|
|
|
@@ -443,7 +518,7 @@ If you're installing from GitHub, the workflow file is already included.
|
|
|
443
518
|
|
|
444
519
|
**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.
|
|
445
520
|
|
|
446
|
-
**Note:** Generated workflows
|
|
521
|
+
**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`.
|
|
447
522
|
|
|
448
523
|
**Step 3: Configure GitHub Actions Secrets (Optional)**
|
|
449
524
|
|
|
@@ -929,6 +1004,20 @@ git remote set-url origin git@github.com:your-username/your-repo.git
|
|
|
929
1004
|
}
|
|
930
1005
|
```
|
|
931
1006
|
|
|
1007
|
+
### Regenerate your workflows (`update-workflows`)
|
|
1008
|
+
|
|
1009
|
+
Workflows written by an older deployer can be missing the browser step or run an old
|
|
1010
|
+
deployer. Refresh them from the current templates, without an API key:
|
|
1011
|
+
|
|
1012
|
+
```bash
|
|
1013
|
+
npx -y @scrymore/scry-deployer@^0.7.0 update-workflows # rewrite both files
|
|
1014
|
+
npx -y @scrymore/scry-deployer@^0.7.0 update-workflows --commit # and commit them
|
|
1015
|
+
```
|
|
1016
|
+
|
|
1017
|
+
It detects your package manager from the lockfile and your Storybook build script from
|
|
1018
|
+
`package.json`, and overwrites `.github/workflows/deploy-storybook.yml` and
|
|
1019
|
+
`.github/workflows/deploy-pr-preview.yml`. Review the diff if you customised them.
|
|
1020
|
+
|
|
932
1021
|
### Want to customize the generated workflows?
|
|
933
1022
|
|
|
934
1023
|
After running `init`, you can edit:
|