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

Commit

Permalink
remove mkdirp dep (#3108)
Browse files Browse the repository at this point in the history
Co-authored-by: Michael Mifsud <xzyfer@gmail.com>
  • Loading branch information
jimmywarting and xzyfer authored Jun 24, 2021
1 parent 30a52f7 commit 911d4db
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 15 deletions.
9 changes: 4 additions & 5 deletions lib/extensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@

var eol = require('os').EOL,
fs = require('fs'),
pkg = require('../package.json'),
mkdir = require('mkdirp'),
path = require('path'),
defaultBinaryDir = path.join(__dirname, '..', 'vendor'),
trueCasePathSync = require('true-case-path');
trueCasePathSync = require('true-case-path'),
pkg = require('../package.json'),
defaultBinaryDir = path.join(__dirname, '..', 'vendor');

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

try {
mkdir.sync(cachePath);
fs.mkdirSync(cachePath, {recursive: true});
return cachePath;
} catch (e) {
// Directory is not writable, try another
Expand Down
5 changes: 2 additions & 3 deletions lib/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

var chalk = require('chalk'),
fs = require('fs'),
mkdirp = require('mkdirp'),
path = require('path'),
sass = require('./');

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

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

mkdirp(path.dirname(destination), function(err) {
fs.mkdir(path.dirname(destination), {recursive: true}, function(err) {
if (err) {
return emitter.emit('error', chalk.red(err));
}
Expand All @@ -85,7 +84,7 @@ module.exports = function(options, emitter) {
if (sourceMap) {
todo++;

mkdirp(path.dirname(sourceMap), function(err) {
fs.mkdir(path.dirname(sourceMap), {recursive: true}, function(err) {
if (err) {
return emitter.emit('error', chalk.red(err));
}
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@
"glob": "^7.0.3",
"lodash": "^4.17.15",
"meow": "^9.0.0",
"mkdirp": "^0.5.1",
"nan": "^2.13.2",
"node-gyp": "^7.1.0",
"npmlog": "^4.0.0",
Expand Down
3 changes: 1 addition & 2 deletions scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
*/

var fs = require('fs'),
mkdir = require('mkdirp'),
path = require('path'),
spawn = require('cross-spawn'),
sass = require('../lib/extensions');
Expand All @@ -24,7 +23,7 @@ function afterBuild(options) {
: 'Release',
'binding.node');

mkdir(path.dirname(install), function(err) {
fs.mkdir(path.dirname(install), {recursive: true}, function(err) {
if (err && err.code !== 'EEXIST') {
console.error(err.message);
return;
Expand Down
7 changes: 3 additions & 4 deletions scripts/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@

var fs = require('fs'),
eol = require('os').EOL,
mkdir = require('mkdirp'),
path = require('path'),
sass = require('../lib/extensions'),
request = require('request'),
log = require('npmlog'),
sass = require('../lib/extensions'),
downloadOptions = require('./util/downloadoptions');

/**
Expand Down Expand Up @@ -111,7 +110,7 @@ function checkAndDownloadBinary() {
}

try {
mkdir.sync(path.dirname(binaryPath));
fs.mkdirSync(path.dirname(binaryPath), {recursive: true});
} catch (err) {
console.error('Unable to save binary', path.dirname(binaryPath), ':', err);
return;
Expand All @@ -137,7 +136,7 @@ function checkAndDownloadBinary() {
console.log('Caching binary to', cachedBinary);

try {
mkdir.sync(path.dirname(cachedBinary));
fs.mkdirSync(path.dirname(cachedBinary), {recursive: true});
fs.createReadStream(binaryPath)
.pipe(fs.createWriteStream(cachedBinary))
.on('error', function (err) {
Expand Down

0 comments on commit 911d4db

Please sign in to comment.