Migrate postinstall script to use modules
parent
03f99f57c7
commit
b0e8554cce
|
@ -7,7 +7,7 @@
|
||||||
"typescript": "4.6.2"
|
"typescript": "4.6.2"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"postinstall": "node ./postinstall"
|
"postinstall": "node ./postinstall.mjs"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"esbuild": "^0.11.12",
|
"esbuild": "^0.11.12",
|
||||||
|
|
|
@ -2,15 +2,12 @@
|
||||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
// @ts-check
|
|
||||||
|
|
||||||
'use strict';
|
import * as fs from 'fs';
|
||||||
|
import path from 'path';
|
||||||
|
import { fileURLToPath } from 'url';
|
||||||
|
|
||||||
const fs = require('fs');
|
const root = path.join(path.dirname(fileURLToPath(import.meta.url)), 'node_modules', 'typescript');
|
||||||
const path = require('path');
|
|
||||||
const rimraf = require('rimraf');
|
|
||||||
|
|
||||||
const root = path.join(__dirname, 'node_modules', 'typescript');
|
|
||||||
|
|
||||||
function processRoot() {
|
function processRoot() {
|
||||||
const toKeep = new Set([
|
const toKeep = new Set([
|
||||||
|
@ -21,7 +18,7 @@ function processRoot() {
|
||||||
if (!toKeep.has(name)) {
|
if (!toKeep.has(name)) {
|
||||||
const filePath = path.join(root, name);
|
const filePath = path.join(root, name);
|
||||||
console.log(`Removed ${filePath}`);
|
console.log(`Removed ${filePath}`);
|
||||||
rimraf.sync(filePath);
|
fs.rmSync(filePath, { recursive: true });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue