-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use cli version for featureset detection (#328)
- Loading branch information
1 parent
7e70e95
commit c6e7f36
Showing
6 changed files
with
79 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -304,5 +304,6 @@ | |
"semver": "7.6.2", | ||
"trim": "0.0.3", | ||
"word-wrap": "1.2.5" | ||
} | ||
}, | ||
"packageManager": "[email protected]+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import * as semver from "semver" | ||
import { describe, expect, it } from "vitest" | ||
import { featureSetForVersion } from "./featureSet" | ||
|
||
describe("check version support", () => { | ||
it("has logs", () => { | ||
;["v1.3.3+e491217", "v2.3.3+e491217"].forEach((v: string) => { | ||
expect(featureSetForVersion(semver.parse(v)).proxyLogDirectory).toBeFalsy() | ||
}) | ||
;["v2.3.4+e491217", "v5.3.4+e491217", "v5.0.4+e491217"].forEach((v: string) => { | ||
expect(featureSetForVersion(semver.parse(v)).proxyLogDirectory).toBeTruthy() | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import * as semver from "semver" | ||
|
||
export type FeatureSet = { | ||
vscodessh: boolean | ||
proxyLogDirectory: boolean | ||
} | ||
|
||
/** | ||
* Builds and returns a FeatureSet object for a given coder version. | ||
*/ | ||
export function featureSetForVersion(version: semver.SemVer | null): FeatureSet { | ||
return { | ||
vscodessh: !( | ||
version?.major === 0 && | ||
version?.minor <= 14 && | ||
version?.patch < 1 && | ||
version?.prerelease.length === 0 | ||
), | ||
|
||
// CLI versions before 2.3.3 don't support the --log-dir flag! | ||
// If this check didn't exist, VS Code connections would fail on | ||
// older versions because of an unknown CLI argument. | ||
proxyLogDirectory: (version?.compare("2.3.3") || 0) > 0 || version?.prerelease[0] === "devel", | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.