Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/observability-cloud-sdk-version.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@openuidev/observability-cloud": patch
---

`SDK_VERSION` is now derived from package.json at build time instead of a
hardcoded constant that had drifted (wire envelopes previously reported
`0.0.1` regardless of the released version).
6 changes: 4 additions & 2 deletions packages/observability-cloud/src/core/wire.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import type { ObservabilityLevel } from "@openuidev/observability";
import type { StreamWireEvent } from "../events/stream";

/** Must be kept in sync with packages/observability-cloud/package.json on release. */
export const SDK_VERSION = "0.0.1";
declare const __SDK_VERSION__: string;

/** Injected from package.json at build time (tsdown define; vitest.config.ts mirrors it for tests). */
export const SDK_VERSION = __SDK_VERSION__;

export interface WireEventBase {
id: string;
Expand Down
8 changes: 8 additions & 0 deletions packages/observability-cloud/tsdown.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
import { readFileSync } from "node:fs";
import { defineConfig } from "tsdown";

const { version } = JSON.parse(readFileSync(new URL("./package.json", import.meta.url), "utf8")) as {
version: string;
};

export default defineConfig({
entry: ["src/index.ts"],
define: {
__SDK_VERSION__: JSON.stringify(version),
},
format: ["esm", "cjs"],
dts: true,
sourcemap: true,
Expand Down
13 changes: 13 additions & 0 deletions packages/observability-cloud/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { readFileSync } from "node:fs";
import { defineConfig } from "vitest/config";

const { version } = JSON.parse(readFileSync(new URL("./package.json", import.meta.url), "utf8")) as {
version: string;
};

export default defineConfig({
define: {
// Mirrors the tsdown define so src imports resolve SDK_VERSION in tests.
__SDK_VERSION__: JSON.stringify(version),
},
});
Loading