This commit is contained in:
Matěj Kubíček
2026-09-02 20:38:45 +02:00
parent 0c524ed6af
commit c7948a788a
46 changed files with 10099 additions and 152 deletions
+40
View File
@@ -0,0 +1,40 @@
import { cp, mkdir } from 'node:fs/promises';
import { fileURLToPath } from 'node:url';
import { build } from 'esbuild';
const root = new URL('../', import.meta.url);
const outdir = new URL('../dist/', import.meta.url);
const rootPath = fileURLToPath(root);
const outdirPath = fileURLToPath(outdir);
await mkdir(outdir, { recursive: true });
await cp(new URL('../public/', import.meta.url), outdir, { recursive: true });
await cp(
new URL('../node_modules/@contentauth/c2pa-web/dist/resources/c2pa_bg.wasm', import.meta.url),
new URL('../dist/c2pa_bg.wasm', import.meta.url)
);
await cp(
new URL('../node_modules/@contentauth/c2pa-web/dist/c2pa_worker.js', import.meta.url),
new URL('../dist/c2pa_worker.js', import.meta.url)
);
await build({
absWorkingDir: rootPath,
entryPoints: {
background: 'src/background/index.ts',
content: 'src/content/index.ts',
popup: 'src/popup/index.tsx',
options: 'src/options/index.tsx'
},
outdir: outdirPath,
bundle: true,
format: 'iife',
platform: 'browser',
target: ['firefox128'],
jsx: 'automatic',
jsxImportSource: 'preact',
sourcemap: true,
minify: true,
legalComments: 'eof',
logLevel: 'info'
});
+6
View File
@@ -0,0 +1,6 @@
import { rm } from 'node:fs/promises';
await Promise.all([
rm(new URL('../dist', import.meta.url), { recursive: true, force: true }),
rm(new URL('../artifacts', import.meta.url), { recursive: true, force: true })
]);