Files
sweet/packages/fresh/tests/fixture_update_check/mod.ts
T
Marvin Hagemeister 815b1940e3 chore: restructure repository into packages/ folder (#3197)
We're having a growing number of packages in this repository. This PR
moves them into a `packages/` directory like it's commonly done in other
projects.
2025-08-06 15:52:45 +02:00

22 lines
606 B
TypeScript

import { DAY } from "../../src/constants.ts";
import { updateCheck } from "../../src/dev/update_check.ts";
// deno-lint-ignore require-await
async function getLatestVersion() {
// deno-lint-ignore no-console
console.log("fetching latest version");
return Deno.env.get("LATEST_VERSION") ?? "99.99.999";
}
function getCurrentVersion() {
return Deno.env.get("CURRENT_VERSION")!;
}
const interval = +(Deno.env.get("UPDATE_INTERVAL") ?? DAY);
await updateCheck(
interval,
() => Deno.env.get("TEST_HOME")!,
getLatestVersion,
Deno.env.has("CURRENT_VERSION") ? getCurrentVersion : undefined,
);