Module: @kosko/config#

Table of contents#

Classes#

Type aliases#

Config#

Ƭ Config: ReadonlyDeep<Infer<typeof configSchema>>

Defined in: packages/config/src/types.ts:40


EnvironmentConfig#

Ƭ EnvironmentConfig: ReadonlyDeep<Infer<typeof environmentConfigSchema>>

Defined in: packages/config/src/types.ts:17

Functions#

getConfig#

getConfig(config: Config, env: string): Required<EnvironmentConfig>

Returns environment configs merged with global configs.

Parameters:#

NameTypeDescription
configConfigConfig object.
envstringEnvironment name.

Returns: Required<EnvironmentConfig>

Defined in: packages/config/src/config.ts:54


loadConfig#

loadConfig(path: string): Promise<Config>

Parses and validates a config file from the specified path.

Parameters:#

NameTypeDescription
pathstringPath of the config file.

Returns: Promise<Config>

Defined in: packages/config/src/config.ts:15


searchConfig#

searchConfig(cwd?: string): Promise<Config>

Searchs config files in the specified directory. Returns an empty object when config files does not exist in the directory.

Parameters:#

NameTypeDescription
cwdstringPath to the working directory.

Returns: Promise<Config>

Defined in: packages/config/src/config.ts:29


validate#

validate(data: unknown): Config

Validates data with kosko configuration schema. It throws a ValidationError when validation failed.

Parameters:#

NameType
dataunknown

Returns: Config

Defined in: packages/config/src/validate.ts:25