Comparing version 1.1.2 to 1.2.0
13
index.js
@@ -113,3 +113,5 @@ var detective = require('detective'), | ||
function getAllJSFiles(directory, opt) { | ||
var jsFilePaths = []; | ||
var jsFilePaths = [], | ||
ignoreDirs = opt.ignoreDirectories || [], | ||
ignoreFiles = opt.ignoreFiles || []; | ||
@@ -122,8 +124,9 @@ fs.readdirSync(directory).forEach(function (filename) { | ||
if (isDirectory) { | ||
if (opt.ignore && ! shouldBeIgnored(filename, opt.ignore) || | ||
(! opt.ignore || ! opt.ignore.length)) { | ||
if (ignoreDirs.length && shouldBeIgnored(filename, ignoreDirs)) return; | ||
jsFilePaths = jsFilePaths.concat(getAllJSFiles(fullName, opt)); | ||
} | ||
jsFilePaths = jsFilePaths.concat(getAllJSFiles(fullName, opt)); | ||
} else if (ext === '.js') { | ||
if (ignoreFiles && shouldBeIgnored(filename, ignoreFiles)) return; | ||
jsFilePaths.push(fullName); | ||
@@ -130,0 +133,0 @@ } |
{ | ||
"name": "app-root", | ||
"version": "1.1.2", | ||
"version": "1.2.0", | ||
"description": "Find the entry-point/root file of any CommonJS or AMD JavaScript application", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -18,6 +18,6 @@ Returns a list of candidate root files for CommonJS or AMD JavaScript applications within a directory. | ||
### Ignoring particular subdirectories | ||
### Ignoring particular subdirectories or files | ||
Supply an options object as the second parameter with a field `ignore` | ||
that contains a list of the directories that you want to ignore | ||
Supply an options object as the second parameter with a field `ignoreDirectories` or `ignoreFiles` | ||
that contains a list of the directories or files (respectively) that you want to ignore | ||
when looking for candidate app roots. | ||
@@ -29,3 +29,4 @@ | ||
var options = { | ||
ignore: ['bower_components', 'vendor', 'node_modules', '.git'] | ||
ignoreDirectories: ['bower_components', 'vendor', 'node_modules', '.git'], | ||
ignoreFiles: ['Gruntfile.js'] | ||
}; | ||
@@ -32,0 +33,0 @@ |
var getAppRoot = require('../'); | ||
var options = { | ||
ignore: ['bower_components'] | ||
ignoreDirectories: ['bower_components'], | ||
ignoreFiles: ['index.js'] | ||
}; | ||
@@ -6,0 +7,0 @@ |
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
9667
248
35