Comparing version 0.1.0 to 1.0.0
@@ -6,3 +6,3 @@ var fs = require('fs'); | ||
dirpath = path.resolve(dirpath); | ||
if (typeof mode === 'function' || typeof mode === 'undefined') { | ||
@@ -12,7 +12,7 @@ callback = mode; | ||
} | ||
if (!callback) { | ||
callback = function () {}; | ||
} | ||
fs.stat(dirpath, function (err, stats) { | ||
@@ -25,3 +25,9 @@ if (err) { | ||
} else { | ||
fs.mkdir(dirpath, mode, callback); | ||
fs.mkdir(dirpath, mode, function (err) { | ||
if (!err || err.code == 'EEXIST') { | ||
callback(null); | ||
} else { | ||
callback(err); | ||
} | ||
}); | ||
} | ||
@@ -42,7 +48,7 @@ }); | ||
dirpath = path.resolve(dirpath); | ||
if (typeof mode === 'undefined') { | ||
mode = 0777 & (~process.umask()); | ||
} | ||
try { | ||
@@ -49,0 +55,0 @@ if (!fs.statSync(dirpath).isDirectory()) { |
{ | ||
"name": "mkpath", | ||
"version": "0.1.0", | ||
"version": "1.0.0", | ||
"author": "Jonathan Rajavuori <jrajav@gmail.com>", | ||
@@ -19,3 +19,3 @@ "description": "Make all directories in a path, like mkdir -p", | ||
"scripts": { | ||
"test": "node node_modules/tap/bin/tap.js ./test" | ||
"test": "node node_modules/tap/bin/tap.js ./test/*.js" | ||
}, | ||
@@ -22,0 +22,0 @@ "devDependencies": { |
@@ -5,3 +5,2 @@ /* Tests borrowed from substack's node-mkdirp | ||
var mkpath = require('../'); | ||
var path = require('path'); | ||
var fs = require('fs'); | ||
@@ -8,0 +7,0 @@ var test = require('tap').test; |
@@ -5,3 +5,2 @@ /* Tests borrowed from substack's node-mkdirp | ||
var mkpath = require('../'); | ||
var path = require('path'); | ||
var fs = require('fs'); | ||
@@ -8,0 +7,0 @@ var test = require('tap').test; |
@@ -5,3 +5,2 @@ /* Tests borrowed from substack's node-mkdirp | ||
var mkpath = require('../'); | ||
var path = require('path'); | ||
var fs = require('fs'); | ||
@@ -20,12 +19,9 @@ var test = require('tap').test; | ||
if (err) t.fail(err); | ||
else path.exists(file, function (ex) { | ||
if (!ex) t.fail('file not created') | ||
else fs.stat(file, function (err, stat) { | ||
if (err) t.fail(err) | ||
else { | ||
t.equal(stat.mode & 0777, 0755); | ||
t.ok(stat.isDirectory(), 'target not a directory'); | ||
t.end(); | ||
} | ||
}) | ||
else fs.stat(file, function (err, stat) { | ||
if (err) t.fail(err) | ||
else { | ||
t.equal(stat.mode & 0777, 0755); | ||
t.ok(stat.isDirectory(), 'target not a directory'); | ||
t.end(); | ||
} | ||
}) | ||
@@ -32,0 +28,0 @@ }); |
@@ -5,3 +5,2 @@ /* Tests borrowed from substack's node-mkdirp | ||
var mkpath = require('../'); | ||
var path = require('path'); | ||
var fs = require('fs'); | ||
@@ -15,13 +14,10 @@ var test = require('tap').test; | ||
mkpath.sync(file, 0755); | ||
path.exists(file, function (ex) { | ||
if (!ex) t.fail('file not created') | ||
else fs.stat(file, function (err, stat) { | ||
if (err) t.fail(err) | ||
else { | ||
t.equal(stat.mode & 0777, 0755); | ||
t.ok(stat.isDirectory(), 'target not a directory'); | ||
t.end(); | ||
} | ||
}) | ||
}); | ||
fs.stat(file, function (err, stat) { | ||
if (err) t.fail(err) | ||
else { | ||
t.equal(stat.mode & 0777, 0755); | ||
t.ok(stat.isDirectory(), 'target not a directory'); | ||
t.end(); | ||
} | ||
}) | ||
}); | ||
@@ -34,13 +30,10 @@ | ||
mkpath.sync(file, 0755); | ||
path.exists(file, function (ex) { | ||
if (!ex) t.fail('file not created') | ||
else fs.stat(file, function (err, stat) { | ||
if (err) t.fail(err) | ||
else { | ||
t.ok(stat.isDirectory(), 'target not a directory'); | ||
t.end(); | ||
} | ||
}) | ||
}); | ||
fs.stat(file, function (err, stat) { | ||
if (err) t.fail(err) | ||
else { | ||
t.ok(stat.isDirectory(), 'target not a directory'); | ||
t.end(); | ||
} | ||
}) | ||
}); | ||
@@ -5,3 +5,2 @@ /* Tests borrowed from substack's node-mkdirp | ||
var mkpath = require('../'); | ||
var path = require('path'); | ||
var fs = require('fs'); | ||
@@ -16,12 +15,9 @@ var test = require('tap').test; | ||
if (err) t.fail(err); | ||
else path.exists(file, function (ex) { | ||
if (!ex) t.fail('file not created') | ||
else fs.stat(file, function (err, stat) { | ||
if (err) t.fail(err) | ||
else { | ||
t.equal(stat.mode & 0777, 0755); | ||
t.ok(stat.isDirectory(), 'target not a directory'); | ||
t.end(); | ||
} | ||
}) | ||
else fs.stat(file, function (err, stat) { | ||
if (err) t.fail(err) | ||
else { | ||
t.equal(stat.mode & 0777, 0755); | ||
t.ok(stat.isDirectory(), 'target not a directory'); | ||
t.end(); | ||
} | ||
}) | ||
@@ -28,0 +24,0 @@ }); |
@@ -5,3 +5,2 @@ /* Tests borrowed from substack's node-mkdirp | ||
var mkpath = require('../'); | ||
var path = require('path'); | ||
var fs = require('fs'); | ||
@@ -23,13 +22,10 @@ var test = require('tap').test; | ||
if (err) t.fail(err); | ||
else path.exists(file, function (ex) { | ||
if (!ex) t.fail('file not created') | ||
else fs.stat(file, function (err, stat) { | ||
if (err) t.fail(err) | ||
else { | ||
process.chdir(cwd); | ||
t.equal(stat.mode & 0777, 0755); | ||
t.ok(stat.isDirectory(), 'target not a directory'); | ||
t.end(); | ||
} | ||
}) | ||
else fs.stat(file, function (err, stat) { | ||
if (err) t.fail(err) | ||
else { | ||
process.chdir(cwd); | ||
t.equal(stat.mode & 0777, 0755); | ||
t.ok(stat.isDirectory(), 'target not a directory'); | ||
t.end(); | ||
} | ||
}) | ||
@@ -36,0 +32,0 @@ }); |
@@ -5,3 +5,2 @@ /* Tests borrowed from substack's node-mkdirp | ||
var mkpath = require('../'); | ||
var path = require('path'); | ||
var fs = require('fs'); | ||
@@ -25,14 +24,11 @@ var test = require('tap').test; | ||
path.exists(file, function (ex) { | ||
if (!ex) t.fail('file not created') | ||
else fs.stat(file, function (err, stat) { | ||
if (err) t.fail(err) | ||
else { | ||
t.equal(stat.mode & 0777, 0755); | ||
t.ok(stat.isDirectory(), 'target not a directory'); | ||
t.end(); | ||
} | ||
}); | ||
fs.stat(file, function (err, stat) { | ||
if (err) t.fail(err) | ||
else { | ||
t.equal(stat.mode & 0777, 0755); | ||
t.ok(stat.isDirectory(), 'target not a directory'); | ||
t.end(); | ||
} | ||
}); | ||
}); | ||
@@ -5,3 +5,2 @@ /* Tests borrowed from substack's node-mkdirp | ||
var mkpath = require('../'); | ||
var path = require('path'); | ||
var fs = require('fs'); | ||
@@ -25,14 +24,11 @@ var test = require('tap').test; | ||
path.exists(file, function (ex) { | ||
if (!ex) t.fail('file not created') | ||
else fs.stat(file, function (err, stat) { | ||
if (err) t.fail(err) | ||
else { | ||
t.equal(stat.mode & 0777, (0777 & (~process.umask()))); | ||
t.ok(stat.isDirectory(), 'target not a directory'); | ||
t.end(); | ||
} | ||
}); | ||
fs.stat(file, function (err, stat) { | ||
if (err) t.fail(err) | ||
else { | ||
t.equal(stat.mode & 0777, (0777 & (~process.umask()))); | ||
t.ok(stat.isDirectory(), 'target not a directory'); | ||
t.end(); | ||
} | ||
}); | ||
}); | ||
@@ -19,12 +19,9 @@ /* Tests borrowed from substack's node-mkdirp | ||
if (err) t.fail(err); | ||
else path.exists(file, function (ex) { | ||
if (!ex) t.fail('file not created') | ||
else fs.stat(file, function (err, stat) { | ||
if (err) t.fail(err) | ||
else { | ||
t.equal(stat.mode & 0777, 0777 & (~process.umask())); | ||
t.ok(stat.isDirectory(), 'target not a directory'); | ||
t.end(); | ||
} | ||
}) | ||
else fs.stat(file, function (err, stat) { | ||
if (err) t.fail(err) | ||
else { | ||
t.equal(stat.mode & 0777, 0777 & (~process.umask())); | ||
t.ok(stat.isDirectory(), 'target not a directory'); | ||
t.end(); | ||
} | ||
}) | ||
@@ -31,0 +28,0 @@ }); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
16
1
13217
320