Skip to content

Commit

Permalink
Replace mkdirp with fs.mkdirSync(path, { recursive: true }) (#228017)
Browse files Browse the repository at this point in the history
* Replace mkdirp with fs.mkdirSync(path, { recursive: true })
(fix #227931)

* compile
  • Loading branch information
bpasero authored Sep 10, 2024
1 parent 8b7eb51 commit 789c320
Show file tree
Hide file tree
Showing 17 changed files with 11 additions and 129 deletions.
3 changes: 1 addition & 2 deletions build/gulpfile.vscode.win32.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);
Expand Down Expand Up @@ -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');
Expand Down
3 changes: 1 addition & 2 deletions build/lib/builtInExtensions.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions build/lib/builtInExtensions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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));
}

Expand Down
23 changes: 0 additions & 23 deletions build/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions build/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down
27 changes: 0 additions & 27 deletions cglicenses.json
Original file line number Diff line number Diff line change
Expand Up @@ -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 ([email protected])",
"",
"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",
Expand Down
1 change: 0 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
22 changes: 0 additions & 22 deletions test/automation/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions test/automation/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions test/automation/src/electron.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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');
Expand Down
4 changes: 2 additions & 2 deletions test/automation/src/playwrightBrowser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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,
Expand Down
10 changes: 0 additions & 10 deletions test/integration/browser/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion test/integration/browser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
22 changes: 0 additions & 22 deletions test/smoke/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions test/smoke/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Loading

0 comments on commit 789c320

Please sign in to comment.