Initial commit: Share-as-QR Firefox extension with bun build
MV3 WebExtension that turns the active tab's URL into a scannable QR code via a toolbar popup. The popup runs locally — no network requests. Build pipeline: `bun build` bundles popup.js + the vendored kazuhikoarase/qrcode-generator (MIT, pinned to 83b7e8f) into a single ~23 KB minified ESM file under dist/. web-ext operates on dist/, so the packaged zip contains only what actually ships (~28 KB). Scripts: - bun run build — bundle + copy assets into dist/ - bun run lint — build + web-ext lint (0 errors / 0 warnings) - bun run package — build + produce a signable .zip - bun run start — build + launch Firefox with the extension loaded Tracks dogcat epic firefox-share-as-qr-35mw and its 5 child tasks (scaffold, vendor lib, popup UI, icons, README). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
commit
8fa1809d9d
16 changed files with 2915 additions and 0 deletions
29
scripts/build.mjs
Normal file
29
scripts/build.mjs
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
import { rm, cp } from "node:fs/promises";
|
||||
|
||||
const DIST = "dist";
|
||||
|
||||
await rm(DIST, { recursive: true, force: true });
|
||||
|
||||
const result = await Bun.build({
|
||||
entrypoints: ["popup/popup.js"],
|
||||
outdir: `${DIST}/popup`,
|
||||
target: "browser",
|
||||
format: "esm",
|
||||
minify: true,
|
||||
});
|
||||
|
||||
if (!result.success) {
|
||||
for (const log of result.logs) console.error(log);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
await Promise.all([
|
||||
cp("manifest.json", `${DIST}/manifest.json`),
|
||||
cp("popup/popup.html", `${DIST}/popup/popup.html`),
|
||||
cp("popup/popup.css", `${DIST}/popup/popup.css`),
|
||||
cp("icons", `${DIST}/icons`, { recursive: true }),
|
||||
cp("vendor/LICENSE.qrcode-generator", `${DIST}/LICENSE.qrcode-generator`),
|
||||
]);
|
||||
|
||||
const size = (await Bun.file(`${DIST}/popup/popup.js`).arrayBuffer()).byteLength;
|
||||
console.log(`Built ${DIST}/ (popup.js: ${(size / 1024).toFixed(1)} KB)`);
|
||||
Loading…
Add table
Add a link
Reference in a new issue