feat: migration complète 11ty → SvelteKit (v3)
Deploy to GitHub Pages / build (push) Failing after 23s
Deploy to GitHub Pages / deploy (push) Has been skipped

- SvelteKit 2 + Svelte 5 runes + TS, adapter-static, paths.base '/gwada-sirius' (relative: false)
- 5 pages × 3 locales (/, /en/, /ht/) : catalogues inlang repris tels quels, routeur i18n maison avec fallback ht→fr
- Îlots → composants natifs avec fallback SSR (calculateur, carte Leaflet, globe) ; Leaflet en import dynamique
- Dette corrigée : aria-current (bug legacy), polices en double, SEO complet (Seo, hreflang ×3, OG, Twitter, robots, sitemap 15 URLs)
- PWA : manifest + service-worker v3 (stale-while-revalidate)
- CI GitHub Pages mise à jour (build/), README et NOTES_PROJET réécrits
- Lighthouse mobile : 98/95/100/100 — svelte-check 0/0, Leaflet vérifié (2 cartes, tuiles OSM), no-JS vérifié
This commit is contained in:
sucupira
2026-07-21 14:41:04 -04:00
parent 542323ceaa
commit 2947482f50
97 changed files with 3493 additions and 4926 deletions
-112
View File
@@ -1,112 +0,0 @@
import fs from "node:fs";
import path from "node:path";
import EleventyVitePlugin from "@11ty/eleventy-plugin-vite";
import { svelte } from "@sveltejs/vite-plugin-svelte";
import * as m from "./src/paraglide/messages.js";
import { locales, baseLocale } from "./src/paraglide/runtime.js";
const OUTPUT_DIR = "_site";
// GitHub Pages project sites are served under /<repo-name>/, not at the
// domain root — set BASE_PATH (no trailing slash, e.g. "/gwada-sirius")
// in CI to prefix internal links and Vite's own asset URLs accordingly.
// Left empty for local dev and for a future custom-domain deployment.
const BASE_PATH = (process.env.BASE_PATH || "").replace(/\/+$/, "");
// Vite's build wipes the output dir (emptyOutDir) after 11ty has already
// copied passthrough assets into it — re-copy them once Vite is done.
// https://github.com/11ty/eleventy-plugin-vite/issues/42
function restorePassthroughCopy(copies) {
return {
name: "restore-passthrough-copy",
apply: "build",
closeBundle() {
for (const [from, to] of copies) {
if (!fs.existsSync(from)) continue;
fs.cpSync(from, path.join(OUTPUT_DIR, to), {
recursive: true,
force: true,
});
}
},
};
}
export default function (eleventyConfig) {
eleventyConfig.addPlugin(EleventyVitePlugin, {
viteOptions: {
appType: "mpa",
plugins: [
svelte(),
restorePassthroughCopy([
["src/assets", "assets"],
["public", "."],
]),
],
resolve: {
alias: {
"/src": path.resolve(".", "src"),
},
},
base: BASE_PATH ? `${BASE_PATH}/` : "/",
build: {
emptyOutDir: false,
},
},
});
eleventyConfig.ignores.add("src/paraglide/**");
eleventyConfig.ignores.add("src/islands/**");
eleventyConfig.addPassthroughCopy("src/assets");
eleventyConfig.addPassthroughCopy({ public: "." });
// Trilingual message lookup for Nunjucks templates: {{ "hero_title1" | t(locale) }}
eleventyConfig.addFilter("t", (key, locale, params = {}) => {
const fn = m[key];
if (!fn) return key;
return fn(params, { locale });
});
eleventyConfig.addGlobalData("locales", locales);
eleventyConfig.addGlobalData("baseLocale", baseLocale);
eleventyConfig.addGlobalData("currentYear", () => new Date().getFullYear());
eleventyConfig.addGlobalData("basePath", BASE_PATH);
eleventyConfig.addFilter("localeHref", (pagePath, locale) => {
const clean = pagePath.replace(/^\/+/, "");
const localePath = locale === baseLocale ? `/${clean}` : `/${locale}/${clean}`;
return BASE_PATH + localePath;
});
// For static/passthrough assets referenced by absolute path outside of
// Vite's own bundling (favicon, manifest, service worker, font preloads —
// anything marked vite-ignore in layouts/base.njk).
eleventyConfig.addFilter("withBase", (assetPath) => BASE_PATH + assetPath);
eleventyConfig.addFilter("dump", (value) => JSON.stringify(value).replace(/</g, "\\u003c"));
eleventyConfig.addFilter("formatDate", (isoDate, locale, options = {}) => {
// new Date("YYYY-MM-DD") parses as UTC midnight, which can roll back a
// day once formatted in a timezone behind UTC (e.g. Guadeloupe, UTC-4).
// Build the date from its local components instead.
const [year, month, day] = isoDate.split("-").map(Number);
return new Date(year, month - 1, day).toLocaleDateString(
locale === "ht" ? "fr" : locale,
{ day: "numeric", month: "long", year: "numeric", ...options }
);
});
return {
dir: {
input: "src",
output: OUTPUT_DIR,
includes: "_includes",
data: "_data",
},
templateFormats: ["njk", "md"],
markdownTemplateEngine: "njk",
htmlTemplateEngine: "njk",
};
}