Formatting
This commit is contained in:
@@ -4,5 +4,4 @@ export interface Game {
|
|||||||
official: boolean
|
official: boolean
|
||||||
verified: boolean
|
verified: boolean
|
||||||
developer: string | null
|
developer: string | null
|
||||||
cutOff: number | null
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { Game } from "./Game"
|
import { Game } from './Game'
|
||||||
import { GameVersion } from "./GameVersion"
|
import { GameVersion } from './GameVersion'
|
||||||
|
|
||||||
export interface ServerVersionsResponse {
|
export interface ServerVersionsResponse {
|
||||||
versions: GameVersion[]
|
versions: GameVersion[]
|
||||||
|
|||||||
@@ -25,16 +25,14 @@ export async function readNormalConfig(): Promise<NormalConfig> {
|
|||||||
const file = await create('config.json', options)
|
const file = await create('config.json', options)
|
||||||
await file.write(
|
await file.write(
|
||||||
new TextEncoder().encode(
|
new TextEncoder().encode(
|
||||||
JSON.stringify(new NormalConfig(version), null, 2),
|
JSON.stringify(new NormalConfig(version), null, 2)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
await file.close()
|
await file.close()
|
||||||
return new NormalConfig(version)
|
return new NormalConfig(version)
|
||||||
}
|
}
|
||||||
const config = await readTextFile('config.json', options)
|
const config = await readTextFile('config.json', options)
|
||||||
return NormalConfig.import(
|
return NormalConfig.import(JSON.parse(config))
|
||||||
JSON.parse(config)
|
|
||||||
)
|
|
||||||
} catch {
|
} catch {
|
||||||
return new NormalConfig(version)
|
return new NormalConfig(version)
|
||||||
}
|
}
|
||||||
@@ -51,18 +49,12 @@ export async function writeNormalConfig(data: NormalConfig) {
|
|||||||
await mkdir('', options)
|
await mkdir('', options)
|
||||||
}
|
}
|
||||||
const file = await create('config.json', options)
|
const file = await create('config.json', options)
|
||||||
await file.write(
|
await file.write(new TextEncoder().encode(JSON.stringify(data, null, 2)))
|
||||||
new TextEncoder().encode(
|
|
||||||
JSON.stringify(data, null, 2)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
await file.close()
|
await file.close()
|
||||||
} else {
|
} else {
|
||||||
await writeFile(
|
await writeFile(
|
||||||
'config.json',
|
'config.json',
|
||||||
new TextEncoder().encode(
|
new TextEncoder().encode(JSON.stringify(data, null, 2)),
|
||||||
JSON.stringify(data, null, 2)
|
|
||||||
),
|
|
||||||
options
|
options
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -90,9 +82,7 @@ export async function readVersionsConfig(): Promise<VersionsConfig> {
|
|||||||
return new VersionsConfig(version)
|
return new VersionsConfig(version)
|
||||||
}
|
}
|
||||||
const config = await readTextFile('versions.json', options)
|
const config = await readTextFile('versions.json', options)
|
||||||
return VersionsConfig.import(
|
return VersionsConfig.import(JSON.parse(config))
|
||||||
JSON.parse(config)
|
|
||||||
)
|
|
||||||
} catch {
|
} catch {
|
||||||
return new VersionsConfig(version)
|
return new VersionsConfig(version)
|
||||||
}
|
}
|
||||||
@@ -109,18 +99,12 @@ export async function writeVersionsConfig(data: VersionsConfig) {
|
|||||||
await mkdir('', options)
|
await mkdir('', options)
|
||||||
}
|
}
|
||||||
const file = await create('versions.json', options)
|
const file = await create('versions.json', options)
|
||||||
await file.write(
|
await file.write(new TextEncoder().encode(JSON.stringify(data, null, 2)))
|
||||||
new TextEncoder().encode(
|
|
||||||
JSON.stringify(data, null, 2)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
await file.close()
|
await file.close()
|
||||||
} else {
|
} else {
|
||||||
await writeFile(
|
await writeFile(
|
||||||
'versions.json',
|
'versions.json',
|
||||||
new TextEncoder().encode(
|
new TextEncoder().encode(JSON.stringify(data, null, 2)),
|
||||||
JSON.stringify(data, null, 2)
|
|
||||||
),
|
|
||||||
options
|
options
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user