idea: unify Version and RunnableVersion into a class with lazy-getters for semver and state
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
Versionclass 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): VersionandVersion.newLocal(version:string, localPath:string): Version- Remove the oldVersionandRunnableVersioninterfaces entirely and just use this unified class instead - Remove the
VersionSourceenum because it adds no value overBoolean(this.localPath) - Have a static function
Version.compare()that compares two Version objects
Assigning to @codebytere at her request :1st_place_medal:
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