Replace mkdirp with fs.mkdirSync(path, { recursive: true }) (#228017)

* Replace mkdirp with fs.mkdirSync(path, { recursive: true })
(fix #227931)

* compile
pull/228068/head
Benjamin Pasero 2024-09-10 07:43:29 +02:00 committed by GitHub
parent 8b7eb51f54
commit 789c320a1c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
17 changed files with 11 additions and 129 deletions

View File

@ -16,7 +16,6 @@ const pkg = require('../package.json');
const product = require('../product.json');
const vfs = require('vinyl-fs');
const rcedit = require('rcedit');
const mkdirp = require('mkdirp');
const repoPath = path.dirname(__dirname);
const buildPath = (/** @type {string} */ arch) => path.join(path.dirname(repoPath), `VSCode-win32-${arch}`);
@ -75,7 +74,7 @@ function buildWin32Setup(arch, target) {
const sourcePath = buildPath(arch);
const outputPath = setupDir(arch, target);
mkdirp.sync(outputPath);
fs.mkdirSync(outputPath, { recursive: true });
const originalProductJsonPath = path.join(sourcePath, 'resources/app/product.json');
const productJsonPath = path.join(outputPath, 'product.json');

View File

@ -16,7 +16,6 @@ const vfs = require("vinyl-fs");
const ext = require("./extensions");
const fancyLog = require("fancy-log");
const ansiColors = require("ansi-colors");
const mkdirp = require('mkdirp');
const root = path.dirname(path.dirname(__dirname));
const productjson = JSON.parse(fs.readFileSync(path.join(__dirname, '../../product.json'), 'utf8'));
const builtInExtensions = productjson.builtInExtensions || [];
@ -107,7 +106,7 @@ function readControlFile() {
}
}
function writeControlFile(control) {
mkdirp.sync(path.dirname(controlFilePath));
fs.mkdirSync(path.dirname(controlFilePath), { recursive: true });
fs.writeFileSync(controlFilePath, JSON.stringify(control, null, 2));
}
function getBuiltInExtensions() {

View File

@ -15,8 +15,6 @@ import * as fancyLog from 'fancy-log';
import * as ansiColors from 'ansi-colors';
import { Stream } from 'stream';
const mkdirp = require('mkdirp');
export interface IExtensionDefinition {
name: string;
version: string;
@ -147,7 +145,7 @@ function readControlFile(): IControlFile {
}
function writeControlFile(control: IControlFile): void {
mkdirp.sync(path.dirname(controlFilePath));
fs.mkdirSync(path.dirname(controlFilePath), { recursive: true });
fs.writeFileSync(controlFilePath, JSON.stringify(control, null, 2));
}

View File

@ -31,7 +31,6 @@
"@types/mime": "0.0.29",
"@types/minimatch": "^3.0.3",
"@types/minimist": "^1.2.1",
"@types/mkdirp": "^1.0.1",
"@types/mocha": "^9.1.1",
"@types/node": "20.x",
"@types/pump": "^1.0.1",
@ -54,7 +53,6 @@
"gulp-sort": "^2.0.0",
"jsonc-parser": "^2.3.0",
"mime": "^1.4.1",
"mkdirp": "^1.0.4",
"source-map": "0.6.1",
"ternary-stream": "^3.0.0",
"through2": "^4.0.2",
@ -1124,15 +1122,6 @@
"integrity": "sha512-fZQQafSREFyuZcdWFAExYjBiCL7AUCdgsk80iO0q4yihYYdcIiH28CcuPTGFgLOCC8RlW49GSQxdHwZP+I7CNg==",
"dev": true
},
"node_modules/@types/mkdirp": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/@types/mkdirp/-/mkdirp-1.0.1.tgz",
"integrity": "sha512-HkGSK7CGAXncr8Qn/0VqNtExEE+PHMWb+qlR1faHMao7ng6P3tAaoWWBMdva0gL5h4zprjIO89GJOLXsMcDm1Q==",
"dev": true,
"dependencies": {
"@types/node": "*"
}
},
"node_modules/@types/mocha": {
"version": "9.1.1",
"resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-9.1.1.tgz",
@ -3353,18 +3342,6 @@
"integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==",
"devOptional": true
},
"node_modules/mkdirp": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz",
"integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==",
"dev": true,
"bin": {
"mkdirp": "bin/cmd.js"
},
"engines": {
"node": ">=10"
}
},
"node_modules/mkdirp-classic": {
"version": "0.5.3",
"resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz",

View File

@ -25,7 +25,6 @@
"@types/mime": "0.0.29",
"@types/minimatch": "^3.0.3",
"@types/minimist": "^1.2.1",
"@types/mkdirp": "^1.0.1",
"@types/mocha": "^9.1.1",
"@types/node": "20.x",
"@types/pump": "^1.0.1",
@ -48,7 +47,6 @@
"gulp-sort": "^2.0.0",
"jsonc-parser": "^2.3.0",
"mime": "^1.4.1",
"mkdirp": "^1.0.4",
"source-map": "0.6.1",
"ternary-stream": "^3.0.0",
"through2": "^4.0.2",

View File

@ -241,33 +241,6 @@
"CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE."
]
},
{
// Reason: The substack org has been deleted on GH
"name": "mkdirp",
"fullLicenseText": [
"Copyright 2010 James Halliday (mail@substack.net)",
"",
"This project is free software released under the MIT/X11 license:",
"",
"Permission is hereby granted, free of charge, to any person obtaining a copy",
"of this software and associated documentation files (the \"Software\"), to deal",
"in the Software without restriction, including without limitation the rights",
"to use, copy, modify, merge, publish, distribute, sublicense, and/or sell",
"copies of the Software, and to permit persons to whom the Software is",
"furnished to do so, subject to the following conditions:",
"",
"The above copyright notice and this permission notice shall be included in",
"all copies or substantial portions of the Software.",
"",
"THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR",
"IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,",
"FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE",
"AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER",
"LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,",
"OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN",
"THE SOFTWARE."
]
},
{
// Reason: repo URI is wrong on crate, pending https://github.com/warp-tech/russh/pull/53
"name": "russh-cryptovec",

1
package-lock.json generated
View File

@ -131,7 +131,6 @@
"mime": "^1.4.1",
"minimatch": "^3.0.4",
"minimist": "^1.2.6",
"mkdirp": "^1.0.4",
"mocha": "^10.2.0",
"mocha-junit-reporter": "^2.2.1",
"mocha-multi-reporters": "^1.5.1",

View File

@ -193,7 +193,6 @@
"mime": "^1.4.1",
"minimatch": "^3.0.4",
"minimist": "^1.2.6",
"mkdirp": "^1.0.4",
"mocha": "^10.2.0",
"mocha-junit-reporter": "^2.2.1",
"mocha-multi-reporters": "^1.5.1",

View File

@ -9,14 +9,12 @@
"version": "1.71.0",
"license": "MIT",
"dependencies": {
"mkdirp": "^1.0.4",
"ncp": "^2.0.0",
"tmp": "0.2.1",
"tree-kill": "1.2.2",
"vscode-uri": "3.0.2"
},
"devDependencies": {
"@types/mkdirp": "^1.0.1",
"@types/ncp": "2.0.1",
"@types/node": "20.x",
"@types/tmp": "0.2.2",
@ -25,15 +23,6 @@
"watch": "^1.0.2"
}
},
"node_modules/@types/mkdirp": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/@types/mkdirp/-/mkdirp-1.0.1.tgz",
"integrity": "sha512-HkGSK7CGAXncr8Qn/0VqNtExEE+PHMWb+qlR1faHMao7ng6P3tAaoWWBMdva0gL5h4zprjIO89GJOLXsMcDm1Q==",
"dev": true,
"dependencies": {
"@types/node": "*"
}
},
"node_modules/@types/ncp": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/@types/ncp/-/ncp-2.0.1.tgz",
@ -596,17 +585,6 @@
"integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==",
"dev": true
},
"node_modules/mkdirp": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz",
"integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==",
"bin": {
"mkdirp": "bin/cmd.js"
},
"engines": {
"node": ">=10"
}
},
"node_modules/ms": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",

