Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit 911d4db

Browse files
jimmywartingxzyfer
andauthored
remove mkdirp dep (#3108)
Co-authored-by: Michael Mifsud <[email protected]>
1 parent 30a52f7 commit 911d4db

File tree

5 files changed

+10
-15
lines changed

5 files changed

+10
-15
lines changed

lib/extensions.js

+4-5
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,10 @@
44

55
var eol = require('os').EOL,
66
fs = require('fs'),
7-
pkg = require('../package.json'),
8-
mkdir = require('mkdirp'),
97
path = require('path'),
10-
defaultBinaryDir = path.join(__dirname, '..', 'vendor'),
11-
trueCasePathSync = require('true-case-path');
8+
trueCasePathSync = require('true-case-path'),
9+
pkg = require('../package.json'),
10+
defaultBinaryDir = path.join(__dirname, '..', 'vendor');
1211

1312
/**
1413
* Get the human readable name of the Platform that is running
@@ -352,7 +351,7 @@ function getBinaryCachePath() {
352351
cachePath = path.join(cachePathCandidates[i], pkg.name, pkg.version);
353352

354353
try {
355-
mkdir.sync(cachePath);
354+
fs.mkdirSync(cachePath, {recursive: true});
356355
return cachePath;
357356
} catch (e) {
358357
// Directory is not writable, try another

lib/render.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
var chalk = require('chalk'),
66
fs = require('fs'),
7-
mkdirp = require('mkdirp'),
87
path = require('path'),
98
sass = require('./');
109

@@ -66,7 +65,7 @@ module.exports = function(options, emitter) {
6665

6766
emitter.emit('info', chalk.green('Rendering Complete, saving .css file...'));
6867

69-
mkdirp(path.dirname(destination), function(err) {
68+
fs.mkdir(path.dirname(destination), {recursive: true}, function(err) {
7069
if (err) {
7170
return emitter.emit('error', chalk.red(err));
7271
}
@@ -85,7 +84,7 @@ module.exports = function(options, emitter) {
8584
if (sourceMap) {
8685
todo++;
8786

88-
mkdirp(path.dirname(sourceMap), function(err) {
87+
fs.mkdir(path.dirname(sourceMap), {recursive: true}, function(err) {
8988
if (err) {
9089
return emitter.emit('error', chalk.red(err));
9190
}

package.json

-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@
6161
"glob": "^7.0.3",
6262
"lodash": "^4.17.15",
6363
"meow": "^9.0.0",
64-
"mkdirp": "^0.5.1",
6564
"nan": "^2.13.2",
6665
"node-gyp": "^7.1.0",
6766
"npmlog": "^4.0.0",

scripts/build.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
*/
44

55
var fs = require('fs'),
6-
mkdir = require('mkdirp'),
76
path = require('path'),
87
spawn = require('cross-spawn'),
98
sass = require('../lib/extensions');
@@ -24,7 +23,7 @@ function afterBuild(options) {
2423
: 'Release',
2524
'binding.node');
2625

27-
mkdir(path.dirname(install), function(err) {
26+
fs.mkdir(path.dirname(install), {recursive: true}, function(err) {
2827
if (err && err.code !== 'EEXIST') {
2928
console.error(err.message);
3029
return;

scripts/install.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,10 @@
44

55
var fs = require('fs'),
66
eol = require('os').EOL,
7-
mkdir = require('mkdirp'),
87
path = require('path'),
9-
sass = require('../lib/extensions'),
108
request = require('request'),
119
log = require('npmlog'),
10+
sass = require('../lib/extensions'),
1211
downloadOptions = require('./util/downloadoptions');
1312

1413
/**
@@ -111,7 +110,7 @@ function checkAndDownloadBinary() {
111110
}
112111

113112
try {
114-
mkdir.sync(path.dirname(binaryPath));
113+
fs.mkdirSync(path.dirname(binaryPath), {recursive: true});
115114
} catch (err) {
116115
console.error('Unable to save binary', path.dirname(binaryPath), ':', err);
117116
return;
@@ -137,7 +136,7 @@ function checkAndDownloadBinary() {
137136
console.log('Caching binary to', cachedBinary);
138137

139138
try {
140-
mkdir.sync(path.dirname(cachedBinary));
139+
fs.mkdirSync(path.dirname(cachedBinary), {recursive: true});
141140
fs.createReadStream(binaryPath)
142141
.pipe(fs.createWriteStream(cachedBinary))
143142
.on('error', function (err) {

0 commit comments

Comments
 (0)