From 65b3e6758d8acf5ea933a9ed9e8340ac53650260 Mon Sep 17 00:00:00 2001 From: Robert Jackson Date: Fri, 4 Sep 2020 10:58:36 -0400 Subject: [PATCH] Remove mkdirp usage in favor of `fs.mkdirSync(path, { recursive: true });` --- index.js | 4 ++-- lib/process-file.js | 3 +-- package.json | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/index.js b/index.js index 84e5cc1..1e9b37f 100644 --- a/index.js +++ b/index.js @@ -1,11 +1,11 @@ 'use strict'; +const fs = require('fs'); const walkSync = require('walk-sync'); const Plugin = require('broccoli-plugin'); const path = require('path'); const defaults = require('lodash.defaultsdeep'); const symlinkOrCopy = require('symlink-or-copy'); -const mkdirp = require('mkdirp'); const MatcherCollection = require('matcher-collection'); const debug = require('debug')('broccoli-uglify-sourcemap'); const queue = require('async-promise-queue'); @@ -71,7 +71,7 @@ module.exports = class UglifyWriter extends Plugin { let inFile = path.join(inputPath, relativePath); let outFile = path.join(this.outputPath, relativePath); - mkdirp.sync(path.dirname(outFile)); + fs.mkdirSync(path.dirname(outFile), { recursive: true }); if (this._isJSExt(relativePath) && !this.excludes.match(relativePath)) { // wrap this in a function so it doesn't actually run yet, and can be throttled diff --git a/lib/process-file.js b/lib/process-file.js index 19e9fc7..d9017ab 100644 --- a/lib/process-file.js +++ b/lib/process-file.js @@ -3,7 +3,6 @@ const debug = require('debug')('broccoli-uglify-sourcemap'); const defaults = require('lodash.defaultsdeep'); const fs = require('fs'); -const mkdirp = require('mkdirp'); const path = require('path'); const terser = require('terser'); const getSourceMapContent = require('./get-sourcemap-content'); @@ -81,7 +80,7 @@ module.exports = async function processFile(inFile, outFile, relativePath, outDi } return path; }); - mkdirp.sync(mapDir); + fs.mkdirSync(mapDir, { recursive: true }); fs.writeFileSync(path.join(mapDir, mapName), JSON.stringify(newSourceMap)); } fs.writeFileSync(outFile, result.code); diff --git a/package.json b/package.json index d005e73..13e5c3e 100644 --- a/package.json +++ b/package.json @@ -57,7 +57,7 @@ "release-it-lerna-changelog": "^2.3.0" }, "engines": { - "node": "10.* || 12.* || >= 14" + "node": "^10.12.0 || 12.* || >= 14" }, "publishConfig": { "registry": "https://registry.npmjs.org"