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
| Name | Type | Description |
|---|---|---|
config | Object | Config object. |
config.baseEnvironment | undefined | string | - |
config.components | undefined | string[] | - |
config.environments | undefined | Record<string, { require?: string[] | undefined; components?: string[] | undefined; loaders?: string[] | undefined; }> | - |
config.extensions | undefined | string[] | - |
config.loaders | undefined | string[] | - |
config.paths | undefined | { environment?: { global?: string | undefined; component?: string | undefined; } | undefined; } | - |
config.require | undefined | string[] | - |
envs | string | 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
| 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
toArray
▸ toArray<T>(value): T[]
Type parameters
| Name |
|---|
T |
Parameters
| Name | Type |
|---|---|
value | T | 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
| Name | Type |
|---|---|
data | unknown |