Files
vscode/extensions/postinstall.js
Matt Bierner 434def671b Use common TS install for both the TS Extension and Html Extension (#21578)
* Use common TS install for both the TS Extension and Html Extension

**Bug**
At least two version of Typescript are shipped in our extensions: one in the typescript extension and one for the html extension. This adds about 5MB to package install size and also results in inconsistent behavior

**Fix**
Change the TypeScript extension to also use the common version of TypeScript. Bump this version up to 2.2.1

* Don't hardcode paths for typescript
2017-03-01 18:34:04 -08:00

26 lines
946 B
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';
const fs = require('fs');
const path = require('path');
const toDelete = new Set(['tsc.js', 'tsserverlibrary.js', 'typescript.js', 'typescriptServices.js']);
const root = path.join(__dirname, 'node_modules', 'typescript', 'lib');
for (let name of fs.readdirSync(root)) {
if (name === 'lib.d.ts' || name.match(/^lib\..*\.d\.ts$/) || name === 'protocol.d.ts') {
continue;
}
if (toDelete.has(name) || name.match(/\.d\.ts$/)) {
try {
fs.unlinkSync(path.join(root, name));
console.log(`removed '${path.join(root, name)}'`);
} catch (e) {
console.warn(e);
}
}
}