Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 789c320

Browse files
authoredSep 10, 2024
Replace mkdirp with fs.mkdirSync(path, { recursive: true }) (microsoft#228017)
* Replace mkdirp with fs.mkdirSync(path, { recursive: true }) (fix microsoft#227931) * compile
1 parent 8b7eb51 commit 789c320

17 files changed

+11
-129
lines changed
 

‎build/gulpfile.vscode.win32.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ const pkg = require('../package.json');
1616
const product = require('../product.json');
1717
const vfs = require('vinyl-fs');
1818
const rcedit = require('rcedit');
19-
const mkdirp = require('mkdirp');
2019

2120
const repoPath = path.dirname(__dirname);
2221
const buildPath = (/** @type {string} */ arch) => path.join(path.dirname(repoPath), `VSCode-win32-${arch}`);
@@ -75,7 +74,7 @@ function buildWin32Setup(arch, target) {
7574

7675
const sourcePath = buildPath(arch);
7776
const outputPath = setupDir(arch, target);
78-
mkdirp.sync(outputPath);
77+
fs.mkdirSync(outputPath, { recursive: true });
7978

8079
const originalProductJsonPath = path.join(sourcePath, 'resources/app/product.json');
8180
const productJsonPath = path.join(outputPath, 'product.json');

‎build/lib/builtInExtensions.js

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎build/lib/builtInExtensions.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ import * as fancyLog from 'fancy-log';
1515
import * as ansiColors from 'ansi-colors';
1616
import { Stream } from 'stream';
1717

18-
const mkdirp = require('mkdirp');
19-
2018
export interface IExtensionDefinition {
2119
name: string;
2220
version: string;
@@ -147,7 +145,7 @@ function readControlFile(): IControlFile {
147145
}
148146

149147
function writeControlFile(control: IControlFile): void {
150-
mkdirp.sync(path.dirname(controlFilePath));
148+
fs.mkdirSync(path.dirname(controlFilePath), { recursive: true });
151149
fs.writeFileSync(controlFilePath, JSON.stringify(control, null, 2));
152150
}
153151

‎build/package-lock.json

Lines changed: 0 additions & 23 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎build/package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
"@types/mime": "0.0.29",
2626
"@types/minimatch": "^3.0.3",
2727
"@types/minimist": "^1.2.1",
28-
"@types/mkdirp": "^1.0.1",
2928
"@types/mocha": "^9.1.1",
3029
"@types/node": "20.x",
3130
"@types/pump": "^1.0.1",
@@ -48,7 +47,6 @@
4847
"gulp-sort": "^2.0.0",
4948
"jsonc-parser": "^2.3.0",
5049
"mime": "^1.4.1",
51-
"mkdirp": "^1.0.4",
5250
"source-map": "0.6.1",
5351
"ternary-stream": "^3.0.0",
5452
"through2": "^4.0.2",

‎cglicenses.json

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -241,33 +241,6 @@
241241
"CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE."
242242
]
243243
},
244-
{
245-
// Reason: The substack org has been deleted on GH
246-
"name": "mkdirp",
247-
"fullLicenseText": [
248-
"Copyright 2010 James Halliday (mail@substack.net)",
249-
"",
250-
"This project is free software released under the MIT/X11 license:",
251-
"",
252-
"Permission is hereby granted, free of charge, to any person obtaining a copy",
253-
"of this software and associated documentation files (the \"Software\"), to deal",
254-
"in the Software without restriction, including without limitation the rights",
255-
"to use, copy, modify, merge, publish, distribute, sublicense, and/or sell",
256-
"copies of the Software, and to permit persons to whom the Software is",
257-
"furnished to do so, subject to the following conditions:",
258-
"",
259-
"The above copyright notice and this permission notice shall be included in",
260-
"all copies or substantial portions of the Software.",
261-
"",
262-
"THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR",
263-
"IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,",
264-
"FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE",
265-
"AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER",
266-
"LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,",
267-
"OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN",
268-
"THE SOFTWARE."
269-
]
270-
},
271244
{
272245
// Reason: repo URI is wrong on crate, pending https://github.com/warp-tech/russh/pull/53
273246
"name": "russh-cryptovec",

‎package-lock.json

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,6 @@
193193
"mime": "^1.4.1",
194194
"minimatch": "^3.0.4",
195195
"minimist": "^1.2.6",
196-
"mkdirp": "^1.0.4",
197196
"mocha": "^10.2.0",
198197
"mocha-junit-reporter": "^2.2.1",
199198
"mocha-multi-reporters": "^1.5.1",

‎test/automation/package-lock.json

Lines changed: 0 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎test/automation/package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,12 @@
1818
"prepublishOnly": "npm run copy-package-version"
1919
},
2020
"dependencies": {
21-
"mkdirp": "^1.0.4",
2221
"ncp": "^2.0.0",
2322
"tmp": "0.2.1",
2423
"tree-kill": "1.2.2",
2524
"vscode-uri": "3.0.2"
2625
},
2726
"devDependencies": {
28-
"@types/mkdirp": "^1.0.1",
2927
"@types/ncp": "2.0.1",
3028
"@types/node": "20.x",
3129
"@types/tmp": "0.2.2",

‎test/automation/src/electron.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*--------------------------------------------------------------------------------------------*/
55

66
import { join } from 'path';
7-
import * as mkdirp from 'mkdirp';
7+
import * as fs from 'fs';
88
import { copyExtension } from './extensions';
99
import { URI } from 'vscode-uri';
1010
import { measureAndLog } from './logger';
@@ -70,7 +70,7 @@ export async function resolveElectronConfiguration(options: LaunchOptions): Prom
7070
}
7171
args.push('--enable-proposed-api=vscode.vscode-test-resolver');
7272
const remoteDataDir = `${userDataDir}-server`;
73-
mkdirp.sync(remoteDataDir);
73+
fs.mkdirSync(remoteDataDir, { recursive: true });
7474

7575
env['TESTRESOLVER_DATA_FOLDER'] = remoteDataDir;
7676
env['TESTRESOLVER_LOGS_FOLDER'] = join(logsPath, 'server');

‎test/automation/src/playwrightBrowser.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import * as playwright from '@playwright/test';
77
import { ChildProcess, spawn } from 'child_process';
88
import { join } from 'path';
9-
import * as mkdirp from 'mkdirp';
9+
import * as fs from 'fs';
1010
import { URI } from 'vscode-uri';
1111
import { Logger, measureAndLog } from './logger';
1212
import type { LaunchOptions } from './code';
@@ -35,7 +35,7 @@ async function launchServer(options: LaunchOptions) {
3535
const serverLogsPath = join(logsPath, 'server');
3636
const codeServerPath = codePath ?? process.env.VSCODE_REMOTE_SERVER_PATH;
3737
const agentFolder = userDataDir;
38-
await measureAndLog(() => mkdirp(agentFolder), `mkdirp(${agentFolder})`, logger);
38+
await measureAndLog(() => fs.promises.mkdir(agentFolder, { recursive: true }), `mkdirp(${agentFolder})`, logger);
3939

4040
const env = {
4141
VSCODE_REMOTE_SERVER_PATH: codeServerPath,

‎test/integration/browser/package-lock.json

Lines changed: 0 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎test/integration/browser/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
"compile": "node ../../../node_modules/typescript/bin/tsc"
88
},
99
"devDependencies": {
10-
"@types/mkdirp": "^1.0.1",
1110
"@types/node": "20.x",
1211
"@types/rimraf": "^2.0.4",
1312
"@types/tmp": "0.1.0",

‎test/smoke/package-lock.json

Lines changed: 0 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎test/smoke/package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,11 @@
1111
"mocha": "node ../node_modules/mocha/bin/mocha"
1212
},
1313
"dependencies": {
14-
"mkdirp": "^1.0.4",
1514
"ncp": "^2.0.0",
1615
"node-fetch": "^2.6.7",
1716
"rimraf": "3.0.2"
1817
},
1918
"devDependencies": {
20-
"@types/mkdirp": "^1.0.1",
2119
"@types/mocha": "^9.1.1",
2220
"@types/ncp": "2.0.1",
2321
"@types/node": "20.x",

‎test/smoke/src/main.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import * as path from 'path';
1010
import * as os from 'os';
1111
import * as minimist from 'minimist';
1212
import * as rimraf from 'rimraf';
13-
import * as mkdirp from 'mkdirp';
1413
import * as vscodetest from '@vscode/test-electron';
1514
import fetch from 'node-fetch';
1615
import { Quality, MultiLogger, Logger, ConsoleLogger, FileLogger, measureAndLog, getDevElectronPath, getBuildElectronPath, getBuildVersion } from '../../automation';
@@ -105,7 +104,7 @@ function createLogger(): Logger {
105104

106105
// Prepare logs rot path
107106
fs.rmSync(logsRootPath, { recursive: true, force: true, maxRetries: 3 });
108-
mkdirp.sync(logsRootPath);
107+
fs.mkdirSync(logsRootPath, { recursive: true });
109108

110109
// Always log to log file
111110
loggers.push(new FileLogger(path.join(logsRootPath, 'smoke-test-runner.log')));
@@ -123,7 +122,7 @@ const testDataPath = path.join(os.tmpdir(), 'vscsmoke');
123122
if (fs.existsSync(testDataPath)) {
124123
rimraf.sync(testDataPath);
125124
}
126-
mkdirp.sync(testDataPath);
125+
fs.mkdirSync(testDataPath, { recursive: true });
127126
process.once('exit', () => {
128127
try {
129128
rimraf.sync(testDataPath);
@@ -135,7 +134,7 @@ process.once('exit', () => {
135134
const testRepoUrl = 'https://github.com/microsoft/vscode-smoketest-express';
136135
const workspacePath = path.join(testDataPath, 'vscode-smoketest-express');
137136
const extensionsPath = path.join(testDataPath, 'extensions-dir');
138-
mkdirp.sync(extensionsPath);
137+
fs.mkdirSync(extensionsPath, { recursive: true });
139138

140139
function fail(errorMessage): void {
141140
logger.log(errorMessage);
@@ -179,7 +178,7 @@ function parseQuality(): Quality {
179178
//
180179
if (!opts.web) {
181180
let testCodePath = opts.build;
182-
let electronPath: string;
181+
let electronPath: string | undefined;
183182

184183
if (testCodePath) {
185184
electronPath = getBuildElectronPath(testCodePath);

0 commit comments

Comments
 (0)
Please sign in to comment.