diff options
| author | cashmere <cashmere@autistici.org> | 2026-09-04 09:05:24 +0200 |
|---|---|---|
| committer | cashmere <cashmere@autistici.org> | 2026-09-04 09:05:24 +0200 |
| commit | 4f49b16079b27d7ce633619e4cddfdf2bffbc952 (patch) | |
| tree | c296c1e7f3c3e2f6859c6d3a1b1b208779b89679 /tools/copland/scripts/build-config.mjs | |
| download | relic-master.tar.gz | |
Diffstat (limited to 'tools/copland/scripts/build-config.mjs')
| -rw-r--r-- | tools/copland/scripts/build-config.mjs | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/tools/copland/scripts/build-config.mjs b/tools/copland/scripts/build-config.mjs new file mode 100644 index 0000000..0a24317 --- /dev/null +++ b/tools/copland/scripts/build-config.mjs @@ -0,0 +1,30 @@ +import { mkdir, readFile, writeFile } from "node:fs/promises"; +import { dirname, resolve } from "node:path"; +import { fileURLToPath } from "node:url"; + +const projectRoot = resolve(dirname(fileURLToPath(import.meta.url)), ".."); +const skinDir = resolve(projectRoot, "../../skins/copland"); +const outputPath = resolve(projectRoot, "dist/copland-skin.config"); +const parts = ["css", "header", "footer", "details", "js"]; + +function fossilQuote(value) { + return `'${value.replaceAll("'", "''")}'`; +} + +const records = []; +for (const name of parts) { + const value = await readFile(resolve(skinDir, `${name}.txt`), "utf8"); + const record = `1 ${fossilQuote(name)} value ${fossilQuote(value)}`; + records.push(`config /config ${Buffer.byteLength(record, "utf8")}\n${record}\n`); +} + +const header = [ + "# Copland Fossil skin configuration", + "# Generated deterministically by tools/copland/scripts/build-config.mjs.", + "# Import with: fossil configuration import dist/copland-skin.config -R REPOSITORY", + "", +].join("\n"); + +await mkdir(dirname(outputPath), { recursive: true }); +await writeFile(outputPath, header + records.join(""), "utf8"); +console.log(`Wrote ${outputPath}`); |
