@@ -3,6 +3,7 @@ import { defineConfig } from 'vite'
33import vue from '@vitejs/plugin-vue'
44import { VitePWA } from 'vite-plugin-pwa'
55import VueI18nPlugin from '@intlify/unplugin-vue-i18n/vite'
6+ import fs from 'node:fs'
67import path from 'node:path'
78import { description , appDeployName } from './package.json'
89import legacy from '@vitejs/plugin-legacy'
@@ -61,6 +62,18 @@ export default defineConfig({
6162 include : [ path . resolve ( __dirname , './src/locales/**' ) ] ,
6263 strictMessage : false
6364 } ) ,
65+ // generate languages.json metadata for the brdgm.github.io game index
66+ {
67+ name : 'generate-languages-json' ,
68+ writeBundle ( ) {
69+ const localesDir = path . resolve ( __dirname , './src/locales' )
70+ const languages = fs . readdirSync ( localesDir )
71+ . filter ( f => f . endsWith ( '.json' ) )
72+ . map ( f => f . replace ( '.json' , '' ) )
73+ const outDir = path . resolve ( __dirname , './dist' )
74+ fs . writeFileSync ( path . resolve ( outDir , 'languages.json' ) , JSON . stringify ( languages ) )
75+ }
76+ } ,
6477 // support older browsers
6578 legacy ( {
6679 modernTargets : 'iOS >= 15, Safari >= 15' ,
0 commit comments