Skip to main content

Configuration

Global Configs​

Global configs are always applied when running kosko generate command.

bail​

info

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​

info

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"]

Environment Configs​

Environment configs are applied when running kosko generate with --env, -e option. Environment configs are merged with global configs. Only components, loaders and require 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 in paths.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}