Skip to content

Commit

Permalink
feat: compare upstream runtime version in the hook
Browse files Browse the repository at this point in the history
  • Loading branch information
zimeg committed Mar 21, 2024
1 parent be8acb7 commit f5429fe
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
9 changes: 9 additions & 0 deletions src/doctor.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { getProtocolInterface } from "./deps.ts";
import { isNewSemverRelease } from "./utilities.ts";

type RuntimeVersion = {
name: string;
current: string;
minimum?: string;
message?: string;
error?: {
message: string;
};
Expand All @@ -28,6 +30,13 @@ const getHostedDenoRuntimeVersion = async (): Promise<{
const message = Deno.version.deno !== version
? `Applications deployed to Slack use Deno version ${version}`
: undefined;
if (isNewSemverRelease(Deno.version.deno, version)) {
return {
minimum: version,
message,
error: { message: "The installed runtime version is not supported" },
};
}
return { minimum: version, message };
} catch (err) {
if (err instanceof Error) {
Expand Down
5 changes: 4 additions & 1 deletion src/tests/doctor_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ Deno.test("doctor hook tests", async (t) => {
assertEquals(actual, expected);
});

await t.step("mismatched upstream requirements note difference", async () => {
await t.step("unsupported upstream runtimes note differences", async () => {
mockFetch.mock("GET@/slackcli/metadata.json", (_req: Request) => {
return new Response(JSON.stringify(MOCK_SLACK_CLI_MANIFEST));
});
Expand All @@ -110,6 +110,9 @@ Deno.test("doctor hook tests", async (t) => {
current: "1.2.3",
minimum: "1.101.1",
message: "Applications deployed to Slack use Deno version 1.101.1",
error: {
message: "The installed runtime version is not supported",
},
},
{
name: "typescript",
Expand Down

0 comments on commit f5429fe

Please sign in to comment.