Skip to content

Commit

Permalink
chore(cli): resolve version dynamically
Browse files Browse the repository at this point in the history
  • Loading branch information
hasundue committed Oct 23, 2023
1 parent 81f36aa commit ab9c657
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -330,7 +336,7 @@ const main = new Command()
.action(function () {
this.showHelp();
})
.version("0.7.4")
.version(VERSION)
.command("check", checkCommand)
.command("update", updateCommand);

Expand Down
2 changes: 1 addition & 1 deletion lib/dependency.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function parseProps(
return { name, version: semver, path: path as Path };
}

async function resolveLatestSemVer(
export async function resolveLatestSemVer(
url: URL,
): Promise<Maybe<SemVerString>> {
const props = parseProps(url);
Expand Down

0 comments on commit ab9c657

Please sign in to comment.