Skip to content
This repository has been archived by the owner on Oct 23, 2022. It is now read-only.

Commit

Permalink
Merge pull request #245 from amtrack/fix/remove-mkdirp
Browse files Browse the repository at this point in the history
fix(deps): remove dependency mkdirp
  • Loading branch information
amtrack authored May 23, 2020
2 parents 0a9cfab + e5de3f3 commit a4bba98
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 27 deletions.
31 changes: 17 additions & 14 deletions lib/cli/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
var chalk = require("chalk");
var fs = require("fs");
var path = require("path");
var mkdirp = require("mkdirp");
var _ = require("underscore");

module.exports.readFileSafe = function(filename) {
Expand Down Expand Up @@ -65,19 +64,23 @@ module.exports.readPackageXml = function(packageXmlPath) {
};

module.exports.writePackageXml = function(manifest, packageXmlPath, destructive, callback) {
mkdirp(path.dirname(packageXmlPath), function(mkdirErr) {
if (mkdirErr) {
return callback(mkdirErr);
} else {
fs.writeFile(packageXmlPath, manifest.toPackageXml(destructive), function(err) {
if (err) {
return callback(err);
} else {
return callback(null, "Created " + path.relative(process.cwd(), packageXmlPath));
}
});
}
});
fs.mkdir(
path.dirname(packageXmlPath), {
recursive: true
},
function(mkdirErr) {
if (mkdirErr) {
return callback(mkdirErr);
} else {
fs.writeFile(packageXmlPath, manifest.toPackageXml(destructive), function(err) {
if (err) {
return callback(err);
} else {
return callback(null, "Created " + path.relative(process.cwd(), packageXmlPath));
}
});
}
});
};

/**
Expand Down
5 changes: 3 additions & 2 deletions lib/remotes/provider/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ var Remote = require('../remote');

var path = require('path');
var fs = require('fs');
var mkdirp = require('mkdirp');

var ConfigRemoteProvider = module.exports = function(config) {
var self = this;
Expand Down Expand Up @@ -66,7 +65,9 @@ ConfigRemoteProvider.prototype.remove = function(name, callback) {
ConfigRemoteProvider.prototype.save = function(callback) {
var self = this;
if (!fs.existsSync(path.dirname(self.config.path))) {
mkdirp.sync(path.dirname(self.config.path), parseInt('0700', 8));
fs.mkdirSync(path.dirname(self.config.path), parseInt('0700', 8), {
recursive: true
});
}
fs.writeFile(self.config.path, JSON.stringify({
remotes: self.remotesDict
Expand Down
21 changes: 12 additions & 9 deletions lib/unzip.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
var yauzl = require('yauzl');
var path = require('path');
var mkdirp = require("mkdirp");
var fs = require('fs-extra');

var Unzip = module.exports = function(zipFilename) {
Expand Down Expand Up @@ -34,15 +33,19 @@ Unzip.prototype.target = function(targetDirectory, callback) {
}
var outputDir = path.join(targetDirectory, path.dirname(entry.fileName));
var outputFile = path.join(targetDirectory, entry.fileName);
mkdirp(outputDir, function(mkdirErr) {
if (mkdirErr) {
return callback(mkdirErr);
}
readStream.pipe(fs.createWriteStream(outputFile));
readStream.on("end", function() {
zipfile.readEntry();
fs.mkdir(
outputDir, {
recursive: true
},
function(mkdirErr) {
if (mkdirErr) {
return callback(mkdirErr);
}
readStream.pipe(fs.createWriteStream(outputFile));
readStream.on("end", function() {
zipfile.readEntry();
});
});
});
});
});
});
Expand Down
4 changes: 3 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
"jsforce": "^1.7.0",
"merge-stream": "^2.0.0",
"mississippi": "^4.0.0",
"mkdirp": "^0.5.1",
"multimatch": "^4.0.0",
"parse-diff": "^0.7.0",
"split2": "^3.0.0",
Expand Down

0 comments on commit a4bba98

Please sign in to comment.