Module: @kosko/config
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
, env
): Required
<EnvironmentConfig
>
Returns environment configs merged with global configs.
Parameters
Name | Type | Description |
---|---|---|
config | ReadonlyObjectDeep <{ baseEnvironment : undefined | string ; components : undefined | string [] ; environments : undefined | Record <string , { require?: string[] | undefined; components?: string[] | undefined; }> ; extensions : undefined | string [] ; paths : undefined | { environment?: { global?: string | undefined; component?: string | undefined; } | undefined; } ; require : undefined | string [] }> | Config object. |
env | string | Environment name. |
Returns
Required
<EnvironmentConfig
>
Defined in
packages/config/src/config.ts:52
loadConfig
▸ loadConfig(path
): Promise
<Config
>
Parses and validates a config file from the specified path.
Parameters
Name | Type | Description |
---|---|---|
path | string | Path 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
Name | Type | Description |
---|---|---|
cwd | string | Path to the working directory. |
Returns
Promise
<Config
>
Defined in
packages/config/src/config.ts:27
validate
▸ validate(data
): Config
Validates data with kosko configuration schema. It throws a ValidationError when validation failed.
Parameters
Name | Type |
---|---|
data | unknown |