Skip to content

Commit

Permalink
address feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
jribbink committed Apr 15, 2024
1 parent 2a21556 commit ef60979
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,9 @@ export class InstallFlowCLI extends Installer {
}
}

async checkVersion (vsn: semver.SemVer): Promise<boolean> {
async checkVersion (version: semver.SemVer): Promise<boolean> {
// Get user's version informaton
this.#context.cliProvider.refresh()
const version = vsn
if (version == null) return false

if (!semver.satisfies(version, COMPATIBLE_FLOW_CLI_VERSIONS, {
Expand Down
2 changes: 2 additions & 0 deletions extension/src/flow-cli/binary-versions-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ export enum KNOWN_FLOW_COMMANDS {
CADENCE_V1 = 'flow-c1',
}

// This regex matches a string like "Version: v{SEMVER}" and extracts the version number
// It uses the official semver regex from https://semver.org/
const LEGACY_VERSION_REGEXP = /Version:\s*(v?(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?)(\s|$)/m

export interface CliBinary {
Expand Down

0 comments on commit ef60979

Please sign in to comment.