fix: sync changelog to public/ and automate on build/dev (#37) #38

Merged
maximus merged 4 commits from fix/simpl-resultat-37-changelog into main 2026-03-11 21:26:07 +00:00
Showing only changes of commit 5493e0c4e2 - Show all commits

View file

@ -2,17 +2,15 @@ import { defineConfig } from "vite";
import react from "@vitejs/plugin-react"; import react from "@vitejs/plugin-react";
import tailwindcss from "@tailwindcss/vite"; import tailwindcss from "@tailwindcss/vite";
import { copyFileSync } from "fs"; import { copyFileSync } from "fs";
import { resolve, dirname } from "path"; import { resolve } from "path";
import { fileURLToPath } from "url";
const __dirname = dirname(fileURLToPath(import.meta.url));
// Sync root CHANGELOG files to public/ so the app always shows the latest version history // Sync root CHANGELOG files to public/ so the app always shows the latest version history
function syncChangelogs() { function syncChangelogs() {
const root = import.meta.dirname;
const files = ["CHANGELOG.md", "CHANGELOG.fr.md"]; const files = ["CHANGELOG.md", "CHANGELOG.fr.md"];
for (const file of files) { for (const file of files) {
try { try {
copyFileSync(resolve(__dirname, file), resolve(__dirname, "public", file)); copyFileSync(resolve(root, file), resolve(root, "public", file));
} catch { } catch {
// Ignore if source file doesn't exist // Ignore if source file doesn't exist
} }