Formatting

This commit is contained in:
2025-12-20 13:56:34 -07:00
parent 2e71aea355
commit ad6efdbbbe
6 changed files with 20 additions and 37 deletions

View File

@@ -4,5 +4,4 @@ export interface Game {
official: boolean
verified: boolean
developer: string | null
cutOff: number | null
}

View File

@@ -1,5 +1,5 @@
import { Game } from "./Game"
import { GameVersion } from "./GameVersion"
import { Game } from './Game'
import { GameVersion } from './GameVersion'
export interface ServerVersionsResponse {
versions: GameVersion[]

View File

@@ -25,16 +25,14 @@ export async function readNormalConfig(): Promise<NormalConfig> {
const file = await create('config.json', options)
await file.write(
new TextEncoder().encode(
JSON.stringify(new NormalConfig(version), null, 2),
JSON.stringify(new NormalConfig(version), null, 2)
)
)
await file.close()
return new NormalConfig(version)
}
const config = await readTextFile('config.json', options)
return NormalConfig.import(
JSON.parse(config)
)
return NormalConfig.import(JSON.parse(config))
} catch {
return new NormalConfig(version)
}
@@ -51,18 +49,12 @@ export async function writeNormalConfig(data: NormalConfig) {
await mkdir('', options)
}
const file = await create('config.json', options)
await file.write(
new TextEncoder().encode(
JSON.stringify(data, null, 2)
)
)
await file.write(new TextEncoder().encode(JSON.stringify(data, null, 2)))
await file.close()
} else {
await writeFile(
'config.json',
new TextEncoder().encode(
JSON.stringify(data, null, 2)
),
new TextEncoder().encode(JSON.stringify(data, null, 2)),
options
)
}
@@ -90,9 +82,7 @@ export async function readVersionsConfig(): Promise<VersionsConfig> {
return new VersionsConfig(version)
}
const config = await readTextFile('versions.json', options)
return VersionsConfig.import(
JSON.parse(config)
)
return VersionsConfig.import(JSON.parse(config))
} catch {
return new VersionsConfig(version)
}
@@ -109,18 +99,12 @@ export async function writeVersionsConfig(data: VersionsConfig) {
await mkdir('', options)
}
const file = await create('versions.json', options)
await file.write(
new TextEncoder().encode(
JSON.stringify(data, null, 2)
)
)
await file.write(new TextEncoder().encode(JSON.stringify(data, null, 2)))
await file.close()
} else {
await writeFile(
'versions.json',
new TextEncoder().encode(
JSON.stringify(data, null, 2)
),
new TextEncoder().encode(JSON.stringify(data, null, 2)),
options
)
}