forked from DonJayamanne/pythonVSCode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvscode.ts
More file actions
23 lines (21 loc) · 900 Bytes
/
vscode.ts
File metadata and controls
23 lines (21 loc) · 900 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import * as path from 'path';
import * as fs from 'fs-extra';
import { EXTENSION_ROOT_DIR } from '../../client/common/constants';
const insidersVersion = /^\^(\d+\.\d+\.\d+)-(insider|\d{8})$/;
export function getChannel(): string {
if (process.env.VSC_PYTHON_CI_TEST_VSC_CHANNEL) {
return process.env.VSC_PYTHON_CI_TEST_VSC_CHANNEL;
}
const packageJsonPath = path.join(EXTENSION_ROOT_DIR, 'package.json');
if (fs.pathExistsSync(packageJsonPath)) {
const packageJson = fs.readJSONSync(packageJsonPath);
const engineVersion = packageJson.engines.vscode;
if (insidersVersion.test(engineVersion)) {
// Can't pass in the version number for an insiders build;
// https://github.com/microsoft/vscode-test/issues/176
return 'insiders';
}
return engineVersion.replace('^', '');
}
return 'stable';
}