Skip to content

Commit

Permalink
deps: replace mkdirp with {recursive} mkdir
Browse files Browse the repository at this point in the history
only supported on Node.js 10+

Closes: #2084
PR-URL: #2123
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
  • Loading branch information
rvagg committed Jun 3, 2020
1 parent a6b76a8 commit fdc8682
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 7 deletions.
3 changes: 1 addition & 2 deletions lib/configure.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ const fs = require('graceful-fs')
const path = require('path')
const log = require('npmlog')
const os = require('os')
const mkdirp = require('mkdirp')
const processRelease = require('./process-release')
const win = process.platform === 'win32'
const findNodeDirectory = require('./find-node-directory')
Expand Down Expand Up @@ -73,7 +72,7 @@ function configure (gyp, argv, callback) {

function createBuildDir () {
log.verbose('build dir', 'attempting to create "build" dir: %s', buildDir)
mkdirp(buildDir, function (err, isNew) {
fs.mkdir(buildDir, { recursive: true }, function (err, isNew) {
if (err) {
return callback(err)
}
Expand Down
5 changes: 2 additions & 3 deletions lib/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ const crypto = require('crypto')
const log = require('npmlog')
const semver = require('semver')
const request = require('request')
const mkdir = require('mkdirp')
const processRelease = require('./process-release')
const win = process.platform === 'win32'
const getProxyFromURI = require('./proxy')
Expand Down Expand Up @@ -114,7 +113,7 @@ function install (fs, gyp, argv, callback) {
log.verbose('ensuring nodedir is created', devDir)

// first create the dir for the node dev files
mkdir(devDir, function (err, created) {
fs.mkdir(devDir, { recursive: true }, function (err, created) {
if (err) {
if (err.code === 'EACCES') {
eaccesFallback(err)
Expand Down Expand Up @@ -310,7 +309,7 @@ function install (fs, gyp, argv, callback) {
log.verbose(name, 'dir', dir)
log.verbose(name, 'url', libUrl)

mkdir(dir, function (err) {
fs.mkdir(dir, { recursive: true }, function (err) {
if (err) {
return done(err)
}
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
"env-paths": "^2.2.0",
"glob": "^7.1.4",
"graceful-fs": "^4.2.3",
"mkdirp": "^0.5.1",
"nopt": "^4.0.3",
"npmlog": "^4.1.2",
"request": "^2.88.2",
Expand Down
3 changes: 2 additions & 1 deletion test/test-configure-python.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ const configure = requireInject('../lib/configure', {
openSync: function () { return 0 },
closeSync: function () { },
writeFile: function (file, data, cb) { cb() },
stat: function (file, cb) { cb(null, {}) }
stat: function (file, cb) { cb(null, {}) },
mkdir: function (dir, options, cb) { cb() }
}
})

Expand Down

0 comments on commit fdc8682

Please sign in to comment.