Skip to content

Commit 40a90bd

Browse files
committed
made computeEnvType
1 parent d82fb27 commit 40a90bd

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

src/shared/telemetry/util.ts

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -92,29 +92,34 @@ export async function getUserAgent(
9292
return pairs.join(' ')
9393
}
9494

95-
type EnvType = 'classic' | 'codecatalyst' | ...
95+
type EnvType =
96+
| 'cloud9'
97+
| 'cloud9-codecatalyst'
98+
| 'amazon-cloud9'
99+
| 'cloud9-ec2'
100+
| 'codecatalyst'
101+
| 'local'
102+
| 'ec2'
103+
| 'sagemaker'
104+
| 'test'
105+
| 'other'
96106

97107
export function getComputeEnvType(): EnvType {
98-
// Compute ENV could be one of the following
99-
// "cloud9"|"cloud9-codecatalyst"|"cloud9-ec2"|"codecatalyst"|"ec2"|"local"|"sagemaker"|"ssh"|"test"|"web"|"wsl"|"other"|string;
100-
101108
if (isCloud9('classic')) return 'cloud9'
102109

103110
if (isCloud9('codecatalyst')) return 'cloud9-codecatalyst'
104111

105-
if (isInDevEnv()) return 'codecatalyst' // should it be codecatalyst devEnv?
112+
if (isInDevEnv()) return 'codecatalyst'
106113

107-
if (isCn()) return 'amazon-cloud9' // name better
114+
if (isCn()) return 'amazon-cloud9'
108115

109116
if (isSageMaker()) return 'sagemaker'
110117

111118
if (env.remoteName == 'ssh-remote' && !isInDevEnv()) return 'ec2'
112119

113120
if (isAutomation()) return 'test'
114121

115-
if (!env.remoteName)
116-
// use isDevenvVscode instead?
117-
return 'local'
122+
if (!env.remoteName) return 'local'
118123
else return 'other'
119124
}
120125

0 commit comments

Comments
 (0)