diff --git a/src/commands/stats.tsx b/src/commands/stats.tsx index 2c92ae620..4f29fbda2 100644 --- a/src/commands/stats.tsx +++ b/src/commands/stats.tsx @@ -20,7 +20,7 @@ import { AccountInfo } from '../types/accountInfo.js'; export default { inProduction: true, - inDevelopment: false, + inDevelopment: true, inPublic: true, command: addStatTypeSubCommandGroups( diff --git a/src/core/express/normalizeRouterReturnable.ts b/src/core/express/normalizeRouteReturnable.ts similarity index 53% rename from src/core/express/normalizeRouterReturnable.ts rename to src/core/express/normalizeRouteReturnable.ts index 5e775e089..f630232da 100644 --- a/src/core/express/normalizeRouterReturnable.ts +++ b/src/core/express/normalizeRouteReturnable.ts @@ -1,8 +1,8 @@ -import { RouterReturnable } from '../../server.js'; +import { RouteReturnable } from '../../server.js'; import jsxToSvg from '../node/jsxToSvg.js'; -export default async function normalizeRouterReturnable( - returnable: RouterReturnable, +export default async function normalizeRouteReturnable( + returnable: RouteReturnable, ) { const awaitedReturnable = await returnable; const svg = await jsxToSvg(awaitedReturnable); diff --git a/src/routers/stats.tsx b/src/routes/stats.tsx similarity index 89% rename from src/routers/stats.tsx rename to src/routes/stats.tsx index c6e5c30f0..3ce638a67 100644 --- a/src/routers/stats.tsx +++ b/src/routes/stats.tsx @@ -1,7 +1,7 @@ import resolvePeriodFromRequest from '../core/express/resolvePeriodFromRequest.js'; import resolvePlayerFromRequest from '../core/express/resolvePlayerFromRequest.js'; import stats, { StatType } from '../renderers/stats.js'; -import { RouterRegistry } from '../server.js'; +import { RouteRegistry } from '../server.js'; export default { route: '/stats/:type/:period', @@ -21,4 +21,4 @@ export default { true, ); }, -} satisfies RouterRegistry; +} satisfies RouteRegistry; diff --git a/src/server.ts b/src/server.ts index 1c4c1ea9d..8048bb0fb 100644 --- a/src/server.ts +++ b/src/server.ts @@ -1,12 +1,12 @@ import express, { Request, Response } from 'express'; -import normalizeRouterReturnable from './core/express/normalizeRouterReturnable.js'; +import normalizeRouteReturnable from './core/express/normalizeRouteReturnable.js'; import isDev from './core/node/isDev.js'; import { Registry } from './events/interactionCreate/index.js'; -import stats from './routers/stats.js'; +import stats from './routes/stats.js'; -export type RouterReturnable = JSX.Element | Promise; +export type RouteReturnable = JSX.Element | Promise; -export interface RouterRegistry +export interface RouteRegistry extends Registry { route: string; handlesInteraction?: HandlesInteraction; @@ -14,12 +14,12 @@ export interface RouterRegistry handler: ( req: Request, res: Response, - ) => HandlesInteraction extends true ? void : RouterReturnable; + ) => HandlesInteraction extends true ? void : RouteReturnable; } const app = express(); -([stats] as RouterRegistry[]).forEach((registry) => { +([stats] as RouteRegistry[]).forEach((registry) => { if (!(isDev() ? registry.inDevelopment : registry.inProduction)) return; app.get(registry.route, async (req, res) => { @@ -27,7 +27,7 @@ const app = express(); if (registry.handlesInteraction) return; - const response = await normalizeRouterReturnable(returnable); + const response = await normalizeRouteReturnable(returnable); res.writeHead(200, { 'Content-Type': 'image/svg+xml',