Skip to content

Commit

Permalink
chore(cli): --version returns dev if undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
hasundue committed Mar 11, 2024
1 parent 8a5ce3d commit 23026fd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
10 changes: 2 additions & 8 deletions cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import {
DependencyUpdate,
execute,
parse,
resolveLatestVersion,
write,
} from "./mod.ts";

Expand Down Expand Up @@ -84,13 +83,8 @@ const main = new Command()
}
});

async function versionCommand() {
const version = parse(import.meta.url).version ??
await $.progress("Fetching version info").with(async () =>
await resolveLatestVersion(
parse(new URL("https://deno.land/x/molt/cli.ts")),
).then((latest) => latest?.version) ?? "unknown"
);
function versionCommand() {
const version = parse(import.meta.url).version ?? "dev";
console.log(version);
}

Expand Down
7 changes: 2 additions & 5 deletions test/snapshots/cli.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,11 @@ Options:
snapshot[`cli - "molt --help" 2`] = `""`;
snapshot[`cli - "molt --version" 1`] = `
"0.17.0
"dev
"
`;
snapshot[`cli - "molt --version" 2`] = `
"Fetching version info
"
`;
snapshot[`cli - "molt --version" 2`] = `""`;
snapshot[`cli - "molt not_exist.ts" 1`] = `""`;
Expand Down

0 comments on commit 23026fd

Please sign in to comment.