How to use rc-config-loader - 2 common examples

To help you get started, we’ve selected a few rc-config-loader examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github textlint / textlint / packages / textlint / src / config / config-loader.ts View on Github external
filePath: string | undefined;
} {
    // if specify Config module, use it
    if (configFilePath) {
        try {
            const modulePath = moduleResolver.resolveConfigPackageName(configFilePath);
            return {
                config: moduleInterop(require(modulePath)),
                filePath: modulePath
            };
        } catch (error) {
            // not found config module
        }
    }
    // auto or specify path to config file
    const result = rcFile(configFileName, {
        configFileName: configFilePath,
        defaultExtension: [".json", ".js", ".yml"],
        packageJSON: {
            fieldName: "textlint"
        },
        cwd
    });
    if (result === undefined) {
        return {
            config: {},
            filePath: undefined
        };
    }
    return {
        config: result.config,
        filePath: result.filePath
github tjunnone / npm-check-updates / lib / npm-check-updates.js View on Github external
function getNcurc({configFileName, configFilePath, packageFile} = {}) {
    const file = rcFile('ncurc', {
        configFileName: configFileName || '.ncurc',
        defaultExtension: ['.json', '.yml', '.js'],
        cwd: configFilePath ||
            (packageFile ? path.dirname(packageFile) : undefined)
    });
    return file && file.config;
}

rc-config-loader

load config file from .{product}rc.{json,yml,js}

MIT
Latest version published 2 years ago

Package Health Score

68 / 100
Full package analysis

Popular rc-config-loader functions