-
Notifications
You must be signed in to change notification settings - Fork 42
Expand file tree
/
Copy pathfeatureSet.ts
More file actions
39 lines (35 loc) · 1.01 KB
/
featureSet.ts
File metadata and controls
39 lines (35 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import * as semver from "semver";
export type FeatureSet = {
vscodessh: boolean;
proxyLogDirectory: boolean;
wildcardSSH: boolean;
buildReason: 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",
wildcardSSH:
(version ? version.compare("2.19.0") : -1) >= 0 ||
version?.prerelease[0] === "devel",
// The --reason flag was added to `coder start` in 2.25.0
buildReason:
(version?.compare("2.25.0") || 0) >= 0 ||
version?.prerelease[0] === "devel",
};
}