1
0

feat: 版本管理,package.json 唯一版本源、/api/meta 返回版本、Dashboard Header 展示版本号

This commit is contained in:
2026-05-20 19:14:37 +08:00
parent f3df3a203b
commit 8eac814cc6
25 changed files with 490 additions and 20 deletions

View File

@@ -77,6 +77,7 @@ function createHarness(overrides: BootstrapDependencies = {}) {
startServer(options) {
expect(options.config).toEqual({ host: config.host, port: config.port });
expect(options.store).toBe(store);
expect(options.version).toBe("0.1.0");
calls.push(`startServer:${options.mode}`);
},
...overrides,
@@ -89,7 +90,7 @@ describe("bootstrap", () => {
test("开发模式执行完整启动序列", async () => {
const { calls, dependencies } = createHarness();
await bootstrap({ configPath: "/tmp/probes.yaml", mode: "development" }, dependencies);
await bootstrap({ configPath: "/tmp/probes.yaml", mode: "development", version: "0.1.0" }, dependencies);
expect(calls).toEqual([
"loadConfig:/tmp/probes.yaml",
@@ -106,7 +107,7 @@ describe("bootstrap", () => {
test("收到退出信号时停止 engine 并关闭 store", async () => {
const { calls, dependencies, shutdownHandlers } = createHarness();
await bootstrap({ configPath: "/tmp/probes.yaml", mode: "development" }, dependencies);
await bootstrap({ configPath: "/tmp/probes.yaml", mode: "development", version: "0.1.0" }, dependencies);
expect(() => shutdownHandlers.get("SIGINT")!()).toThrow("exit:0");
@@ -122,7 +123,7 @@ describe("bootstrap", () => {
let error: unknown;
try {
await bootstrap({ configPath: "/tmp/probes.yaml", mode: "development" }, dependencies);
await bootstrap({ configPath: "/tmp/probes.yaml", mode: "development", version: "0.1.0" }, dependencies);
} catch (caught) {
error = caught;
}