Path: blob/main/test/automation/tools/copy-driver-definition.js
3520 views
/*---------------------------------------------------------------------------------------------1* Copyright (c) Microsoft Corporation. All rights reserved.2* Licensed under the MIT License. See License.txt in the project root for license information.3*--------------------------------------------------------------------------------------------*/45//@ts-check6'use strict';78const fs = require('fs');9const path = require('path');1011const root = path.dirname(path.dirname(path.dirname(__dirname)));12const driverPath = path.join(root, 'src/vs/workbench/services/driver/common/driver.ts');1314let contents = fs.readFileSync(driverPath, 'utf8');15contents = /\/\/\*START([\s\S]*)\/\/\*END/mi.exec(contents)[1].trim();16contents = contents.replace(/\bTPromise\b/g, 'Promise');1718contents = `/*---------------------------------------------------------------------------------------------19* Copyright (c) Microsoft Corporation. All rights reserved.20* Licensed under the MIT License. See License.txt in the project root for license information.21*--------------------------------------------------------------------------------------------*/2223${contents}24`;2526const srcPath = path.join(path.dirname(__dirname), 'src');27const outPath = path.join(path.dirname(__dirname), 'out');2829if (!fs.existsSync(outPath)) {30fs.mkdirSync(outPath);31}32fs.writeFileSync(path.join(srcPath, 'driver.d.ts'), contents);33fs.writeFileSync(path.join(outPath, 'driver.d.ts'), contents);343536