moon.{pkl,yml}
The moon.yml
configuration file is not required but can be used to define additional metadata
for a project, override inherited tasks, and more at the project-level. When used, this file must
exist in a project's root, as configured in projects
.
$schema: 'https://moonrepo.dev/schemas/project.json'
Project configuration can also be written in Pkl instead of YAML.
dependsOn
Explicitly defines other projects that this project depends on, primarily when generating the
project and task graphs. The most common use case for this is building those projects before
building this one. When defined, this setting requires an array of project names, which are the keys
found in the projects
map.
dependsOn:
- 'apiClients'
- 'designSystem'
A dependency object can also be defined, where a specific scope
can be assigned, which accepts
"production" (default), "development", "build", or "peer".
dependsOn:
- id: 'apiClients'
scope: 'production'
- id: 'designSystem'
scope: 'peer'
Learn more about implicit and explicit dependencies.
Metadata
id
v1.18.0
Overrides the name (identifier) of the project, which was configured in or derived from the
projects
setting in .moon/workspace.yml
. This setting is
useful when using glob based project location, and want to avoid using the folder name as the
project name.
id: 'custom-id'
All references to the project must use the new identifier, including project and task dependencies.
language
The primary programming language the project is written in. This setting is required for task inheritance, editor extensions, and more. Supports the following values:
bash
- A Bash based project (Unix only).batch
- A Batch/PowerShell based project (Windows only).go
- A Go based project.javascript
- A JavaScript based project.php
- A PHP based project.python
- A Python based project.ruby
- A Ruby based project.rust
- A Rust based project.typescript
- A TypeScript based project.unknown
(default) - When not configured or inferred.*
- A custom language. Values will be converted to kebab-case.
language: 'javascript'
# Custom
language: 'kotlin'
For convenience, when this setting is not defined, moon will attempt to detect the language based on configuration files found in the project root. This only applies to non-custom languages!
owners
v1.8.0
Defines ownership of source code within the current project, by mapping file system paths to owners. An owner is either a user, team, or group.
Currently supports GitHub, GitLab, and Bitbucket (via app).
customGroups
Bitbucket
When using the
Code Owners for Bitbucket
app, this setting provides a way to define custom groups that will be injected at the top of the
CODEOWNERS
file. These groups must be unique across all projects.
owners:
customGroups:
'@@@backend': ['@"user name"', '@@team']
defaultOwner
The default owner for all paths
. This setting is optional in some cases but helps to
avoid unnecessary repetition.
owners:
defaultOwner: '@frontend'
optional
GitLab
For GitLab, marks the project's
code owners section
as optional. Defaults to false
.
owners:
optional: true
paths
The primary setting for defining ownership of source code within the current project. This setting
supports 2 formats, the first being a list of file paths relative from the current project. This
format requires defaultOwner
to be defined, and only supports 1 owner for every
path (the default owner).
owners:
defaultOwner: '@frontend'
paths:
- '**/*.ts'
- '**/*.tsx'
- '*.config.js'
The second format provides far more granularity, allowing for multiple owners per path. This format
requires a map, where the key is a file path relative from the current project, and the value is a
list of owners. Paths with an empty list of owners will fallback to defaultOwner
.
owners:
defaultOwner: '@frontend'
paths:
'**/*.rs': ['@backend']
'**/*.js': []
'*.config.js': ['@frontend', '@frontend-infra']
The syntax for owners is dependent on the provider you are using for version control (GitHub, GitLab, Bitbucket). moon provides no validation or guarantees that these are correct.
requiredApprovals
Bitbucket / GitLab
Requires a specific number of approvals for a pull/merge request to be satisfied. Defaults to 1
.
- For Bitbucket, defines the
Check()
condition when using adefaultOwner
. - For GitLab, defines a requirement on the code owners section.
owners:
requiredApprovals: 2
project
The project
setting defines metadata about the project itself.
project:
name: 'moon'
description: 'A monorepo management tool.'
channel: '#moon'
owner: 'infra.platform'
maintainers: ['miles.johnson']
The information listed within project
is purely informational and primarily displayed within the
CLI. However, this setting exists for you, your team, and your company, as a means to identify and
organize all projects. Feel free to build your own tooling around these settings!
channel
The Slack, Discord, Teams, IRC, etc channel name (with leading #) in which to discuss the project.
description
Required
A description of what the project does and aims to achieve. Be as descriptive as possible, as this is the kind of information search engines would index on.
maintainers
A list of people/developers that maintain the project, review code changes, and can provide support. Can be a name, email, LDAP name, GitHub username, etc, the choice is yours.
metadata
v1.27.0
A map of custom metadata to associate to this project. Supports all value types that are valid JSON.
project:
# ...
metadata:
deprecated: true
name
A human readable name of the project. This is different from the unique project name configured in
projects
.
owner
The team or organization that owns the project. Can be a title, LDAP name, GitHub team, etc. We suggest not listing people/developers as the owner, use maintainers instead.
stack
v1.22.0
The technology stack this project belongs to, primarily for categorization. Supports the following values:
frontend
- Client-side user interfaces, etc.backend
- Server-side APIs, database layers, etc.infrastructure
- Cloud/server infrastructure, Docker, etc.systems
- Low-level systems programming.unknown
(default) - When not configured.
stack: 'frontend'
The project stack is also used in constraints and boundaries!
tags
Tags are a simple mechanism for categorizing projects. They can be used to group projects together for easier querying, enforcing of project boundaries and constraints, task inheritance, and more.
tags:
- 'react'
- 'prisma'
type
The type of project. Supports the following values:
application
- An application of any kind.automation
- An automated testing suite, like E2E, integration, or visual tests. v1.16.0configuration
- Configuration files or infrastructure. v1.22.0library
- A self-contained, shareable, and publishable set of code.scaffolding
- Templates or generators for scaffolding. v1.22.0tool
- An internal tool, one-off script, etc.unknown
(default) - When not configured.
type: 'application'
The project type is used in task inheritance, constraints and boundaries, editor extensions, and more!
Integrations
docker
v1.27.0
Configures Docker integration for the current project.
file
Configures the Dockerfile
generation process when moon docker file
is
executed.
buildTask
The name of a task within the current project that will be used for building the project before running it. If not defined, does nothing.
docker:
file:
buildTask: 'build'
image
The Docker image to use in the base stage. Defaults to an image based on the project's toolchain, as outlined below.
oven/bun:latest
for Bundenoland/deno:latest
for Denonode:latest
for Node.jspython:latest
for Pythonrust:latest
for Rustscratch
for everything else
docker:
file:
image: 'node:latest'
startTask
The name of a task within the current project that will run the project after it has been built (if
required). This task will be used as CMD
within the Dockerfile
.
docker:
file:
startTask: 'start'
scaffold
Configures aspects of the Docker scaffolding process when
moon docker scaffold
is executed. Only applies to the
sources skeleton.
include
List of globs in which to copy project-relative files into the .moon/docker/sources
skeleton. When
not defined, defaults to **/*
.
docker:
scaffold:
include:
- 'src/**/*'
Tasks
env
The env
field is map of strings that are passed as environment variables to all tasks within the
current project. Project-level variables will not override task-level variables of the same name.
env:
NODE_ENV: 'production'
View the task
env
setting for more usage examples and information.
fileGroups
Defines file groups to be used by local tasks. By default, this setting is not required for the following reasons:
- File groups are an optional feature, and are designed for advanced use cases.
- File groups defined in
.moon/tasks.yml
will be inherited by all projects.
When defined this setting requires a map, where the key is the file group name, and the value is a list of globs or file paths, or environment variables. Globs and paths are relative to a project (even when defined globally).
# Example groups
fileGroups:
configs:
- '*.config.{js,cjs,mjs}'
- '*.json'
sources:
- 'src/**/*'
- 'types/**/*'
tests:
- 'tests/**/*'
- '**/__tests__/**/*'
assets:
- 'assets/**/*'
- 'images/**/*'
- 'static/**/*'
- '**/*.{scss,css}'
Once your groups have been defined, you can reference them within args
,
inputs
, outputs
, and more, using
token functions and variables.
tasks:
build:
command: 'vite build'
inputs:
- '@group(configs)'
- '@group(sources)'