docs-i18n 0.5.1 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js
CHANGED
|
@@ -95,7 +95,7 @@ Options:
|
|
|
95
95
|
}
|
|
96
96
|
case "admin": {
|
|
97
97
|
const port = Number(getOpt("port", "3456"));
|
|
98
|
-
const { startAdmin } = await import("./server-
|
|
98
|
+
const { startAdmin } = await import("./server-AD5PLHI5.js");
|
|
99
99
|
await startAdmin(config, port);
|
|
100
100
|
break;
|
|
101
101
|
}
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
// src/admin/server/index.ts
|
|
13
13
|
import { spawn as nodeSpawn } from "child_process";
|
|
14
14
|
import { createServer } from "http";
|
|
15
|
+
import { createRequire } from "module";
|
|
15
16
|
import { resolve as resolve2 } from "path";
|
|
16
17
|
import { Hono as Hono4 } from "hono";
|
|
17
18
|
|
|
@@ -473,9 +474,12 @@ app3.post("/:version/rescan", (c) => {
|
|
|
473
474
|
var status_default = app3;
|
|
474
475
|
|
|
475
476
|
// src/admin/server/index.ts
|
|
477
|
+
var require2 = createRequire(import.meta.url);
|
|
478
|
+
var pkg = require2("../../../package.json");
|
|
476
479
|
async function startAdmin(config, port = 3456) {
|
|
477
480
|
initStatus(config);
|
|
478
481
|
const app4 = new Hono4();
|
|
482
|
+
app4.get("/api/version", (c) => c.json({ version: pkg.version }));
|
|
479
483
|
app4.route("/api/status", status_default);
|
|
480
484
|
app4.route("/api/jobs", jobs_default);
|
|
481
485
|
app4.route("/api/models", models_default);
|
package/package.json
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { spawn as nodeSpawn } from 'node:child_process';
|
|
2
2
|
import { createServer } from 'node:http';
|
|
3
|
+
import { createRequire } from 'node:module';
|
|
3
4
|
import { resolve } from 'node:path';
|
|
4
5
|
import { Hono } from 'hono';
|
|
5
6
|
import type { DocsI18nConfig } from '../../config';
|
|
@@ -8,10 +9,14 @@ import jobRoutes from './routes/jobs';
|
|
|
8
9
|
import modelRoutes from './routes/models';
|
|
9
10
|
import statusRoutes from './routes/status';
|
|
10
11
|
|
|
12
|
+
const require = createRequire(import.meta.url);
|
|
13
|
+
const pkg = require('../../../package.json');
|
|
14
|
+
|
|
11
15
|
export async function startAdmin(config: DocsI18nConfig, port = 3456) {
|
|
12
16
|
initStatus(config);
|
|
13
17
|
|
|
14
18
|
const app = new Hono();
|
|
19
|
+
app.get('/api/version', (c) => c.json({ version: pkg.version }));
|
|
15
20
|
app.route('/api/status', statusRoutes);
|
|
16
21
|
app.route('/api/jobs', jobRoutes);
|
|
17
22
|
app.route('/api/models', modelRoutes);
|
package/src/admin/ui/App.tsx
CHANGED
|
@@ -152,6 +152,12 @@ export function App() {
|
|
|
152
152
|
queryFn: api.status,
|
|
153
153
|
});
|
|
154
154
|
|
|
155
|
+
const { data: versionInfo } = useQuery({
|
|
156
|
+
queryKey: ['version'],
|
|
157
|
+
queryFn: api.version,
|
|
158
|
+
staleTime: Number.POSITIVE_INFINITY,
|
|
159
|
+
});
|
|
160
|
+
|
|
155
161
|
const { data: files } = useQuery({
|
|
156
162
|
queryKey: ['files', version, lang],
|
|
157
163
|
queryFn: () => api.fileCoverage(version, lang as string),
|
|
@@ -206,7 +212,7 @@ export function App() {
|
|
|
206
212
|
return (
|
|
207
213
|
<>
|
|
208
214
|
<nav>
|
|
209
|
-
<h1>🌐 Translation Admin</h1>
|
|
215
|
+
<h1>🌐 Translation Admin {versionInfo?.version && <span className="version-badge">v{versionInfo.version}</span>}</h1>
|
|
210
216
|
<span className="spacer" />
|
|
211
217
|
<button type="button" className="btn" onClick={handleNewJob}>
|
|
212
218
|
+ New Job
|
package/src/admin/ui/lib/api.ts
CHANGED
package/src/admin/ui/styles.css
CHANGED
|
@@ -60,6 +60,19 @@ nav {
|
|
|
60
60
|
nav h1 {
|
|
61
61
|
font-size: 1.1rem;
|
|
62
62
|
font-weight: 700;
|
|
63
|
+
display: flex;
|
|
64
|
+
align-items: center;
|
|
65
|
+
gap: 0.5rem;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.version-badge {
|
|
69
|
+
font-size: 0.7rem;
|
|
70
|
+
font-weight: 500;
|
|
71
|
+
padding: 0.15em 0.5em;
|
|
72
|
+
border-radius: 4px;
|
|
73
|
+
background: var(--accent);
|
|
74
|
+
color: var(--bg);
|
|
75
|
+
opacity: 0.8;
|
|
63
76
|
}
|
|
64
77
|
|
|
65
78
|
/* Utilities */
|