Add Prettier and ESLint tooling (Refs #77)

This commit is contained in:
2026-10-09 15:56:13 -04:00
parent 8ed059b8d3
commit 16469e2d43
711 changed files with 99737 additions and 28286 deletions
+35 -6
View File
@@ -7,13 +7,26 @@ import { applyRuntimePassword } from './runtime-config.js';
export const MAP_CONFIG_FILE = 'electric_cherry_map.cfg';
/** Loaded after Plutainer's default/main config and before map_rotate. */
export function getServerMapConfig(game: string | null, map: string | null, mapSlug?: string | null): Buffer | null {
export function getServerMapConfig(
game: string | null,
map: string | null,
mapSlug?: string | null
): Buffer | null {
const entry = selectedZombieMap(game, map, mapSlug);
return entry ? Buffer.from(`// Generated by Electric Cherry from the selected map.\nset sv_maprotation "${mapRotation(entry)}"\n`) : null;
return entry
? Buffer.from(
`// Generated by Electric Cherry from the selected map.\nset sv_maprotation "${mapRotation(entry)}"\n`
)
: null;
}
/** The promoted config used for first boot and drift reconciliation. */
export function getPromotedServerConfig(game: string | null, map: string | null, mapSlug?: string | null, rconPassword?: string | null): Buffer | null {
export function getPromotedServerConfig(
game: string | null,
map: string | null,
mapSlug?: string | null,
rconPassword?: string | null
): Buffer | null {
if (!game) return null;
const baseline = getBaselineForScope('game', game);
if (!baseline?.current_version_id) return null;
@@ -24,8 +37,24 @@ export function getPromotedServerConfig(game: string | null, map: string | null,
...listPromotedOverlaysForScope('game', game),
...(map ? listPromotedOverlaysForScope('map', map) : [])
].flatMap((overlay) => {
const current = overlay.current_version_id ? getVersion(overlay.current_version_id) : undefined;
return current ? [{ id: overlay.id, text: getVersionContent(current.id).toString('utf8') }] : [];
const current = overlay.current_version_id
? getVersion(overlay.current_version_id)
: undefined;
return current
? [{ id: overlay.id, text: getVersionContent(current.id).toString('utf8') }]
: [];
});
return Buffer.from(applyRuntimePassword(composeServerCfg(getVersionContent(version.id).toString('utf8'), overlays, game, map, mapSlug), rconPassword), 'utf8');
return Buffer.from(
applyRuntimePassword(
composeServerCfg(
getVersionContent(version.id).toString('utf8'),
overlays,
game,
map,
mapSlug
),
rconPassword
),
'utf8'
);
}