Skip to content

Commit 616fef9

Browse files
committed
Merge branch 'master' into greenkeeper-doxdox-plugin-markdown-1.0.3
2 parents d6510c3 + 0c06ee1 commit 616fef9

File tree

3 files changed

+22
-6
lines changed

3 files changed

+22
-6
lines changed

DOCUMENTATION.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ Find which node_modules directory to load package from.
126126
Load parser based on user defined choice.
127127

128128
loadParser({'parser': 'dox'}).then(parser => {});
129+
loadParser({'parser': 'parser.js'}).then(parser => {});
129130

130131

131132

lib/loaders.js

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ const findPackagePath = pkg =>
4545
* Load parser based on user defined choice.
4646
*
4747
* loadParser({'parser': 'dox'}).then(parser => {});
48+
* loadParser({'parser': 'parser.js'}).then(parser => {});
4849
*
4950
* @param {Object} config Configuration object.
5051
* @param {String} config.parser String representing the parser to be loaded.
@@ -54,11 +55,27 @@ const findPackagePath = pkg =>
5455

5556
const loadParser = config => new Promise((resolve, reject) => {
5657

57-
findPackagePath(`doxdox-parser-${config.parser}`).then(parser => {
58+
fs.stat(config.parser, (err, stats) => {
5859

59-
if (parser.length) {
60+
if (err) {
61+
62+
findPackagePath(`doxdox-parser-${config.parser}`).then(parser => {
6063

61-
resolve(require(parser[0]));
64+
if (parser.length) {
65+
66+
resolve(require(parser[0]));
67+
68+
} else {
69+
70+
reject('Invalid parser specified.');
71+
72+
}
73+
74+
});
75+
76+
} else if (stats && stats.isFile() && config.parser.match(JAVASCRIPT_PATTERN)) {
77+
78+
resolve(require(path.join(process.cwd(), config.parser)));
6279

6380
} else {
6481

@@ -117,8 +134,6 @@ const loadPlugin = config => new Promise((resolve, reject) => {
117134

118135
}
119136

120-
return false;
121-
122137
});
123138

124139
});

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"dependencies": {
1414
"chalk": "1.1.3",
1515
"doxdox-parser-dox": "~1.0.4",
16-
"doxdox-plugin-bootstrap": "~1.0.3",
16+
"doxdox-plugin-bootstrap": "~1.0.4",
1717
"doxdox-plugin-handlebars": "~1.0.3",
1818
"doxdox-plugin-markdown": "~1.0.3",
1919
"globby": "6.1.0",

0 commit comments

Comments
 (0)