Skip to content

Commit d504825

Browse files
committed
Added formatPathsArrayToIgnore method.
1 parent 84809d4 commit d504825

File tree

4 files changed

+46
-3
lines changed

4 files changed

+46
-3
lines changed

.eslintrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"global-require": 0,
77
"no-catch-shadow": 0,
88
"no-param-reassign": 0,
9+
"no-shadow": 0,
910
"no-sync": 0
1011
}
1112
}

DOCUMENTATION.md

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# [doxdox](https://github.com/neogeek/doxdox) *1.0.0*
1+
# [doxdox](https://github.com/neogeek/doxdox) *1.0.1*
22

33
> JSDoc to Bootstrap and Markdown documentation generator.
44
@@ -139,5 +139,28 @@ Finds package.json file from either the directory the script was called from or
139139

140140

141141

142+
#### formatPathsArrayToIgnore(paths)
143+
144+
Format an array of directories and/or files to be ignored by globby by adding a "!" at the beginning of each path.
145+
146+
console.log(formatPathsArrayToIgnore([]));
147+
148+
149+
150+
151+
##### Parameters
152+
153+
- **paths** `Array` Array of directories and/or files.
154+
155+
156+
157+
158+
##### Returns
159+
160+
161+
- `Array` Modified array of directories and/or files.
162+
163+
164+
142165

143166
*Documentation generated with [doxdox](https://github.com/neogeek/doxdox).*

lib/doxdox.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ const globby = require('globby');
66

77
const loaders = require('./loaders');
88

9+
const formatPathsArrayToIgnore = require('./utils').formatPathsArrayToIgnore;
10+
911
const DEFAULT_IGNORE_PATHS = [
1012
'!./{node_modules,bower_components,test,tests}/**',
1113
'!./Gruntfile.js',
@@ -62,7 +64,10 @@ const parseInput = (input, config) =>
6264
*/
6365

6466
const parseInputs = (inputs, config) => loaders.loadPlugin(config).then(plugin =>
65-
globby(inputs.concat(DEFAULT_IGNORE_PATHS), {'nodir': true}).then(files =>
67+
globby(inputs.concat(
68+
DEFAULT_IGNORE_PATHS,
69+
formatPathsArrayToIgnore(config.ignore)
70+
), {'nodir': true}).then(files =>
6671
Promise.all(files.map(input => parseInput(input, config))))
6772
.then(files => plugin(Object.assign({
6873
files

lib/utils.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,20 @@ const findPackageFileInPath = input => {
4545

4646
};
4747

48+
/**
49+
* Format an array of directories and/or files to be ignored by globby by adding a "!" at the beginning of each path.
50+
*
51+
* console.log(formatPathsArrayToIgnore([]));
52+
*
53+
* @param {Array} paths Array of directories and/or files.
54+
* @return {Array} Modified array of directories and/or files.
55+
* @public
56+
*/
57+
58+
const formatPathsArrayToIgnore = paths =>
59+
paths.map(path => `!${path.replace(/^!/, '')}`);
60+
4861
module.exports = {
49-
findPackageFileInPath
62+
findPackageFileInPath,
63+
formatPathsArrayToIgnore
5064
};

0 commit comments

Comments
 (0)