View File

@ -18,14 +18,12 @@
"prepublishOnly": "npm run copy-package-version"
},
"dependencies": {
"mkdirp": "^1.0.4",
"ncp": "^2.0.0",
"tmp": "0.2.1",
"tree-kill": "1.2.2",
"vscode-uri": "3.0.2"
},
"devDependencies": {
"@types/mkdirp": "^1.0.1",
"@types/ncp": "2.0.1",
"@types/node": "20.x",
"@types/tmp": "0.2.2",

View File

@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import { join } from 'path';
import * as mkdirp from 'mkdirp';
import * as fs from 'fs';
import { copyExtension } from './extensions';
import { URI } from 'vscode-uri';
import { measureAndLog } from './logger';
@ -70,7 +70,7 @@ export async function resolveElectronConfiguration(options: LaunchOptions): Prom
}
args.push('--enable-proposed-api=vscode.vscode-test-resolver');
const remoteDataDir = `${userDataDir}-server`;
mkdirp.sync(remoteDataDir);
fs.mkdirSync(remoteDataDir, { recursive: true });
env['TESTRESOLVER_DATA_FOLDER'] = remoteDataDir;
env['TESTRESOLVER_LOGS_FOLDER'] = join(logsPath, 'server');

View File

@ -6,7 +6,7 @@
import * as playwright from '@playwright/test';
import { ChildProcess, spawn } from 'child_process';
import { join } from 'path';
import * as mkdirp from 'mkdirp';
import * as fs from 'fs';
import { URI } from 'vscode-uri';
import { Logger, measureAndLog } from './logger';
import type { LaunchOptions } from './code';
@ -35,7 +35,7 @@ async function launchServer(options: LaunchOptions) {
const serverLogsPath = join(logsPath, 'server');
const codeServerPath = codePath ?? process.env.VSCODE_REMOTE_SERVER_PATH;
const agentFolder = userDataDir;
await measureAndLog(() => mkdirp(agentFolder), `mkdirp(${agentFolder})`, logger);
await measureAndLog(() => fs.promises.mkdir(agentFolder, { recursive: true }), `mkdirp(${agentFolder})`, logger);
const env = {
VSCODE_REMOTE_SERVER_PATH: codeServerPath,

View File

@ -9,7 +9,6 @@
"version": "0.1.0",
"license": "MIT",
"devDependencies": {
"@types/mkdirp": "^1.0.1",
"@types/node": "20.x",
"@types/rimraf": "^2.0.4",
"@types/tmp": "0.1.0",
@ -42,15 +41,6 @@
"integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==",
"dev": true
},
"node_modules/@types/mkdirp": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/@types/mkdirp/-/mkdirp-1.0.1.tgz",
"integrity": "sha512-HkGSK7CGAXncr8Qn/0VqNtExEE+PHMWb+qlR1faHMao7ng6P3tAaoWWBMdva0gL5h4zprjIO89GJOLXsMcDm1Q==",
"dev": true,
"dependencies": {
"@types/node": "*"
}
},
"node_modules/@types/node": {
"version": "20.11.24",
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.24.tgz",

View File

@ -7,7 +7,6 @@
"compile": "node ../../../node_modules/typescript/bin/tsc"
},
"devDependencies": {
"@types/mkdirp": "^1.0.1",
"@types/node": "20.x",
"@types/rimraf": "^2.0.4",
"@types/tmp": "0.1.0",

View File

@ -9,13 +9,11 @@
"version": "0.1.0",
"license": "MIT",
"dependencies": {
"mkdirp": "^1.0.4",
"ncp": "^2.0.0",
"node-fetch": "^2.6.7",
"rimraf": "3.0.2"
},
"devDependencies": {
"@types/mkdirp": "^1.0.1",
"@types/mocha": "^9.1.1",
"@types/ncp": "2.0.1",
"@types/node": "20.x",
@ -48,15 +46,6 @@
"integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==",
"dev": true
},
"node_modules/@types/mkdirp": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/@types/mkdirp/-/mkdirp-1.0.1.tgz",
"integrity": "sha512-HkGSK7CGAXncr8Qn/0VqNtExEE+PHMWb+qlR1faHMao7ng6P3tAaoWWBMdva0gL5h4zprjIO89GJOLXsMcDm1Q==",
"dev": true,
"dependencies": {
"@types/node": "*"
}
},
"node_modules/@types/mocha": {
"version": "9.1.1",
"resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-9.1.1.tgz",
@ -582,17 +571,6 @@
"integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==",
"dev": true
},
"node_modules/mkdirp": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz",
"integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==",
"bin": {
"mkdirp": "bin/cmd.js"
},
"engines": {
"node": ">=10"
}
},
"node_modules/ncp": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/ncp/-/ncp-2.0.0.tgz",

