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

2
.gitignore vendored
View File

@@ -6,7 +6,7 @@ deno.lock
node_modules/ node_modules/
# Build outputs # Build outputs
dist_serve/ ts_bundled/
# Development # Development
.nogit/ .nogit/

View File

@@ -1,5 +1,14 @@
# Changelog # Changelog
## 2026-02-24 - 2.1.0 - feat(opsserver)
switch to TypedServer and serve bundled UI assets; add index.html; update bundling output and dev watch configuration
- Replace UtilityWebsiteServer with TypedServer and load bundledContent from ts_bundled/bundle.ts; enable cors, spaFallback, injectReload, watch, and compression
- Add a minimal index.html SPA entry and include it in the bundle so it is served from the bundled assets
- Change tsbundle output to ./ts_bundled/bundle.ts with outputMode 'base64ts' and includeFiles ['./index.html']
- Add a tswatch bundle config and replace the previous watcher with a backend watcher that runs the server via 'deno run --allow-all mod.ts server' (restart enabled)
- Bump devDependency @git.zone/tswatch from ^2.3.13 to ^3.1.0 and update .gitignore to ignore ts_bundled/
## 2026-02-24 - 2.0.0 - BREAKING CHANGE(providers) ## 2026-02-24 - 2.0.0 - BREAKING CHANGE(providers)
switch GitLab and Gitea providers to use @apiclient.xyz client libraries and export clients via plugins switch GitLab and Gitea providers to use @apiclient.xyz client libraries and export clients via plugins

33
index.html Normal file
View File

@@ -0,0 +1,33 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta
name="viewport"
content="user-scalable=0, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height"
/>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="theme-color" content="#000000" />
<title>GitOps</title>
<link rel="preconnect" href="https://assetbroker.lossless.one/" crossorigin>
<link rel="stylesheet" href="https://assetbroker.lossless.one/fonts/fonts.css">
<style>
html {
-ms-text-size-adjust: 100%;
-webkit-text-size-adjust: 100%;
}
body {
position: relative;
background: #000;
margin: 0px;
}
</style>
</head>
<body>
<noscript>
<p style="color: #fff; text-align: center; margin-top: 100px;">
JavaScript is required to run the GitOps dashboard.
</p>
</noscript>
</body>
<script defer type="module" src="/bundle.js"></script>
</html>

View File

@@ -3,19 +3,29 @@
"bundles": [ "bundles": [
{ {
"from": "./ts_web/index.ts", "from": "./ts_web/index.ts",
"to": "./dist_serve/bundle.js", "to": "./ts_bundled/bundle.ts",
"outputMode": "bundle", "outputMode": "base64ts",
"bundler": "esbuild", "bundler": "esbuild",
"production": true "production": true,
"includeFiles": ["./index.html"]
} }
] ]
}, },
"@git.zone/tswatch": { "@git.zone/tswatch": {
"bundles": [
{
"from": "./ts_web/index.ts",
"to": "./ts_bundled/bundle.ts",
"watchPatterns": ["./ts_web/**/*"],
"triggerReload": true
}
],
"watchers": [ "watchers": [
{ {
"name": "ui-bundle", "name": "backend",
"watch": "./ts_web/**/*", "watch": "./ts/**/*",
"command": "tsbundle", "command": "deno run --allow-all mod.ts server",
"restart": true,
"debounce": 500, "debounce": 500,
"runOnStart": true "runOnStart": true
} }

View File

@@ -18,6 +18,6 @@
}, },
"devDependencies": { "devDependencies": {
"@git.zone/tsbundle": "^2.8.3", "@git.zone/tsbundle": "^2.8.3",
"@git.zone/tswatch": "^2.3.13" "@git.zone/tswatch": "^3.1.0"
} }
} }

View File

@@ -3,6 +3,6 @@
*/ */
export const commitinfo = { export const commitinfo = {
name: '@serve.zone/gitops', name: '@serve.zone/gitops',
version: '2.0.0', version: '2.1.0',
description: 'GitOps management app for Gitea and GitLab - manage secrets, browse projects, view CI pipelines, and stream build logs' description: 'GitOps management app for Gitea and GitLab - manage secrets, browse projects, view CI pipelines, and stream build logs'
} }

View File

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

View File

@@ -3,6 +3,6 @@
*/ */
export const commitinfo = { export const commitinfo = {
name: '@serve.zone/gitops', name: '@serve.zone/gitops',
version: '2.0.0', version: '2.1.0',
description: 'GitOps management app for Gitea and GitLab - manage secrets, browse projects, view CI pipelines, and stream build logs' description: 'GitOps management app for Gitea and GitLab - manage secrets, browse projects, view CI pipelines, and stream build logs'
} }