rc-config-loader

  • Version 5.0.0
  • Published
  • 56.3 kB
  • 3 dependencies
  • MIT license

Install

npm i rc-config-loader
yarn add rc-config-loader
pnpm add rc-config-loader

Overview

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

Index

Functions

function loadConfigFile

loadConfigFile: <R extends {}>(
filePath: string,
opts?: loadConfigFileOption
) => rcConfigResult<R>;
  • Load exactly one config file, return { config, filePath } - filePath is resolved from opts.cwd(default: process.cwd()) - It does not search parent directories, does not append any extension, and does not read package.json - The loader is selected by the extension of filePath - .json → JSON, .yaml/.yml → YAML, .js/.cjs/.mjs → JavaScript, .ts/.cts/.mts → TypeScript - Other names like .secretlintrc are tried as JSON, YAML, then JavaScript (in order of extensions) - If the file does not exist, throw an Error that has code: "ENOENT" - If the file can not be parsed, throw an Error

    Parameter filePath

    Parameter opts

    Returns

    {{ config: Object, filePath:string }}

function rcFile

rcFile: <R extends {}>(
pkgName: string,
opts?: rcConfigLoaderOption
) => PossibleUndefined<rcConfigResult<R>>;
  • Find and load rcfile, return { config, filePath } If not found any rcfile, throw an Error.

    Parameter pkgName

    Parameter opts

    Returns

    {{ config: Object, filePath:string } | undefined}

Package Files (1)

Dependencies (3)

Dev Dependencies (6)

Peer Dependencies (0)

No peer dependencies.

Badge

To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/rc-config-loader.

  • Markdown
    [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/rc-config-loader)
  • HTML
    <a href="https://www.jsdocs.io/package/rc-config-loader"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>