chore: scaffold Nuxt 4 client with ssr off, pnpm and en i18n

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Fabian @ Blax Software 2026-10-28 17:57:43 +01:00
parent 86515ef912
commit 90c4611f1f
12 changed files with 8239 additions and 0 deletions

28
.gitignore vendored Normal file
View File

@ -0,0 +1,28 @@
# Nuxt build output
.nuxt
.output
.data
.nitro
.cache
dist
# Node
node_modules
*.log
*.tsbuildinfo
# Generated i18n bundles
i18n/.messages
# Env (commit only the example)
.env
.env.*
!.env.example
# IDE
.vscode
.idea
*.swp
# OS
.DS_Store

9
i18n/i18n.config.ts Normal file
View File

@ -0,0 +1,9 @@
import messages from './messageloader'
// With a second locale, switch fallbackLocale to fallbackChain() from @blax-software/i18n.
export default defineI18nConfig(() => ({
legacy: false,
locale: 'en',
fallbackLocale: 'en',
messages,
}))

42
i18n/locales/en.ts Normal file
View File

@ -0,0 +1,42 @@
export default {
app: {
title: 'Village Politics',
worlds: 'Worlds',
logout: 'Log out',
mock: 'Mock server, no backend',
connected: 'Connected',
offline: 'Offline',
},
common: {
loading: 'Loading…',
},
resources: {
wood: 'Wood',
clay: 'Clay',
iron: 'Iron',
food: 'Food',
},
buildings: {
headquarters: 'Headquarters',
storage: 'Storage',
farm: 'Farm',
timber_camp: 'Timber camp',
clay_pit: 'Clay pit',
iron_mine: 'Iron mine',
hiding_place: 'Hiding place',
wall: 'Wall',
rally_point: 'Rally point',
},
errors: {
unknown: 'Something went wrong.',
unauthenticated: 'Please log in again.',
invalid_credentials: 'Wrong email or password.',
email_taken: 'This email is already registered.',
not_found: 'Not found.',
no_space: 'That spot is taken or outside the village.',
max_per_village: 'Only one of these per village.',
max_level: 'Already at max level.',
resources: 'Not enough resources.',
core_building: 'Core buildings cannot go below level 0.',
},
}

12
i18n/messageloader.ts Normal file
View File

@ -0,0 +1,12 @@
import { mergeMessages } from '@blax-software/i18n'
import networking from '@blax-software/networking/i18n'
import en from './locales/en'
import auth from './pages/auth'
import village from './pages/village'
import worlds from './pages/worlds'
// Explicit imports instead of import.meta.glob: @nuxtjs/i18n also loads this file in the
// Nitro build, where glob imports don't exist. Add new page files here, in path order.
export default mergeMessages({ en }, [auth, village, worlds], { packages: [networking] }) as {
en: Record<string, any>
}

22
i18n/pages/auth.ts Normal file
View File

@ -0,0 +1,22 @@
import type { TranslationFile } from '@blax-software/i18n'
export default {
en: {
auth: {
name: 'Player name',
email: 'Email',
password: 'Password',
mock_hint: 'Mock server: any email and password work.',
login: {
title: 'Log in',
submit: 'Log in',
to_register: 'No account yet? Register',
},
register: {
title: 'Register',
submit: 'Create account',
to_login: 'Already registered? Log in',
},
},
},
} satisfies TranslationFile

75
i18n/pages/village.ts Normal file
View File

