One Calendar is a privacy-first calendar web app built with Next.js. It has modern security features, including e2ee, password-protected sharing, and self-destructing share links ๐Ÿ“… calendar.xyehr.cn
5
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge pull request #233 from EvanTechDev/dev

?

authored by

Evan Huang and committed by
GitHub
0c96557f abcc60e1

+52 -2
+48
lib/gen-locales.mjs
··· 1 + import { promises as fs } from "node:fs" 2 + import path from "node:path" 3 + import { fileURLToPath } from "node:url" 4 + 5 + const __filename = fileURLToPath(import.meta.url) 6 + const __dirname = path.dirname(__filename) 7 + const projectRoot = path.resolve(__dirname, "..") 8 + const localesDir = path.join(projectRoot, "locales") 9 + const outputFile = path.join(projectRoot, "lib", "locales.ts") 10 + 11 + const toIdentifier = (value) => 12 + `locale${value.replace(/[^a-zA-Z0-9]+(.)/g, (_, chr) => chr.toUpperCase()).replace(/^[a-z]/, (chr) => chr.toUpperCase())}` 13 + 14 + const run = async () => { 15 + const localeFiles = (await fs.readdir(localesDir)) 16 + .filter((file) => file.endsWith(".json")) 17 + .sort((a, b) => a.localeCompare(b)) 18 + 19 + if (localeFiles.length === 0) { 20 + throw new Error("No locale json files found in /locales") 21 + } 22 + 23 + const imports = localeFiles 24 + .map((file) => { 25 + const lang = file.replace(/\.json$/, "") 26 + const identifier = toIdentifier(lang) 27 + return `import ${identifier} from "@/locales/${file}"` 28 + }) 29 + .join("\n") 30 + 31 + const entries = localeFiles 32 + .map((file) => { 33 + const lang = file.replace(/\.json$/, "") 34 + const identifier = toIdentifier(lang) 35 + return ` "${lang}": ${identifier},` 36 + }) 37 + .join("\n") 38 + 39 + const content = `/* eslint-disable */\n// This file is auto-generated by lib/gen-locales.mjs\n// Do not edit manually.\n\n${imports}\n\nexport const translations = {\n${entries}\n} as const\n\nexport type Language = keyof typeof translations\n` 40 + 41 + await fs.writeFile(outputFile, content, "utf8") 42 + console.log(`Generated ${path.relative(projectRoot, outputFile)} with ${localeFiles.length} locale(s).`) 43 + } 44 + 45 + run().catch((error) => { 46 + console.error(error) 47 + process.exit(1) 48 + })
+4 -2
package.json
··· 5 5 "packageManager": "bun@1.3.8", 6 6 "scripts": { 7 7 "dev": "next dev", 8 - "build": "next build", 8 + "build": "bun run generate:locales && next build", 9 9 "start": "next start", 10 + "generate:locales": "bun lib/gen-locales.mjs", 10 11 "generate:oauth-metadata": "bun lib/gen-oauth-metadata.mjs" 11 12 }, 12 13 "dependencies": { ··· 67 68 "tailwindcss-animate": "^1.0.7", 68 69 "vaul": "1.1.2", 69 70 "zod": "4.3.6", 70 - "react-icons": "5.6.0" 71 + "react-icons": "5.6.0", 72 + "next-rspack": "latest" 71 73 }, 72 74 "devDependencies": { 73 75 "@tailwindcss/postcss": "4.2.2",