mirror of
https://github.com/kuhyx/steam-backlog-enforcer.git
synced 2026-11-10 18:07:07 +01:00
Some checks failed
dependency freshness / dependencies on newest stable (push) Has been cancelled
md-naming / markdown naming convention (push) Has been cancelled
pre-commit / pre-commit (${{ matrix.group }}) (mypy, mypy, ) (push) Has been cancelled
pre-commit / pre-commit (${{ matrix.group }}) (pylint, pylint, ) (push) Has been cancelled
pre-commit / pre-commit (${{ matrix.group }}) (rest, , mypy,pylint) (push) Has been cancelled
Tests / test (push) Has been cancelled
Tests / web-coverage (push) Has been cancelled
repo-contract / repo contract (push) Has been cancelled
Todo: 9b9342ba
34 lines
1.3 KiB
JavaScript
34 lines
1.3 KiB
JavaScript
import { defineConfig } from 'astro/config'
|
|
|
|
// Static pages, one directory per section (`dist/library/index.html`), served
|
|
// by steam_backlog_enforcer._web_server, which injects the per-launch token
|
|
// into every page. In dev, `/api` is proxied to the Python server (SBE_PORT,
|
|
// default 8000) presenting itself as that server's own origin so its
|
|
// DNS-rebinding and origin checks pass; `--mode mock` (pnpm dev:mock) swaps
|
|
// the proxy for the in-memory contract mock in mock/. Both are dev-only:
|
|
// nothing here reaches `astro build` output.
|
|
const apiPort = process.env.SBE_PORT ?? '8000'
|
|
const apiOrigin = `http://127.0.0.1:${apiPort}`
|
|
const mode = process.argv.includes('--mode') ? process.argv[process.argv.indexOf('--mode') + 1] : ''
|
|
|
|
// The dev token meta comes from src/components/DevToken.astro (dev only).
|
|
async function devPlugins() {
|
|
if (mode !== 'mock') return []
|
|
const { mockApi } = await import('./mock/plugin.ts')
|
|
return [mockApi()]
|
|
}
|
|
|
|
export default defineConfig({
|
|
output: 'static',
|
|
build: { format: 'directory', assets: 'assets' },
|
|
trailingSlash: 'ignore',
|
|
devToolbar: { enabled: false },
|
|
vite: {
|
|
plugins: process.argv.includes('dev') ? await devPlugins() : [],
|
|
server:
|
|
mode === 'mock'
|
|
? {}
|
|
: { proxy: { '/api': { target: apiOrigin, changeOrigin: true, headers: { Origin: apiOrigin } } } },
|
|
},
|
|
})
|