feat(opsserver): switch to TypedServer and serve bundled UI assets; add index.html; update bundling output and dev watch configuration

This commit is contained in:
2026-02-24 13:47:44 +00:00
parent e5eb6b7582
commit 0d9e76bf94
8 changed files with 73 additions and 17 deletions

View File

@@ -2,11 +2,12 @@ import * as plugins from '../plugins.ts';
import { logger } from '../logging.ts';
import type { GitopsApp } from '../classes/gitopsapp.ts';
import * as handlers from './handlers/index.ts';
import { files as bundledFiles } from '../../ts_bundled/bundle.ts';
export class OpsServer {
public gitopsAppRef: GitopsApp;
public typedrouter = new plugins.typedrequest.TypedRouter();
public server!: plugins.typedserver.utilityservers.UtilityWebsiteServer;
public server!: plugins.typedserver.TypedServer;
// Handler instances
public adminHandler!: handlers.AdminHandler;
@@ -22,11 +23,14 @@ export class OpsServer {
}
public async start(port = 3000) {
const absoluteServeDir = plugins.path.resolve('./dist_serve');
this.server = new plugins.typedserver.utilityservers.UtilityWebsiteServer({
domain: 'localhost',
feedMetadata: undefined,
serveDir: absoluteServeDir,
this.server = new plugins.typedserver.TypedServer({
port,
cors: true,
bundledContent: bundledFiles,
spaFallback: true,
injectReload: true,
watch: true,
compression: true,
});
// Chain typedrouters
@@ -35,7 +39,7 @@ export class OpsServer {
// Set up all handlers
await this.setupHandlers();
await this.server.start(port);
await this.server.start();
logger.success(`OpsServer started on http://localhost:${port}`);
}