* Adds test project * Adds e2e for end-2-end tests * Update gitignore * Update loaders * Creates test project * v0.1.27 * Upgrade * dependency fixes * Load project plugins in the plugin loader * Issue with instanceof * Fixes versioning issues * Adds medusa middleware api * Adds documentation * Fixes tests
24 lines
658 B
JavaScript
24 lines
658 B
JavaScript
import path from "path"
|
|
|
|
/**
|
|
* Attempts to resolve the config file in a given root directory.
|
|
* @param {string} rootDir - the directory to find the config file in.
|
|
* @param {string} configName - the name of the config file.
|
|
* @return {object} an object containing the config module and its path.
|
|
*/
|
|
function getConfigFile(rootDir, configName) {
|
|
const configPath = path.join(rootDir, configName)
|
|
let configFilePath = ``
|
|
let configModule
|
|
try {
|
|
configFilePath = require.resolve(configPath)
|
|
configModule = require(configFilePath)
|
|
} catch (err) {
|
|
return {}
|
|
}
|
|
|
|
return { configModule, configFilePath }
|
|
}
|
|
|
|
export default getConfigFile
|