forked from redhat-developer/vscode-openshift-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall-vscode.ts
More file actions
43 lines (38 loc) · 1.72 KB
/
install-vscode.ts
File metadata and controls
43 lines (38 loc) · 1.72 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
40
41
42
43
/*-----------------------------------------------------------------------------------------------
* Copyright (c) Red Hat, Inc. All rights reserved.
* Licensed under the MIT License. See LICENSE file in the project root for license information.
*-----------------------------------------------------------------------------------------------*/
/* eslint-disable no-console */
import * as testElectron from '@vscode/test-electron';
import { platform } from 'os';
import cp = require('child_process');
import path = require('path');
void testElectron.downloadAndUnzipVSCode().then((executable: string) => {
let vsCodeExecutable: string;
if (platform() === 'darwin') {
console.log(executable);
vsCodeExecutable = `'${path.join(
executable.substring(0, executable.indexOf('.app') + 4),
'Contents',
'Resources',
'app',
'bin',
'code',
)}'`;
} else {
vsCodeExecutable = path.join(path.dirname(executable), 'bin', 'code');
}
// Install extensions that openshift-toolkit depends on
const extensionsToInstall = [
'redhat.vscode-redhat-account',
'ms-kubernetes-tools.vscode-kubernetes-tools'
];
const extensionRootPath = path.resolve(__dirname, '..', '..');
const vsCodeTest = path.resolve(path.join(extensionRootPath, '.vscode-test'));
const userDataDir = path.join(vsCodeTest, 'user-data');
const extDir = path.join(vsCodeTest, 'extensions');
for (const extension of extensionsToInstall) {
console.log('Installing extension: ', extension );
cp.execSync(`${vsCodeExecutable} --install-extension ${extension} --user-data-dir ${userDataDir} --extensions-dir ${extDir}`);
}
});