Skip to content

Commit

Permalink
fix version
Browse files Browse the repository at this point in the history
  • Loading branch information
pyramation committed Dec 15, 2023
1 parent 899f598 commit fdbc5ce
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions packages/keplr/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,21 @@ const getExplr = (chain: Chain): string => chain.explorers?.[0]?.url ?? '';
const cleanVer = (ver: string) => {
if (!semver.valid(ver)) {
// try to split by @ for repo@version
ver = ver.split("@").pop()
if (semver.valid(ver)) return ver
ver = ver.split('@').pop();
if (semver.valid(ver)) return ver;

const spaces = ver.split('.').length;
switch (spaces) {
case 0:
case 1:
return ver + '.0.0';
case 2:
return ver + '.0';
case 3:
default:
throw new Error('contact maintainers: bad version');
throw new Error(
'contact @chain-registry/keplr maintainers: bad version'
);
}
}
};
Expand Down

0 comments on commit fdbc5ce

Please sign in to comment.