Configuration
Global Configs
Global configs are always applied when running kosko generate
command.
bail
Available since v3.0.0.
Default: false
Stop immediately when an error occurred.
baseEnvironment
Specify the base environment. You could define default or common variables in the base environment.
This option can be used with or without --env, -e
option. When --env, -e
option is set, variables in the base environment will be merged with the specified environment.
components
Components to generate. It can be either a component's name or a glob pattern.
If this value is not provided in kosko.toml
, then you must provides components when running kosko generate
command.
Examples
# Generate all components in components folder
components = ["*"]
# Generate components with the specified names
components = ["foo", "bar"]
# Generate components matched to the glob patterns
components = ["foo_*", "bar_*"]
# Ignore components
components = ["!foo", "!bar"]
extensions
Extension names of components. It's unnecessary to manually set this option. It can be detected automatically via require.extensions
.
Examples
extensions = ["js", "json"]
loaders
Available since v3.0.0.
Use module loaders. This option only works when ECMAScript modules (ESM) is enabled.
Examples
# Using TypeScript
loaders = ["ts-node/esm"]
require
Require external modules.
Examples
# Using TypeScript
require = ["ts-node/register"]
plugins
Available since v4.0.0.
Plugin configurations.
Examples
[[plugins]]
name = "@kosko/plugin-set-metadata"
config.namespace.value = "default"
Environment Configs
Environment configs are applied when running kosko generate
with --env, -e
option. Environment configs are merged with global configs. Only components
, loaders
, require
and plugins
can be specified in environment configs.
Examples
# Applied when env = "dev"
[environments.dev]
components = ["*_dev"]
# Applied when env = "prod"
[environments.prod]
components = ["*_prod"]
Paths
Tokens
#{environment}
- Environment name#{component}
- Component name (Only available inpaths.environment.component
)
paths.environment.global
Specify path to global environment files.
Default
environments/#{environment}
paths.environment.component
Specify path to component environment files.
Default
environments/#{environment}/#{component}