johnandersen777.bsky.social/knotless
git that lives in your Atmosphere account
Forked from chadtmiller.com/knotless
0
0
// `node shoot/shoot.mjs <scene>... [--phone]`: the e2e world seeded and
// served as a gateway (harness/e2e/setup.mjs), then each scene filmed over
// it in turn, logged in as its person first. Each scene, in ./scenes, films
// its own takes into public/footage. Needs `cargo build --bins` and web/build,
// as `just e2e` does.
import { launch, logIn, ready } from './camera.mjs';
import review from './scenes/review.mjs';
import star from './scenes/star.mjs';
const SCENES = { review, star };
const args = process.argv.slice(2);
const size = args.includes('--phone') ? 'phone' : 'wide';
const names = args.filter((a) => !a.startsWith('--'));
const unknown = names.filter((n) => !SCENES[n]);
if (!names.length || unknown.length) {
console.error(`which scenes? ${Object.keys(SCENES).join(', ')}`);
process.exit(2);
}
// The e2e world's own ports, apart from `shots-up`'s, as `just e2e` takes.
process.env.E2E ??= '1';
const { default: setup } = await import('../../../harness/e2e/setup.mjs');
const teardown = await setup();
const world = JSON.parse(process.env.E2E_WORLD);
const who = Object.fromEntries(world.accounts.map((a) => [a.handle.split('.')[0], a]));
try {
for (const name of names) {
const scene = SCENES[name];
const { browser, context } = await launch(size);
try {
const page = await context.newPage();
await page.goto(world.base + scene.start(world));
await ready(page);
await logIn(page, world, who[scene.as]);
await scene.film({ page, world, size, take: `${name}-${size}` });
} finally {
await browser.close();
}
}
} finally {
teardown();
}