* Gets the prompter from an adapter given an adapter path
(adapterPath)
| 135 | * Gets the prompter from an adapter given an adapter path |
| 136 | */ |
| 137 | function getPrompter (adapterPath) { |
| 138 | // Resolve the adapter path |
| 139 | let resolvedAdapterPath = resolveAdapterPath(adapterPath); |
| 140 | |
| 141 | // Load the adapter |
| 142 | let adapter = require(resolvedAdapterPath); |
| 143 | |
| 144 | /* istanbul ignore next */ |
| 145 | if (adapter && adapter.prompter && isFunction(adapter.prompter)) { |
| 146 | return adapter.prompter; |
| 147 | } else if (adapter && adapter.default && adapter.default.prompter && isFunction(adapter.default.prompter)) { |
| 148 | return adapter.default.prompter; |
| 149 | } else { |
| 150 | throw new Error(`Could not find prompter method in the provided adapter module: ${adapterPath}`); |
| 151 | } |
| 152 | } |
| 153 | |
| 154 | /** |
| 155 | * Given a resolvable module name or path, which can be a directory or file, will |
no test coverage detected