chore: scaffold astro frontend with static output

This commit is contained in:
devilreef 2026-04-30 09:23:32 +06:00
parent 6bec95a563
commit f1a0d1ddef
Signed by: devilreef
SSH key fingerprint: SHA256:UZisRr4iuXx+IhkbZnR655L2RWAT6o2rgbGv5F/6m3Y
8 changed files with 10277 additions and 0 deletions

6
frontend/.gitignore vendored Normal file
View file

@ -0,0 +1,6 @@
node_modules/
dist/
.astro/
.env
.env.local
*.log

19
frontend/astro.config.mjs Normal file
View file

@ -0,0 +1,19 @@
// @ts-check
import { defineConfig } from 'astro/config';
import node from '@astrojs/node';
import react from '@astrojs/react';
// astro 5 merged 'hybrid' into 'static' + per-route `export const prerender = false`.
// the node adapter is required so api endpoints can actually run on demand.
export default defineConfig({
output: 'static',
adapter: node({ mode: 'standalone' }),
integrations: [react()],
server: {
host: process.env.HOST || '0.0.0.0',
port: Number(process.env.PORT) || 3000,
},
vite: {
server: { fs: { strict: true } },
},
});

13
frontend/eslint.config.js Normal file
View file

@ -0,0 +1,13 @@
import tseslint from 'typescript-eslint';
export default tseslint.config(
{ ignores: ['dist', 'node_modules', '.astro'] },
...tseslint.configs.recommended,
{
rules: {
'@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
'@typescript-eslint/no-explicit-any': 'error',
'no-console': ['warn', { allow: ['warn', 'error'] }],
},
},
);

10169
frontend/package-lock.json generated Normal file

File diff suppressed because it is too large Load diff

37
frontend/package.json Normal file
View file

@ -0,0 +1,37 @@
{
"name": "denpa-frontend",
"version": "0.1.0",
"private": true,
"type": "module",
"scripts": {
"dev": "astro dev",
"build": "astro build",
"start": "node ./dist/server/entry.mjs",
"preview": "astro preview",
"check": "astro check",
"lint": "eslint src",
"test": "vitest run",
"test:watch": "vitest"
},
"dependencies": {
"@astrojs/node": "^9.0.0",
"@astrojs/react": "^4.0.0",
"astro": "^5.0.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"yaml": "^2.5.0"
},
"devDependencies": {
"@astrojs/check": "^0.9.9",
"@testing-library/react": "^16.0.0",
"@types/node": "^25.6.0",
"@types/react": "^18.3.0",
"@types/react-dom": "^18.3.0",
"@vitest/ui": "^2.0.0",
"eslint": "^9.0.0",
"happy-dom": "^15.0.0",
"typescript": "^5.9.3",
"typescript-eslint": "^8.0.0",
"vitest": "^2.0.0"
}
}

9
frontend/src/env.d.ts vendored Normal file
View file

@ -0,0 +1,9 @@
/// <reference types="astro/client" />
declare namespace NodeJS {
interface ProcessEnv {
LIBRARY_ROOT?: string;
DATA_ROOT?: string;
PUBLIC_ORIGIN?: string;
}
}

15
frontend/tsconfig.json Normal file
View file

@ -0,0 +1,15 @@
{
"extends": "astro/tsconfigs/strict",
"include": ["src/**/*", "astro.config.mjs"],
"exclude": ["dist", "node_modules"],
"compilerOptions": {
"jsx": "react-jsx",
"jsxImportSource": "react",
"baseUrl": ".",
"paths": {
"@lib/*": ["src/lib/*"],
"@components/*": ["src/components/*"],
"@styles/*": ["src/styles/*"]
}
}
}

View file

@ -0,0 +1,9 @@
import { defineConfig } from 'vitest/config';
export default defineConfig({
test: {
environment: 'happy-dom',
include: ['src/tests/**/*.test.ts', 'src/tests/**/*.test.tsx'],
globals: false,
},
});