fiddle icon indicating copy to clipboard operation
fiddle copied to clipboard

idea: unify Version and RunnableVersion into a class with lazy-getters for semver and state

Open ckerr opened this issue 4 years ago • 1 comments

Both @codebytere and I have done a lot of rewriting over the best way to handle passing Versions around efficiently, since we inevitably wind up parsing and reparsing the version numbers with semver, and also pinging the disk to calculate VersionState because state needs to check and see if the version is installed or not.

One approach that would work:

  • Create a new Version class that has getters that lazy-build a SemVer and VersionState property
  • Add static constructors that follow our real-world use cases, e.g. Version.newRelease(version: string): Version and Version.newLocal(version:string, localPath:string): Version- Remove the old Version and RunnableVersion interfaces entirely and just use this unified class instead
  • Remove the VersionSource enum because it adds no value over Boolean(this.localPath)
  • Have a static function Version.compare() that compares two Version objects

Assigning to @codebytere at her request :1st_place_medal:

ckerr avatar Jul 23 '21 17:07 ckerr

NB: @codebytere, you'll likely want to take https://github.com/electron/fiddle-core#versions into consideration when doing this.

I'll improve the docs for that package RSN but I wanted to at least give you a heads-up as I know you're coming back from leave on Monday and didn't know where (or if) this issue is on your radar

ckerr avatar Aug 06 '21 21:08 ckerr