Skip to main content

Module: @kosko/config

Classes

Type Aliases

Config

Ƭ Config: Infer<typeof configSchema>

Defined in

packages/config/src/types.ts:38


EnvironmentConfig

Ƭ EnvironmentConfig: Infer<typeof environmentConfigSchema>

Defined in

packages/config/src/types.ts:17

Functions

getConfig

getConfig(config, envs): Required<EnvironmentConfig>

Returns environment configs merged with global configs.

Parameters

NameTypeDescription
configObjectConfig object.
config.baseEnvironmentundefined | string-
config.componentsundefined | string[]-
config.environmentsundefined | Record<string, { require?: string[] | undefined; components?: string[] | undefined; loaders?: string[] | undefined; }>-
config.extensionsundefined | string[]-
config.loadersundefined | string[]-
config.pathsundefined | { environment?: { global?: string | undefined; component?: string | undefined; } | undefined; }-
config.requireundefined | string[]-
envsstring | string[]Environment name.

Returns

Required<EnvironmentConfig>

Defined in

packages/config/src/config.ts:56


loadConfig

loadConfig(path): 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:13


searchConfig

searchConfig(cwd?): 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:27


toArray

toArray<T>(value): T[]

Type parameters

Name
T

Parameters

NameType
valueT | T[]

Returns

T[]

Defined in

packages/config/src/config.ts:46


validate

validate(data): 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