diff --git a/deploy/mod.ts b/deploy/mod.ts index a5dc85e..a7792d5 100644 --- a/deploy/mod.ts +++ b/deploy/mod.ts @@ -2,6 +2,7 @@ import { Command, ValidationError } from "@cliffy/command"; import { green, red, yellow } from "@std/fmt/colors"; import { error, renderTemporalTimestamp } from "../util.ts"; import { createSwitchCommand, type GlobalContext } from "../main.ts"; +import { VERSION } from "../version.ts"; import { actionHandler, getApp, getOrg } from "../config.ts"; import { publish } from "./publish.ts"; import { setupAws, setupGcp } from "./setup-cloud.ts"; @@ -181,6 +182,7 @@ const logoutCommand = new Command() export const deployCommand = new Command() .name("deno deploy") + .version(VERSION) .description(`Interact with Deno Deploy Calling this subcommand without any further subcommands will @@ -223,6 +225,14 @@ deploy your local directory to the specified application.`) if (tokenEnv) { tokenStorage.set(tokenEnv, true); } + + if (options.debug) { + console.error( + yellow( + `Debug mode is enabled (deno ${Deno.version.deno}, @deno/deploy ${VERSION}, endpoint=${options.endpoint})`, + ), + ); + } }) .action( actionHandler( diff --git a/sandbox/mod.ts b/sandbox/mod.ts index 342563f..cf2b8c3 100644 --- a/sandbox/mod.ts +++ b/sandbox/mod.ts @@ -5,7 +5,7 @@ import { type VolumeId, type VolumeSlug, } from "@deno/sandbox"; -import { green, magenta, red } from "@std/fmt/colors"; +import { green, magenta, red, yellow } from "@std/fmt/colors"; import { pooledMap } from "@std/async"; import { expandGlob } from "@std/fs"; import { join } from "@std/path"; @@ -19,6 +19,7 @@ import { } from "../util.ts"; import { createTrpcClient, getAuth, tokenStorage } from "../auth.ts"; import { createSwitchCommand, type GlobalContext } from "../main.ts"; +import { VERSION } from "../version.ts"; import { volumesCommand } from "./volumes.ts"; import { snapshotsCommand } from "./snapshot.ts"; @@ -588,6 +589,7 @@ Example: export const sandboxCommand = new Command() .name("deno sandbox") + .version(VERSION) .description("Interact with sandboxes") .globalOption("--endpoint ", "the endpoint", { default: "https://console.deno.com", @@ -615,6 +617,14 @@ export const sandboxCommand = new Command() if (tokenEnv) { tokenStorage.set(tokenEnv, true); } + + if (options.debug) { + console.error( + yellow( + `Debug mode is enabled (deno ${Deno.version.deno}, @deno/deploy ${VERSION}, endpoint=${options.endpoint})`, + ), + ); + } }) .action(() => { sandboxCommand.showHelp(); diff --git a/version.ts b/version.ts new file mode 100644 index 0000000..0db14dc --- /dev/null +++ b/version.ts @@ -0,0 +1,4 @@ +import denoJson from "./deno.json" with { type: "json" }; + +export const VERSION = (denoJson as { version?: string }).version ?? + "0.0.0-dev";