diff --git a/nuxt.config.ts b/nuxt.config.ts index 20eb09f5..8dea34c6 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -71,6 +71,7 @@ export default defineNuxtConfig({ compressPublicAssets: true, prerender: { routes: ["/manifest.webmanifest", "/robots.txt", "/sitemap.xml"], + failOnError: false, }, }, postcss: { diff --git a/package.json b/package.json index 63d57604..aa78c936 100644 --- a/package.json +++ b/package.json @@ -7,10 +7,13 @@ "node": "20.x", "pnpm": "8.x" }, - "packageManager": "pnpm@8.15.4", + "packageManager": "pnpm@8.15.5", "scripts": { "analyze": "nuxt analyze", "build": "nuxt build --dotenv ./.env.local", + "generate": "pnpm generate:server && pnpm generate:reroute-index", + "generate:server": "nuxt generate --dotenv ./.env.local", + "generate:reroute-index": "tsx ./scripts/generate-reroute-index.ts", "dev": "nuxt dev --dotenv ./.env.local", "dev:cms": "decap-server", "format:check": "prettier . \"!./content/**\" --cache --check --ignore-path ./.gitignore", @@ -42,7 +45,7 @@ "@nuxt/content": "^2.12.0", "@nuxt/image": "^1.3.0", "@nuxtjs/color-mode": "^3.3.2", - "@nuxtjs/i18n": "^8.1.1", + "@nuxtjs/i18n": "^8.2.0", "@nuxtjs/mdc": "^0.5.0", "@stefanprobst/netlify-cms-oauth-client": "^0.4.0", "@stefanprobst/openapi-client": "^0.0.3", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 81337d25..580e3f0a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -29,8 +29,8 @@ dependencies: specifier: ^3.3.2 version: 3.3.2(rollup@4.12.0) '@nuxtjs/i18n': - specifier: ^8.1.1 - version: 8.1.1(rollup@4.12.0)(vue@3.4.21) + specifier: ^8.2.0 + version: 8.2.0(rollup@4.12.0)(vue@3.4.21) '@nuxtjs/mdc': specifier: ^0.5.0 version: 0.5.0(rollup@4.12.0) @@ -2074,8 +2074,8 @@ packages: - supports-color dev: false - /@nuxtjs/i18n@8.1.1(rollup@4.12.0)(vue@3.4.21): - resolution: {integrity: sha512-woq2gdXv+soVRc2yeE2pwWODiLnF7fx1eAEXi5Zx+StQDxHegAHTbKX/ZqcsW8VZ3mqlcpzfqN399KCZ9qXJ8g==} + /@nuxtjs/i18n@8.2.0(rollup@4.12.0)(vue@3.4.21): + resolution: {integrity: sha512-t37aF/WOD1g8CA/iCyCJrURXocjPy7diZG+kJcHLkLmJh1v4/2Zhe0AeUsjXubGgvQKLSL3b5w8rZuPkG4yhUw==} engines: {node: ^14.16.0 || >=16.11.0} dependencies: '@intlify/h3': 0.5.0 @@ -2094,6 +2094,7 @@ packages: magic-string: 0.30.7 mlly: 1.6.1 pathe: 1.1.2 + scule: 1.3.0 sucrase: 3.35.0 ufo: 1.4.0 unplugin: 1.7.1 diff --git a/readme.md b/readme.md index 31df09e7..5890524c 100644 --- a/readme.md +++ b/readme.md @@ -102,6 +102,23 @@ To properly configure OAuth, create a "GitHub OAuth App" at The website is deployed via [GitHub action](./.github/workflows/build-deploy.yml). +Or it can be deployed manually: + +As a (currently semi, as data is still being fetched from the API) static website: +```bash +pnpm run generate +``` + +The generated files are in the `.output/public/` directory. + + +As a node.js server: +```bash +pnpm run build +pnpm start +``` + + ### Issues To report bugs, or request new features, file an issue on our diff --git a/scripts/generate-reroute-index.ts b/scripts/generate-reroute-index.ts new file mode 100644 index 00000000..3163ad26 --- /dev/null +++ b/scripts/generate-reroute-index.ts @@ -0,0 +1,27 @@ +import fs from "fs"; + +import { defaultLocale, localesMap } from "../config/i18n.config"; + +console.log("Generating prerender index"); + +const dir = "./.output/public/"; + +if (Object.keys(localesMap).length <= 1) { + console.log("Single or no locales found, skipping rerout index generation"); +} +if (Object.keys(localesMap).length > 1) { + console.log("Multiple locales found, generating reroute index"); + const indexString = ` + + + + + `; + + if (!fs.existsSync(dir)) { + fs.mkdirSync(dir, { recursive: true }); + } + + fs.writeFileSync(dir + "/index.html", indexString); + console.log("Reroute index generated"); +}