lib/utils.js
function loadConfig(justJson) {
    if (!justJson) {
        const configScript = path.resolve(currentDir, configScriptFileName);
        if (fs.existsSync(configScript)) {
            return require(configScript);
        }
    }

    const configJson = path.resolve(currentDir, configJsonFileName);
    if (fs.existsSync(configJson)) {
        return require(configJson);
    }

    const errorMessage = [
        `Specify a ${configScriptFileName} or ${configJsonFileName} file to configure the swagen tool.`,
        ``,
        `To create a configuration file in the current directory, use the following command:`,
        ``,
        `    swagen init`,
        ``,
        `This will ask you a series of questions and generate a configuration file based on your answers.`
    ].join(os.EOL);
    throw errorMessage;
}
function loadConfig(justJson) {
    if (!justJson) {
        const configScript = path.resolve(currentDir, configScriptFileName);
        if (fs.existsSync(configScript)) {
            return require(configScript);
        }
    }

    const configJson = path.resolve(currentDir, configJsonFileName);
    if (fs.existsSync(configJson)) {
        return require(configJson);
    }

    const errorMessage = [
        `Specify a ${configScriptFileName} or ${configJsonFileName} file to configure the swagen tool.`,
        ``,
        `To create a configuration file in the current directory, use the following command:`,
        ``,
        `    swagen init`,
        ``,
        `This will ask you a series of questions and generate a configuration file based on your answers.`
    ].join(os.EOL);
    throw errorMessage;
}
function loadConfig ( justJson ) { if ( ! justJson ) { const configScript = path . resolve ( currentDir , configScriptFileName ) ; if ( fs . existsSync ( configScript ) ) { return require ( configScript ) ; } } const configJson = path . resolve ( currentDir , configJsonFileName ) ; if ( fs . existsSync ( configJson ) ) { return require ( configJson ) ; } const errorMessage = [ ` ${ configScriptFileName } ${ configJsonFileName } ` , ` ` , ` ` , ` ` , ` ` , ` ` , ` ` ] . join ( os . EOL ) ; throw errorMessage ; }
Loads the correct configuration from the current directory.
@returns {Object} Configuration object
Loads the correct configuration from the current directory .