mirror of
https://github.com/the1812/Bilibili-Evolved.git
synced 2025-11-04 21:22:45 +08:00
22 lines
529 B
TypeScript
22 lines
529 B
TypeScript
import { readFileSync, existsSync } from 'fs'
|
|
|
|
interface DevServerConfig {
|
|
port?: number
|
|
maxWatchers?: number
|
|
}
|
|
const configFile = (path: string) => () => (
|
|
existsSync(path)
|
|
? JSON.parse(readFileSync(path, { encoding: 'utf-8' }))
|
|
: {}
|
|
)
|
|
const configSource: (() => DevServerConfig)[] = [
|
|
() => ({
|
|
port: 23333,
|
|
maxWatchers: 16,
|
|
}),
|
|
configFile('dev/dev-server.json'),
|
|
]
|
|
export const devServerConfig = configSource.reduce((previous, current) => (
|
|
{ ...previous, ...current() }
|
|
), {} as DevServerConfig)
|