This repository has no description
Something went wrong. Try again.
12345678910111213141516171819202122232425import { readdir, readFile, mkdir, writeFile } from 'node:fs/promises';import { zipSync } from 'fflate';import { syncShared } from './sync_shared.mjs';
const browser = process.argv[2];if (!['chrome', 'safari'].includes(browser)) throw new Error('Choose chrome or safari.');await syncShared([browser]);const root = `extension/${browser}`;const entries = {};const options = { level: 9, mtime: new Date(1980, 0, 1) };async function add(relative = '') { for (const entry of (await readdir(`${root}/${relative}`, { withFileTypes: true })).sort((a, b) => a.name.localeCompare(b.name))) { if (entry.name.startsWith('.') || entry.name === '_metadata') continue; const file = relative + entry.name; if (entry.isDirectory()) await add(`${file}/`); else entries[file] = [await readFile(`${root}/${file}`), options]; }}await add();const { version } = JSON.parse(await readFile(`${root}/manifest.json`, 'utf8'));const output = `dist/${browser}/bskyplus-${browser}-v${version}.zip`;await mkdir(`dist/${browser}`, { recursive: true });await writeFile(output, zipSync(entries, options));console.log(output);