Skip to content

Commit d093666

Browse files
authored
Merge pull request #391 from TrySound/drop-mkdirp
Replace mkdirp with builtin recursive flag
2 parents 0188312 + 8509a61 commit d093666

4 files changed

Lines changed: 5 additions & 12 deletions

File tree

package-lock.json

Lines changed: 0 additions & 5 deletions
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
@@ -43,7 +43,6 @@
4343
"filesize": "^6.1.0",
4444
"gzip-size": "^5.1.1",
4545
"lodash": "^4.17.20",
46-
"mkdirp": "^1.0.4",
4746
"opener": "^1.5.2",
4847
"ws": "^7.3.1"
4948
},

src/BundleAnalyzerPlugin.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
const fs = require('fs');
12
const path = require('path');
2-
const mkdir = require('mkdirp');
33
const {bold} = require('chalk');
44

55
const Logger = require('./Logger');
@@ -80,7 +80,7 @@ class BundleAnalyzerPlugin {
8080

8181
async generateStatsFile(stats) {
8282
const statsFilepath = path.resolve(this.compiler.outputPath, this.opts.statsFilename);
83-
mkdir.sync(path.dirname(statsFilepath));
83+
await fs.promises.mkdir(path.dirname(statsFilepath), {recursive: true});
8484

8585
try {
8686
await writeStats(stats, statsFilepath);

src/viewer.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ const WebSocket = require('ws');
66
const _ = require('lodash');
77
const express = require('express');
88
const ejs = require('ejs');
9-
const mkdir = require('mkdirp');
109
const {bold} = require('chalk');
1110

1211
const Logger = require('./Logger');
@@ -163,7 +162,7 @@ async function generateReport(bundleStats, opts) {
163162

164163
const reportFilepath = path.resolve(bundleDir || process.cwd(), reportFilename);
165164

166-
mkdir.sync(path.dirname(reportFilepath));
165+
fs.mkdirSync(path.dirname(reportFilepath), {recursive: true});
167166
fs.writeFileSync(reportFilepath, reportHtml);
168167

169168
logger.info(`${bold('Webpack Bundle Analyzer')} saved report to ${bold(reportFilepath)}`);
@@ -187,8 +186,8 @@ async function generateJSONReport(bundleStats, opts) {
187186

188187
if (!chartData) return;
189188

190-
mkdir.sync(path.dirname(reportFilename));
191-
fs.writeFileSync(reportFilename, JSON.stringify(chartData));
189+
await fs.promises.mkdir(path.dirname(reportFilename), {recursive: true});
190+
await fs.promises.writeFile(reportFilename, JSON.stringify(chartData));
192191

193192
logger.info(`${bold('Webpack Bundle Analyzer')} saved JSON report to ${bold(reportFilename)}`);
194193
}

0 commit comments

Comments
 (0)