portfolio-media
v0.1.1
Published
Uploads a project's screenshots, videos and gallery stills to the Portfolio media bucket.
Readme
portfolio-media
Publishes a project's portfolio media (screenshots, videos, gallery stills) to the Portfolio site's R2 bucket. Works from any machine with the upload token; no Portfolio checkout needed.
Setup
npm install --save-dev portfolio-media.env.local in the project root:
PORTFOLIO_MEDIA_TOKEN=... # media Worker upload secret
PORTFOLIO_EMBED_TOKEN=... # only for `stills`: the token the app's /portfolio pages acceptportfolio-media.config.mjs in the project root:
export default {
// Local path (from the project root) -> R2 key. The first key segment is the Portfolio project slug.
files: {
"src/assets/portfolio/stats.png": "card-generator/stats.png",
},
// Optional. Gallery stills of live embed frames, one per Portfolio frame id.
stills: [
{
slug: "card-generator",
id: "card-generator-stats",
url: "https://example.app/portfolio/stats",
at: 1,
},
],
};stills also needs playwright installed in the project. Each still takes optional width/height (the embed's demoResolution) and storageState (a Playwright session file for pages behind a login).
Commands
portfolio-media stillscaptures each still intoportfolio-stills/.STILL=<frame id>captures just one.portfolio-media comparewritesportfolio-compare.html: each live version next to the local file, with older versions to pick from.portfolio-media uploaduploads changed files and updates the project's manifest on R2. Missing local files are skipped.
Uploads show on the Portfolio site after its next deploy, which pulls every manifest at build time.
