Skip to content

Commit d92189b

Browse files
committed
0.6.1
1 parent 45028df commit d92189b

File tree

2 files changed

+11
-33
lines changed

2 files changed

+11
-33
lines changed

bin/buddy

Lines changed: 9 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
#!/usr/bin/env node
22

3-
var sep = require('path').sep;
43
var chalk = require('chalk');
5-
var fs = require('fs');
6-
var file = require('file');
4+
var filepaths = require('node-filepaths');
75
var program = require('commander');
86
var Detector = require('../lib/detector');
97
var reporters = require('../lib/reporters');
@@ -32,35 +30,15 @@ if (!program.color) {
3230
}
3331

3432
// Iterate over the given paths, and recurse if they're directories
35-
var paths = [];
36-
suppliedPaths.forEach(function(path) {
37-
try {
38-
if (fs.statSync(path).isFile()) {
39-
return paths.push(path);
40-
}
41-
} catch(e) {
42-
console.log('No such file or directory:', path);
43-
process.exit(3);
44-
}
45-
46-
// Look for .js files, ignore node_modules, cleanup paths
47-
file.walkSync(path, function(dirPath, dirs, files) {
48-
files.forEach(function(file) {
49-
if (file.slice(-3) !== '.js') return;
50-
if (dirPath.indexOf('node_modules') > -1) return;
51-
52-
if (dirPath.slice(-1) !== sep) {
53-
dirPath += sep;
54-
}
55-
56-
if (dirPath.indexOf(sep) !== 0 && dirPath.indexOf('.') !== 0) {
57-
dirPath = './' + dirPath;
58-
}
59-
60-
paths.push(dirPath + file);
61-
});
33+
try {
34+
var paths = filepaths.getSync(suppliedPaths, {
35+
suffix: '.js',
36+
ignore: 'node_modules'
6237
});
63-
});
38+
} catch(e) {
39+
console.log(e.message);
40+
process.exit(3);
41+
}
6442

6543
if (!paths.length) {
6644
console.log('No .js files found in the list of paths');

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "buddy.js",
3-
"version": "0.6.0",
3+
"version": "0.6.1",
44
"description": "Magic number detector for javascript",
55
"keywords": [
66
"magic",
@@ -25,7 +25,7 @@
2525
"bluebird": "*",
2626
"acorn": "0.7.0",
2727
"commander": "*",
28-
"file": "*",
28+
"node-filepaths": "*",
2929
"chalk": "*"
3030
},
3131
"devDependencies": {

0 commit comments

Comments
 (0)