idea: unify Version and RunnableVersion into a class with lazy-getters for semver and state
- Dominant language
- TypeScript
- Stars
- 7.8k
- Forks
- 762
- Avg merge
- 15h 27m
- Merged PRs (30d)
- 12
Description
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:
Contributor guide
Assessment
This issue has not been assessed yet.