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