All checks were successful
check / check (push) Successful in 10s
Makefile, Dockerfile, CI workflow, prettier config, manifests for Chrome (MV3) and Firefox (MV2), source directory structure, and minimal test suite. All checks pass.
47 lines
1.3 KiB
JavaScript
47 lines
1.3 KiB
JavaScript
const fs = require("fs");
|
|
const path = require("path");
|
|
|
|
const DIST_CHROME = path.join(__dirname, "dist", "chrome");
|
|
const DIST_FIREFOX = path.join(__dirname, "dist", "firefox");
|
|
|
|
function ensureDir(dir) {
|
|
fs.mkdirSync(dir, { recursive: true });
|
|
}
|
|
|
|
function copyDir(src, dest) {
|
|
ensureDir(dest);
|
|
const entries = fs.readdirSync(src, { withFileTypes: true });
|
|
for (const entry of entries) {
|
|
const srcPath = path.join(src, entry.name);
|
|
const destPath = path.join(dest, entry.name);
|
|
if (entry.isDirectory()) {
|
|
copyDir(srcPath, destPath);
|
|
} else {
|
|
fs.copyFileSync(srcPath, destPath);
|
|
}
|
|
}
|
|
}
|
|
|
|
function build() {
|
|
console.log("Building AutistMask extension...");
|
|
|
|
ensureDir(DIST_CHROME);
|
|
ensureDir(DIST_FIREFOX);
|
|
|
|
copyDir(path.join(__dirname, "src"), path.join(DIST_CHROME, "src"));
|
|
copyDir(path.join(__dirname, "src"), path.join(DIST_FIREFOX, "src"));
|
|
|
|
fs.copyFileSync(
|
|
path.join(__dirname, "manifest", "chrome.json"),
|
|
path.join(DIST_CHROME, "manifest.json"),
|
|
);
|
|
fs.copyFileSync(
|
|
path.join(__dirname, "manifest", "firefox.json"),
|
|
path.join(DIST_FIREFOX, "manifest.json"),
|
|
);
|
|
|
|
console.log("Build complete: dist/chrome/ and dist/firefox/");
|
|
}
|
|
|
|
build();
|