Skip to content

CLI Commands

init

Initialize a project with Scry configuration and GitHub Actions workflows.

bash
npx @scry/storybook-deployer init [options]

Options

OptionTypeRequiredDescription
--projectIdstringYesYour Scry project ID
--apiKeystringYesYour Scry API key
--skip-gh-setupbooleanNoSkip GitHub CLI setup

What It Does

  1. Creates .storybook-deployer.json configuration file
  2. Generates GitHub Actions workflows:
    • .github/workflows/deploy-storybook.yml
    • .github/workflows/deploy-pr-preview.yml
  3. Sets up GitHub repository variables and secrets (unless --skip-gh-setup)
  4. Commits and pushes changes to GitHub

Examples

bash
# Full setup
npx @scry/storybook-deployer init \
  --projectId my-design-system \
  --apiKey scry_proj_my-design-system_xxx

# Skip GitHub CLI setup (manual secrets)
npx @scry/storybook-deployer init \
  --projectId my-project \
  --apiKey scry_proj_xxx \
  --skip-gh-setup

deploy (default)

Deploy a Storybook build to Scry. This is the default command when no command is specified.

bash
npx @scry/storybook-deployer [options]
# or
npx @scry/storybook-deployer deploy [options]

Options

OptionEnvironment VariableRequiredDefaultDescription
--dirSTORYBOOK_DEPLOYER_DIRYes-Path to built Storybook directory
--projectSTORYBOOK_DEPLOYER_PROJECTNomainProject identifier
--versionSTORYBOOK_DEPLOYER_VERSIONNolatestVersion string
--api-keySTORYBOOK_DEPLOYER_API_KEYNo*-API key for authentication
--api-urlSTORYBOOK_DEPLOYER_API_URLNoDefault APIAPI endpoint URL
--with-analysisSTORYBOOK_DEPLOYER_WITH_ANALYSISNofalseEnable story analysis
--verboseSTORYBOOK_DEPLOYER_VERBOSENofalseEnable debug logging

*API key is required unless using presigned URLs with prior authentication.

Examples

bash
# Basic deployment
npx @scry/storybook-deployer \
  --dir ./storybook-static \
  --project my-project \
  --version v1.0.0

# Using environment variables
export STORYBOOK_DEPLOYER_API_KEY=scry_proj_xxx
export STORYBOOK_DEPLOYER_PROJECT=my-project
npx @scry/storybook-deployer --dir ./storybook-static

# Verbose output
npx @scry/storybook-deployer \
  --dir ./storybook-static \
  --verbose

# With story analysis
npx @scry/storybook-deployer \
  --dir ./storybook-static \
  --with-analysis \
  --storybook-url http://localhost:6006

Output

[scry] Starting deployment...
[scry] Building archive from ./storybook-static
[scry] Archive size: 2.3 MB
[scry] Authenticating with API key...
[scry] Requesting presigned URL...
[scry] Uploading to cloud storage...
[scry] ✓ Upload complete!
[scry]
[scry] Deployment URL: https://view.scry.com/my-project/v1.0.0/
[scry] Build ID: abc123def456
[scry] Build Number: 42

analyze

Analyze Storybook stories and capture screenshots without deploying.

bash
npx @scry/storybook-deployer analyze [options]

Options

OptionEnvironment VariableRequiredDefaultDescription
--projectSTORYBOOK_DEPLOYER_PROJECTNomainProject identifier
--versionSTORYBOOK_DEPLOYER_VERSIONNolatestVersion string
--stories-dirSTORYBOOK_DEPLOYER_STORIES_DIRNoAuto-detectPath to stories directory
--screenshots-dirSTORYBOOK_DEPLOYER_SCREENSHOTS_DIRNo./screenshotsOutput directory for screenshots
--storybook-urlSTORYBOOK_DEPLOYER_STORYBOOK_URLNohttp://localhost:6006Running Storybook URL
--verboseSTORYBOOK_DEPLOYER_VERBOSENofalseEnable debug logging

Story Auto-Detection

The analyze command automatically finds story files anywhere in your project:

Supported patterns:

  • .stories.ts, .stories.tsx
  • .stories.js, .stories.jsx
  • .stories.mjs, .stories.cjs

Excluded directories:

  • node_modules
  • dist, build
  • .git, .next, .nuxt

Examples

bash
# Auto-detect stories and capture screenshots
npx @scry/storybook-deployer analyze \
  --storybook-url http://localhost:6006

# Specify stories directory
npx @scry/storybook-deployer analyze \
  --stories-dir ./src/components \
  --storybook-url http://localhost:6006

# Custom output directory
npx @scry/storybook-deployer analyze \
  --screenshots-dir ./visual-snapshots

Output

The analyze command creates:

screenshots/
├── Button--Primary.png
├── Button--Secondary.png
├── Card--Default.png
└── ...

metadata.json

The metadata.json contains:

  • Story metadata (file paths, component names, story names)
  • Screenshot mappings
  • Analysis timestamp

Global Options

These options work with all commands:

OptionDescription
--help, -hShow help message
--version, -vShow version number
--verboseEnable debug logging

Configuration File

The CLI looks for .storybook-deployer.json in the current directory:

json
{
  "apiUrl": "https://api.scry.com",
  "dir": "./storybook-static",
  "project": "my-project",
  "version": "latest",
  "verbose": false
}

See Configuration for all options.

Released under the MIT License.