Skip to content

Commit

Permalink
Merge pull request pahen#154 from realityking/drop-mz
Browse files Browse the repository at this point in the history
Remove mz as a production dependency. Instead use pify for promisifying.
  • Loading branch information
pahen authored Mar 4, 2018
2 parents 6cf25e3 + 6ca6d8d commit 524603b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
8 changes: 5 additions & 3 deletions lib/graph.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
'use strict';

const path = require('path');
const fs = require('mz/fs');
const exec = require('mz/child_process').exec;
const pify = require('pify');
const graphviz = require('graphviz');

const exec = pify(require('child_process').exec);
const writeFile = pify(require('fs').writeFile);

/**
* Set color on a node.
* @param {Object} node
Expand Down Expand Up @@ -122,7 +124,7 @@ module.exports.image = function (modules, circular, imagePath, config) {
return checkGraphvizInstalled(config)
.then(() => {
return createGraph(modules, circular, config, options)
.then((image) => fs.writeFile(imagePath, image))
.then((image) => writeFile(imagePath, image))
.then(() => path.resolve(imagePath));
});
};
Expand Down
10 changes: 5 additions & 5 deletions lib/tree.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
'use strict';

const os = require('os');
const fs = require('mz/fs');
const path = require('path');
const pify = require('pify');
const commondir = require('commondir');
const walk = require('walkdir');
const dependencyTree = require('dependency-tree');
const log = require('./log');

const stat = pify(require('fs').stat);

/**
* Check if running on Windows.
* @type {Boolean}
Expand Down Expand Up @@ -57,8 +59,7 @@ class Tree {
getDirs() {
return Promise
.all(this.srcPaths.map((srcPath) => {
return fs
.stat(srcPath)
return stat(srcPath)
.then((stats) => stats.isDirectory() ? srcPath : path.dirname(path.resolve(srcPath)));
}));
}
Expand All @@ -72,8 +73,7 @@ class Tree {

return Promise
.all(this.srcPaths.map((srcPath) => {
return fs
.stat(srcPath)
return stat(srcPath)
.then((stats) => {
if (stats.isFile()) {
files.push(path.resolve(srcPath));
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@
"debug": "^3.1.0",
"dependency-tree": "^6.0.0",
"graphviz": "^0.0.8",
"mz": "^2.7.0",
"ora": "^1.4.0",
"pify": "^3.0.0",
"pluralize": "^7.0.0",
"pretty-ms": "^3.0.1",
"rc": "^1.2.5",
Expand All @@ -56,6 +56,7 @@
"@aptoma/eslint-config": "^7.0.1",
"eslint": "^4.17.0",
"mocha": "^5.0.0",
"mz": "^2.7.0",
"should": "^13.2.1"
}
}

0 comments on commit 524603b

Please sign in to comment.