Makefile, Dockerfile, CI workflow, prettier config, manifests for Chrome (MV3) and Firefox (MV2), source directory structure, and minimal test suite. All checks pass.
This commit is contained in:
46
build.js
Normal file
46
build.js
Normal file
@@ -0,0 +1,46 @@
|
||||
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();
|
||||
Reference in New Issue
Block a user