@ -0,0 +1,75 @@
import type { TranslationFile } from '@blax-software/i18n'
export default {
en: {
village: {
resources: {
title: 'Resources',
cap: 'Storage cap',
per_hour: '{rate}/h',
},
population: {
title: 'Population',
food_budget: 'Food budget',
upkeep: 'Upkeep',
villagers: 'Villagers',
workers: 'Working',
idle: 'Idle',
soldiers: 'Soldiers',
food_per_hour: '{value} food/h',
},
buildings: {
title: 'Buildings',
type: 'Building',
level: 'Level',
position: 'Position',
size: 'Size',
workers: 'Workers',
staffing: 'Staffing',
output: 'Output',
priority: 'Priority',
actions: 'Actions',
upgrade: 'Upgrade to {level}',
demolish: 'Demolish',
refund: 'refund',
},
grid: {
title: 'Village grid',
hint: 'Click a free cell to choose where the next building goes.',
planned: 'planned',
},
build: {
title: 'New building',
type: 'Building',
size: 'Size',
cost: 'Cost',
time: 'Time',
status: 'Status',
position: 'Position',
auto: 'First free slot',
at_cell: 'Selected cell',
submit: 'Build',
},
queue: {
title: 'Build queue',
builders: 'Builders: {count}',
empty: 'Nothing queued.',
order: 'Order',
builder: 'Builder',
remaining: 'Done in',
waiting: 'Waiting',
cancel: 'Cancel',
build: 'Build {type}',
upgrade: '{type} to level {level}',
demolish: '{type} down to level {level}',
remove: 'Remove {type}',
},
blocked: {
max_per_village: 'Only one per village',
no_space: 'No free space',
max_level: 'Max level',
resources: 'Not enough resources',
},
},
},
} satisfies TranslationFile

16
i18n/pages/worlds.ts Normal file
View File

@ -0,0 +1,16 @@
import type { TranslationFile } from '@blax-software/i18n'
export default {
en: {
worlds: {
title: 'Worlds',
name: 'World',
speed: 'Speed',
village: 'Your village',
join: 'Join',
open: 'Open village',
none: 'No worlds yet.',
reset: 'Reset mock data',
},
},
} satisfies TranslationFile

27
nuxt.config.ts Normal file
View File

@ -0,0 +1,27 @@
// One static SPA build serves the web and the later Steam wrapper, so no SSR anywhere.
export default defineNuxtConfig({
compatibilityDate: '2026-10-28',
ssr: false,
devtools: { enabled: false },
modules: ['@nuxtjs/i18n'],
i18n: {
defaultLocale: 'en',
strategy: 'no_prefix',
locales: [{ code: 'en', name: 'English' }],
vueI18n: 'i18n.config.ts',
},
// Override per environment with NUXT_PUBLIC_<KEY>, e.g. NUXT_PUBLIC_MOCK_SERVER=false.
runtimeConfig: {
public: {
SERVER_URL: 'https://server-village.localhost.at',
WEBS_URL: 'ws-server-village.localhost.at',
WS_PROTOCOL: 'wss',
PUSHER_APP_KEY: 'websocket',
// Until the backend exists, an in-browser fake answers the same WS intents (app/mock/).
MOCK_SERVER: true,
},
},
})

27
package.json Normal file
View File

@ -0,0 +1,27 @@
{
"name": "game-village-politics-frontend",
"private": true,
"type": "module",
"scripts": {
"dev": "nuxt dev",
"build": "nuxt build",
"generate": "nuxt generate",
"preview": "nuxt preview",
"postinstall": "nuxt prepare",
"typecheck": "nuxt typecheck",
"i18n:check": "blax-i18n check --src i18n --locales en --packages auto"
},
"packageManager": "pnpm@12.16.1",
"dependencies": {
"@blax-software/i18n": "^0.2.0",
"@blax-software/networking": "^0.4.0",
"@nuxtjs/i18n": "^10.6.0",
"nuxt": "^4.6.3",
"vue": "^3.5.44",
"vue-router": "^5.4.0"
},
"devDependencies": {
"typescript": "^5.9.3",
"vue-tsc": "^3.3.13"
}
}

7967
pnpm-lock.yaml Normal file

File diff suppressed because it is too large Load Diff

5
pnpm-workspace.yaml Normal file
View File

@ -0,0 +1,5 @@
# pnpm only runs install scripts for packages allowed here.
# esbuild downloads its platform binary in a postinstall step.
allowBuilds:
esbuild: true
'@parcel/watcher': true

9
tsconfig.json Normal file
View File

@ -0,0 +1,9 @@
{
"files": [],
"references": [
{ "path": "./.nuxt/tsconfig.app.json" },
{ "path": "./.nuxt/tsconfig.server.json" },
{ "path": "./.nuxt/tsconfig.shared.json" },
{ "path": "./.nuxt/tsconfig.node.json" }
]
}