-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: add debug logs for unresolvable plugins (#74)
* fix: add debug logs for unresolvable plugins and remove the need for "lib/isPlugin.js" also, add test for undefined $NODE_PATH edge case * fix: add debug log for plugins missing a "register" export And remove the `require.resolve` check.
- Loading branch information
1 parent
6c5d529
commit 546d75b
Showing
5 changed files
with
29 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
const debug = require('debug')('meta:registerPlugin'); | ||
|
||
module.exports = (program, mod) => { | ||
const plugin = require(mod); | ||
if (plugin.register) { | ||
debug(`registering plugin ${mod}`); | ||
module.exports = (program, pluginPath) => { | ||
plugin = require(pluginPath); | ||
if (typeof plugin.register === 'function') { | ||
debug(`Registering plugin: '${pluginPath}'`); | ||
plugin.register(program); | ||
} else { | ||
debug(`Plugin has no "register" function: '${pluginPath}'`); | ||
} | ||
}; |