2024-09-06

This commit is contained in:
gcch 2024-09-06 10:47:20 +02:00
commit 082202007b
58 changed files with 247957 additions and 494 deletions

View file

@ -1,13 +1,23 @@
import { fdir } from "fdir";
import { resolve } from "node:path";
import * as v from "valibot";
import { defineConfig } from "vite";
import valibot from "vite-plugin-valibot-env";
const SLUG_THEME = "haiku-atelier-2024";
const SRC_TYPESCRIPT_PATHS = new fdir()
.withBasePath()
.glob("**/*.ts")
.crawl("web/app/themes/haiku-atelier-2024/src/scripts")
.filter((path, isDirectory) => !isDirectory && !path.endsWith("lol.ts"))
.crawl(`web/app/themes/${SLUG_THEME}/src/scripts`)
.withPromise();
/* Voir le fichier vite.env.d.ts */
const SCHEMA_ENVIRONNEMENT = v.object({
VITE_URL: v.pipe(v.string(), v.nonEmpty(), v.url(), v.readonly()),
VITE_GLITCHTIP_NSD: v.pipe(v.string(), v.url(), v.readonly()),
});
export default defineConfig({
base: "",
build: {
@ -21,16 +31,21 @@ export default defineConfig({
input: await SRC_TYPESCRIPT_PATHS,
output: {
assetFileNames: "[name][extname]",
chunkFileNames: "[name][extname]",
entryFileNames: "[name].js",
chunkFileNames: "[name].js",
compact: true,
minifyInternalExports: true,
entryFileNames: "[name].js",
validate: true,
},
treeshake: "recommended",
treeshake: "smallest",
},
sourcemap: true,
reportCompressedSize: true,
target: "es2023",
watch: { clearScreen: false },
write: true,
},
plugins: [
/* Permet de valider les variables d'environnements définies à partir d'un schéma Valibot */
valibot(SCHEMA_ENVIRONNEMENT),
],
});