kytta/shareon

Generate screenshot automatically

Ouverte

#148 ouverte le 21 avr. 2025

 (0 commentaire) (0 réaction) (0 personne assignée)JavaScript (25 forks)auto 404
devdocsenhancementgood first issue

Métriques du dépôt

Stars
 (477 étoiles)
Métriques de merge PR
 (Aucune PR mergée en 30 j)

Description

Currently, the screenshot in the README is created manually by me. The process can be easily automated, though. So far, my steps are:

  1. Start dev server
  2. Select element with the buttons (.specimen)
  3. Make a screenshot of node
  4. Resize
  5. Save

But I think this all can be replaced with Playwright and Sharp.

import { firefox } from 'playwright';

const browser = await firefox.launch();
const context = await browser.newContext();
const page = await context.newPage();
await page.goto('https://localhost:5173/');
const buffer = await page.locator('.shareon.specimen').screenshot();
// TODO: learn Sharp

Then, put it into CI and run on icon/button changes. Can be a nice weekend project.

Guide contributeur