* Get content of the configuration file * @param {String} configPath - partial path to configuration file * @param {String} directory - directory path which will be joined with config argument * @return {Object}
(configPath, baseDirectory)
| 49 | * @return {Object} |
| 50 | */ |
| 51 | function getConfigContent (configPath, baseDirectory) { |
| 52 | if (!configPath) { |
| 53 | return; |
| 54 | } |
| 55 | |
| 56 | const resolvedPath = path.resolve(baseDirectory, configPath); |
| 57 | const configBasename = path.basename(resolvedPath); |
| 58 | |
| 59 | if (!fs.existsSync(resolvedPath)) { |
| 60 | return getNormalizedConfig(resolvedPath); |
| 61 | } |
| 62 | |
| 63 | const content = readConfigContent(resolvedPath); |
| 64 | return getNormalizedConfig(configBasename, content); |
| 65 | }; |
| 66 | |
| 67 | /** |
| 68 | * Read proper content from config file. |
nothing calls this directly
no test coverage detected