vscode/build/lib/preLaunch.js
Matt Bierner 0762d23ae7
Build VS Code using TS 4.4 (#127823)
* Build VS Code using TS 4.4

* Remove usages of deprecated `ClientRectList`

* Add any casts for missing `caretRangeFromPoint`

* Add temporary any casts for `zoom` css propery

This non-standard css property no longer exists in lib.dom.d.ts

* MouseWheelEvent -> WheelEvent

* Pick up new TS nightly

Co-authored-by: Alexandru Dima <alexdima@microsoft.com>
2021-07-08 14:27:39 -07:00

56 lines
1.9 KiB
JavaScript

/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
Object.defineProperty(exports, "__esModule", { value: true });
// @ts-check
const path = require("path");
const child_process_1 = require("child_process");
const fs_1 = require("fs");
const yarn = process.platform === 'win32' ? 'yarn.cmd' : 'yarn';
const rootDir = path.resolve(__dirname, '..', '..');
function runProcess(command, args = []) {
return new Promise((resolve, reject) => {
const child = (0, child_process_1.spawn)(command, args, { cwd: rootDir, stdio: 'inherit', env: process.env });
child.on('exit', err => !err ? resolve() : process.exit(err !== null && err !== void 0 ? err : 1));
child.on('error', reject);
});
}
async function exists(subdir) {
try {
await fs_1.promises.stat(path.join(rootDir, subdir));
return true;
}
catch (_a) {
return false;
}
}
async function ensureNodeModules() {
if (!(await exists('node_modules'))) {
await runProcess(yarn);
}
}
async function getElectron() {
await runProcess(yarn, ['electron']);
}
async function ensureCompiled() {
if (!(await exists('out'))) {
await runProcess(yarn, ['compile']);
}
}
async function main() {
await ensureNodeModules();
await getElectron();
await ensureCompiled();
// Can't require this until after dependencies are installed
const { getBuiltInExtensions } = require('./builtInExtensions');
await getBuiltInExtensions();
}
if (require.main === module) {
main().catch(err => {
console.error(err);
process.exit(1);
});
}