mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-06-25 16:19:19 +02:00
CSS: - Remove duplicate 'background' fallbacks in base.css, header.css, search.css (solid color declared before gradient — gradient always wins) - Remove duplicate 'padding' in admin.css .admin-import-log JS (biome --write safe fixes applied): - function() → arrow functions in all IIFEs and callbacks - forEach/callback → arrow functions - evaluePtrn → parseInt(x, 10) in admin-contacts-form.js - Cleaned label text in build.mjs lint step Remaining warnings are intentional: !important overrides, descending specificity (admin.css cascade), noUnusedVariables (functions exported to window/onclick), useTemplate style preference.
53 lines
1.4 KiB
JavaScript
53 lines
1.4 KiB
JavaScript
#!/usr/bin/env node
|
|
/**
|
|
* Build all frontend assets: CSS + JS.
|
|
*
|
|
* Usage:
|
|
* node scripts/build.mjs # build everything
|
|
* node scripts/build.mjs --css # CSS only
|
|
* node scripts/build.mjs --js # JS only
|
|
*
|
|
* Requires: npm install (lightningcss-cli, rolldown)
|
|
*/
|
|
|
|
import { execSync } from "node:child_process";
|
|
import { existsSync } from "node:fs";
|
|
import { resolve, dirname } from "node:path";
|
|
import { fileURLToPath } from "node:url";
|
|
|
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
const root = resolve(__dirname, "..");
|
|
|
|
const args = process.argv.slice(2);
|
|
const onlyCss = args.includes("--css");
|
|
const onlyJs = args.includes("--js");
|
|
const buildAll = !onlyCss && !onlyJs;
|
|
|
|
function run(label, cmd) {
|
|
console.log(`\n📦 ${label}…`);
|
|
execSync(cmd, {
|
|
cwd: root,
|
|
stdio: "inherit",
|
|
});
|
|
}
|
|
|
|
// Ensure node_modules exist
|
|
if (!existsSync(resolve(root, "node_modules"))) {
|
|
console.log("📥 Installing dependencies (npm ci)…");
|
|
execSync("npm ci", { cwd: root, stdio: "inherit" });
|
|
}
|
|
|
|
if (buildAll || onlyCss) {
|
|
run("Linting CSS + JS (biome)", "npx biome lint app/public/assets/css/ app/public/assets/js/app/ scripts/ || true");
|
|
}
|
|
|
|
if (buildAll || onlyCss) {
|
|
run("Building CSS bundles", "node scripts/build-css.mjs");
|
|
}
|
|
|
|
if (buildAll || onlyJs) {
|
|
run("Building JS bundles", "node scripts/build-js.mjs");
|
|
}
|
|
|
|
console.log("\n✅ Build complete\n");
|