Skip to content
Merged
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
5 changes: 5 additions & 0 deletions packages/server/scripts/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,17 @@ const repoRoot = join(import.meta.dirname, "..", "..", "..");
* buildServer builds the CLI for the server.
*/
async function buildServer() {
const gitSha = execSync("git rev-parse --short HEAD").toString().trim();

await build({
entrypoints: [join(__dirname, "..", "src", "cli.ts")],
outdir: "dist",
target: "node",
format: "esm",
minify: true,
define: {
__GIT_SHA__: JSON.stringify(gitSha),
},
});
}

Expand Down
6 changes: 5 additions & 1 deletion packages/server/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import boxen from "boxen";
import chalk from "chalk";
import { Command } from "commander";
import { version } from "../package.json";
import { version as packageVersion } from "../package.json";
import {
CLI_OPTION_DEFINITIONS,
getOrGenerateAuthSecret,
Expand All @@ -20,6 +20,10 @@ import { ensurePostgres } from "./postgres";
import { startServer } from "./server";
import { startTunnelProxy } from "./tunnel";

declare const __GIT_SHA__: string | undefined;
const versionSuffix = typeof __GIT_SHA__ !== "undefined" ? __GIT_SHA__ : "dev";
const version = `${packageVersion}+${versionSuffix}`;

const program = new Command();

program
Expand Down