diff --git a/cli.ts b/cli.ts index 7ee51280..fe3c2d52 100644 --- a/cli.ts +++ b/cli.ts @@ -8,6 +8,12 @@ import { URI } from "./lib/uri.ts"; import { DependencyUpdate } from "./lib/update.ts"; import { FileUpdate } from "./lib/file.ts"; import { GitCommitSequence } from "./lib/git.ts"; +import { parseSemVer } from "./lib/semver.ts"; +import { resolveLatestSemVer } from "./lib/dependency.ts"; + +const VERSION = parseSemVer(import.meta.url) ?? + await resolveLatestSemVer(new URL("https://deno.land/x/molt@0.0.0/cli.ts")) ?? + "undefined"; const { gray, yellow, bold, cyan } = colors; @@ -330,7 +336,7 @@ const main = new Command() .action(function () { this.showHelp(); }) - .version("0.7.4") + .version(VERSION) .command("check", checkCommand) .command("update", updateCommand); diff --git a/lib/dependency.ts b/lib/dependency.ts index 98a0dcaa..fa88354b 100644 --- a/lib/dependency.ts +++ b/lib/dependency.ts @@ -29,7 +29,7 @@ function parseProps( return { name, version: semver, path: path as Path }; } -async function resolveLatestSemVer( +export async function resolveLatestSemVer( url: URL, ): Promise> { const props = parseProps(url);