website/docs/how-it-works/languages.mdx
import LangGraph from '@site/src/components/Docs/LangGraph';
Although moon is currently focusing on the JavaScript ecosystem, our long-term vision is to be a multi-language task runner and monorepo management tool. To that end, our languages (known as toolchains) are implemented as WASM plugins, where their functionality is implemented in isolation, and is opt-in.
moon supported languages are opt-in, and are not enabled by default. We chose this pattern to avoid unnecessary overhead, especially for the future when we have 10 or more built-in languages.
To enable a supported language, simply define a configuration block with the language's name in
.moon/toolchains.*. Even an empty block will enable the language.
# Enable JavaScript
javascript: {}
# Enable JavaScript with custom settings
javascript:
packageManager: 'pnpm'
# Enable TypeScript
typescript: {}
When working with moon, you'll most likely have tasks that run built-in system commands that do not
belong to any of the supported languages. For example, you may have a task that runs git or
docker commands, or common commands like rm, cp, mv, etc.
For these cases, moon provides a special language/toolchain called system, that is always enabled.
This toolchain is a catch-all, an escape-hatch, a fallback, and provides the following:
PATH.To run system commands, set a task's toolchain setting to "system".
tasks:
example:
command: 'git status'
toolchain: 'system'
As mentioned in our introduction, language support is divided up into tiers, where each tier introduces more internal integrations and automations, but requires more work to properly implement.
The zero tier represents all languages not directly supported by moon. This tier merely exists as a mechanism for running non-supported language binaries via the system toolchain.
tasks:
example:
command: 'ruby'
toolchain: 'system'
The first tier is the language itself. This is the most basic level of support, and is the only tier that is required to be implemented for a language to be considered minimally supported. This tier is in charge of:
language setting..moon/toolchains.*.language: 'javascript'
The second tier requires the language functionality from tier 1, and eventually the toolchain functionality from tier 3, and provides interoperability with moon's internals. This is the most complex of all tiers, and the tier is in charge of:
PATH with appropriate lookups to execute a task.toolchains.default or task's
toolchains setting.tasks:
example:
command: 'webpack'
toolchain: 'node'
javascript: {}
node: {}
The third tier is toolchain support via proto. This is the final tier, as the toolchain is unusable unless the platform has been entirely integrated, and as such, the platform depends on this tier. This tier handles:
version field in the named configuration block in
.moon/toolchains.*.node:
version: '18.0.0'