forked from chrisdoc/hevy-mcp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtsdown.config.ts
More file actions
66 lines (61 loc) · 1.41 KB
/
tsdown.config.ts
File metadata and controls
66 lines (61 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import { readFileSync } from "node:fs";
import { sentryRollupPlugin } from "@sentry/rollup-plugin";
import { defineConfig } from "tsdown";
interface PackageJsonMeta {
name?: unknown;
version?: unknown;
}
const pkgJsonRaw = readFileSync(
new URL("./package.json", import.meta.url),
"utf-8",
);
let parsed: PackageJsonMeta;
try {
parsed = JSON.parse(pkgJsonRaw) as PackageJsonMeta;
} catch (error) {
throw new Error(`Failed to parse package.json: ${(error as Error).message}`);
}
const { name, version } = parsed;
if (
typeof name !== "string" ||
typeof version !== "string" ||
!name ||
!version
) {
throw new Error(
`package.json must provide non-empty string 'name' and 'version'. Got name=${String(
name,
)}, version=${String(version)}`,
);
}
export default defineConfig({
entry: ["src/index.ts", "src/cli.ts"],
format: ["esm"],
target: "esnext",
define: {
__HEVY_MCP_BUILD__: "true",
__HEVY_MCP_NAME__: JSON.stringify(name),
__HEVY_MCP_VERSION__: JSON.stringify(version),
},
sourcemap: true,
clean: true,
dts: true,
banner: {
js: "#!/usr/bin/env node\n// Generated with tsdown\n// https://tsdown.dev",
},
outDir: "dist",
plugins: [
sentryRollupPlugin({
org: process.env.SENTRY_ORG,
project: process.env.SENTRY_PROJECT,
authToken: process.env.SENTRY_AUTH_TOKEN,
telemetry: false,
sourcemaps: {
assets: ["./dist/**/*.map"],
},
release: {
name: version,
},
}),
],
});