chrome+firefox v0.3.1 Makefile and dist/ build/ folders
This commit is contained in:
@@ -35,12 +35,17 @@ const banner = `/*
|
||||
`;
|
||||
|
||||
const prod = process.argv[2] === 'production';
|
||||
const outdir = 'build';
|
||||
|
||||
// Target browser. Firefox and Chrome disagree on exactly one manifest key, so
|
||||
// the manifest is written per target rather than duplicated in the tree.
|
||||
const target = process.env.TARGET === 'chrome' ? 'chrome' : 'firefox';
|
||||
|
||||
// Each target gets its own directory. They used to share one, and the result
|
||||
// was that whichever build ran last silently won: loading the other browser's
|
||||
// output then failed with a confusing manifest error. Separate directories
|
||||
// mean both can exist at once and neither can be stale by accident.
|
||||
const outdir = `build/${target}`;
|
||||
|
||||
/**
|
||||
* Write the manifest for the target browser.
|
||||
*
|
||||
@@ -60,8 +65,9 @@ async function writeManifest() {
|
||||
);
|
||||
}
|
||||
|
||||
// Everything that is not TypeScript is copied verbatim into build/, so that
|
||||
// the directory can be handed straight to about:debugging.
|
||||
// Everything that is not TypeScript is copied verbatim into the output, so
|
||||
// that the directory can be handed straight to about:debugging or to Chrome's
|
||||
// "Load unpacked".
|
||||
async function copyStatic() {
|
||||
await mkdir(outdir, { recursive: true });
|
||||
for (const name of await readdir('src')) {
|
||||
@@ -76,7 +82,7 @@ async function copyStatic() {
|
||||
await copyStatic();
|
||||
|
||||
// In watch mode the static files must follow every rebuild, otherwise editing
|
||||
// manifest.json or a .html file silently changes nothing in build/.
|
||||
// manifest.json or a .html file silently changes nothing in the output.
|
||||
const staticPlugin = {
|
||||
name: 'copy-static',
|
||||
setup(build) {
|
||||
|
||||
Reference in New Issue
Block a user