Skip to content

Commit 0ddf854

Browse files
committed
chore: delete docs
1 parent f1aed2f commit 0ddf854

8 files changed

Lines changed: 24 additions & 346 deletions

docs/blog/fix-storybook-argstable-cn.md

Lines changed: 0 additions & 170 deletions
This file was deleted.

docs/blog/fix-storybook-argstable-en.md

Lines changed: 0 additions & 155 deletions
This file was deleted.

docs/static/images/README.md

Lines changed: 0 additions & 10 deletions
This file was deleted.
-32 KB
Binary file not shown.
-451 KB
Binary file not shown.
-219 KB
Binary file not shown.

scripts/capture-storybook.cjs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/usr/bin/env node
2+
// cjs wrapper to run the capture-storybook.js ES module in a project with "type": "module"
3+
const { spawn } = require('child_process');
4+
const path = require('path');
5+
6+
const nodeArgs = ['--loader', 'node:loader'];
7+
// Execute the ESM script with node directly
8+
const script = path.join(__dirname, 'capture-storybook.js');
9+
const child = spawn(process.execPath, [script], { stdio: 'inherit', env: process.env });
10+
child.on('exit', code => process.exit(code));

scripts/capture-storybook.js

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
#!/usr/bin/env node
2-
// Simple Playwright-based script to capture a screenshot and record a short video of a Storybook page.
2+
// ESM-compatible Playwright-based script to capture a screenshot and record a short video of a Storybook page.
33
// Usage: STORYBOOK_URL=http://localhost:6006 STORY_PATH='/?path=/story/your--story' OUT_DIR=docs/static/images node scripts/capture-storybook.js
44

5-
const { chromium } = require('playwright');
6-
const fs = require('fs');
5+
import { chromium } from 'playwright';
6+
import fs from 'fs';
77

8-
(async () => {
9-
const url = process.env.STORYBOOK_URL || 'http://localhost:6006';
10-
const path = process.env.STORY_PATH || '/';
11-
const out = process.env.OUT_DIR || 'docs/static/images';
12-
fs.mkdirSync(out, { recursive: true });
13-
const videoDir = `${out}/video`;
14-
fs.mkdirSync(videoDir, { recursive: true });
8+
const url = process.env.STORYBOOK_URL || 'http://localhost:6006';
9+
const path = process.env.STORY_PATH || '/';
10+
const out = process.env.OUT_DIR || 'docs/static/images';
11+
fs.mkdirSync(out, { recursive: true });
12+
const videoDir = `${out}/video`;
13+
fs.mkdirSync(videoDir, { recursive: true });
1514

15+
try {
1616
const browser = await chromium.launch();
1717
const context = await browser.newContext({ recordVideo: { dir: videoDir, size: { width: 1280, height: 720 } } });
1818
const page = await context.newPage();
@@ -42,4 +42,7 @@ const fs = require('fs');
4242

4343
console.log('Done. Convert the webm to gif using ffmpeg if you need GIFs.');
4444
process.exit(0);
45-
})().catch(e => { console.error(e); process.exit(1); });
45+
} catch (e) {
46+
console.error(e);
47+
process.exit(1);
48+
}

0 commit comments

Comments
 (0)