Skip to content

Commit fa347bf

Browse files
committed
chore(ci): convert SVG assets to PNG in extension README during release
Replace banner.svg and architecture.svg references with .png equivalents in the extension mirror README to ensure compatibility with VS Code Marketplace rendering.
1 parent bfc73be commit fa347bf

4 files changed

Lines changed: 35 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,8 @@ jobs:
214214
readme = readme.replace(/\| <img src=\"[^\"]*claude\\.svg\"[^|]*\|[^\n]*\n/,
215215
'| Claude Desktop | Claude Code | Cursor | Windsurf | Cline | Amp |\n');
216216
readme = readme.replace(/<img src=\"[^\"]*mcp\\.svg\"[^/]*\\/>/g, '');
217+
readme = readme.replace(/assets\/banner\.svg/g, 'assets/banner.png');
218+
readme = readme.replace(/assets\/architecture\.svg/g, 'assets/architecture.png');
217219
fs.writeFileSync('packages/extension/README.md', readme);
218220
"
219221
276 KB
Loading
232 KB
Loading

scripts/svg-to-png.mjs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import { chromium } from 'patchright-core';
2+
import { readFileSync } from 'fs';
3+
import { resolve, dirname } from 'path';
4+
import { fileURLToPath } from 'url';
5+
6+
const __dirname = dirname(fileURLToPath(import.meta.url));
7+
const assetsDir = resolve(__dirname, '../packages/mcp-server/assets');
8+
9+
const targets = [
10+
{ svg: 'banner.svg', png: 'banner.png', w: 900, h: 210 },
11+
{ svg: 'architecture.svg', png: 'architecture.png', w: 900, h: 450 },
12+
];
13+
14+
const browser = await chromium.launch({ headless: true });
15+
16+
for (const { svg, png, w, h } of targets) {
17+
const svgPath = resolve(assetsDir, svg);
18+
const pngPath = resolve(assetsDir, png);
19+
const svgContent = readFileSync(svgPath, 'utf8');
20+
const html = `<!DOCTYPE html><html><head><style>*{margin:0;padding:0;overflow:hidden}</style></head><body>${svgContent}</body></html>`;
21+
22+
const page = await browser.newPage();
23+
await page.setViewportSize({ width: w * 2, height: h * 2 });
24+
// deviceScaleFactor=2 gives retina-quality output at 2× the logical pixel size
25+
await page.emulateMedia({ colorScheme: 'dark' });
26+
const htmlScaled = html.replace('<body>', `<body style="transform-origin:top left;transform:scale(2)">`);
27+
await page.setContent(htmlScaled, { waitUntil: 'networkidle' });
28+
await page.screenshot({ path: pngPath, clip: { x: 0, y: 0, width: w * 2, height: h * 2 } });
29+
await page.close();
30+
console.log(`✓ ${png}`);
31+
}
32+
33+
await browser.close();

0 commit comments

Comments
 (0)