View File

@ -11,13 +11,11 @@
"mocha": "node ../node_modules/mocha/bin/mocha"
},
"dependencies": {
"mkdirp": "^1.0.4",
"ncp": "^2.0.0",
"node-fetch": "^2.6.7",
"rimraf": "3.0.2"
},
"devDependencies": {
"@types/mkdirp": "^1.0.1",
"@types/mocha": "^9.1.1",
"@types/ncp": "2.0.1",
"@types/node": "20.x",

View File

@ -10,7 +10,6 @@ import * as path from 'path';
import * as os from 'os';
import * as minimist from 'minimist';
import * as rimraf from 'rimraf';
import * as mkdirp from 'mkdirp';
import * as vscodetest from '@vscode/test-electron';
import fetch from 'node-fetch';
import { Quality, MultiLogger, Logger, ConsoleLogger, FileLogger, measureAndLog, getDevElectronPath, getBuildElectronPath, getBuildVersion } from '../../automation';
@ -105,7 +104,7 @@ function createLogger(): Logger {
// Prepare logs rot path
fs.rmSync(logsRootPath, { recursive: true, force: true, maxRetries: 3 });
mkdirp.sync(logsRootPath);
fs.mkdirSync(logsRootPath, { recursive: true });
// Always log to log file
loggers.push(new FileLogger(path.join(logsRootPath, 'smoke-test-runner.log')));
@ -123,7 +122,7 @@ const testDataPath = path.join(os.tmpdir(), 'vscsmoke');
if (fs.existsSync(testDataPath)) {
rimraf.sync(testDataPath);
}
mkdirp.sync(testDataPath);
fs.mkdirSync(testDataPath, { recursive: true });
process.once('exit', () => {
try {
rimraf.sync(testDataPath);
@ -135,7 +134,7 @@ process.once('exit', () => {
const testRepoUrl = 'https://github.com/microsoft/vscode-smoketest-express';
const workspacePath = path.join(testDataPath, 'vscode-smoketest-express');
const extensionsPath = path.join(testDataPath, 'extensions-dir');
mkdirp.sync(extensionsPath);
fs.mkdirSync(extensionsPath, { recursive: true });
function fail(errorMessage): void {
logger.log(errorMessage);
@ -179,7 +178,7 @@ function parseQuality(): Quality {
//
if (!opts.web) {
let testCodePath = opts.build;
let electronPath: string;
let electronPath: string | undefined;
if (testCodePath) {
electronPath = getBuildElectronPath(testCodePath);