Skip to content

Commit ee52025

Browse files
moha-bekhclaude
andcommitted
distroproof visuals: the bead over the middle target, clear of it
The LinkedIn post and the square now show the bead above the middle target with a gap, instead of resting on the corner one. The script renders with the graphics card (src/scene.ts no longer draws in software), takes the pages to render on its command line, and writes where the visuals live. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 628cf1f commit ee52025

3 files changed

Lines changed: 8 additions & 5 deletions

File tree

-55.2 KB
Loading
-112 KB
Loading

‎scripts/social-pages.ts‎

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,13 @@ const base = process.env.SOCIAL_BASE_URL || 'http://127.0.0.1:5174'
88
const browser = await chromium.launch({
99
executablePath: process.env.CHROME_PATH,
1010
headless: true,
11-
args: ['--no-sandbox', '--use-angle=swiftshader', '--enable-unsafe-swiftshader'],
11+
// the glass needs a graphics card: src/scene.ts refuses to draw in software
12+
args: ['--no-sandbox', '--use-angle=vulkan', '--enable-features=Vulkan', '--enable-gpu', '--ignore-gpu-blocklist'],
1213
})
13-
// the pages of src/pages.ts that have social visuals
14-
const pages = site.flatMap((p) => (p.preview && p.brand ? [[p.preview, route(p), { brand: p.brand, shape: p.shape }] as const] : []))
14+
// the pages of src/pages.ts that have social visuals, or those named on the
15+
// command line (`node scripts/social-pages.ts distroproof`)
16+
const only = process.argv.slice(2)
17+
const pages = site.flatMap((p) => (p.preview && p.brand && (!only.length || only.includes(p.preview)) ? [[p.preview, route(p), { brand: p.brand, shape: p.shape }] as const] : []))
1518
const formats = [['linkedin-post', 1200, 627], ['social-square', 1080, 1080]]
1619
const manifest: { id: string; brand: string; route: string; shape: string; slogan: string[]; files: string[] }[] = []
1720
try {
@@ -23,7 +26,7 @@ try {
2326
const lines = await page.locator('.hero h1').innerText()
2427
const [line1, line2] = (lines as string).split('\n').map((s) => s.trim()).filter(Boolean)
2528
if (!line1 || !line2) throw new Error(`Missing slogan for ${id}`)
26-
const directory = resolve('assets/pages', id)
29+
const directory = resolve('assets/devutils-linkedin-pages/pages', id)
2730
await mkdir(directory, { recursive: true })
2831
const files: string[] = []
2932
for (const [format, width, height] of formats) {
@@ -47,5 +50,5 @@ try {
4750
await browser.close()
4851
}
4952
await writeFile('out/output/social-pages/manifest.json', JSON.stringify(manifest, null, 2) + '\n')
50-
const cards = manifest.map(p => `<article><h2>${p.brand}</h2><p>${p.slogan.join(' ')}</p>${p.files.map(f => `<a href="../../../assets/pages/${p.id}/${f}"><img src="../../../assets/pages/${p.id}/${f}" alt="${p.brand}: ${p.slogan.join(' ')}"><small>${f}</small></a>`).join('')}</article>`).join('\n')
53+
const cards = manifest.map(p => `<article><h2>${p.brand}</h2><p>${p.slogan.join(' ')}</p>${p.files.map(f => `<a href="../../../assets/devutils-linkedin-pages/pages/${p.id}/${f}"><img src="../../../assets/devutils-linkedin-pages/pages/${p.id}/${f}" alt="${p.brand}: ${p.slogan.join(' ')}"><small>${f}</small></a>`).join('')}</article>`).join('\n')
5154
await writeFile('out/output/social-pages/index.html', `<!doctype html><html lang="fr"><meta charset="utf-8"><title>Devutils — LinkedIn par page</title><style>body{background:#08090d;color:#eee;font:16px system-ui;max-width:1400px;margin:40px auto;padding:24px}article{margin:48px 0}a{display:inline-block;vertical-align:top;width:46%;margin-right:2%;color:#9cf5ff}img{width:100%;display:block}small{display:block;margin:12px 0}</style><h1>Devutils — visuels par page</h1><p>Slogans et symboles 3D des pages actuelles. Cliquer sur une image pour ouvrir le PNG.</p>${cards}</html>`)

0 commit comments

Comments
 (0)