Skip to main content

.moon/workspace.yml

The .moon/workspace.yml file configures projects and services in the workspace. This file is required.

.moon/workspace.yml
$schema: 'https://moonrepo.dev/schemas/workspace.json'

extendsv0.4

Defines an external .moon/workspace.yml to extend and inherit settings from. Perfect for reusability and sharing configuration across repositories and projects. When defined, this setting must be an HTTPS URL or relative file system path that points to a valid YAML document!

.moon/workspace.yml
extends: 'https://raw.githubusercontent.com/organization/repository/master/.moon/workspace.yml'
caution

Settings will be merged recursively for blocks, with values defined in the local configuration taking precedence over those defined in the extended configuration. However, the projects setting does not merge!

projectsRequired

Defines the location of all projects within the workspace. Supports either a manual map of projects (default), a list of globs in which to automatically locate projects, or both.

Using a map

When using a map, each project must be manually configured and requires a unique name as the map key, where this name is used heavily on the command line and within the project graph for uniquely identifying the project amongst all projects. The map value (known as the project source) is a file system path to the project folder, relative from the workspace root, and must be contained within the workspace boundary.

.moon/workspace.yml
projects:
admin: 'apps/admin'
apiClients: 'packages/api-clients'
designSystem: 'packages/design-system'
web: 'apps/web'

Using globs

If manually mapping projects is too tedious or cumbersome, you may provide a list of globs to automatically locate all project folders, relative from the workspace root.

When using this approach, the project name is derived from the project folder name, and is cleaned to our supported characters . Furthermore, globbing does risk the chance of collision, and when that happens, we log a warning and skip the conflicting project from being configured in the project graph.

.moon/workspace.yml
projects:
- 'apps/*'
- 'packages/*'

Using a map and globsv0.18

For those situations where you want to use both patterns, you can! The list of globs can be defined under a globs field, while the map of projects under a sources field.

.moon/workspace.yml
projects:
globs:
- 'apps/*'
- 'packages/*'
sources:
www: 'www'

generatorv0.14

Configures aspects of the template generator.

templates

A list of file system paths where templates can be located, relative from the workspace root. Defaults to ./templates.

.moon/workspace.yml
generator:
templates:
- './templates'
- './other/templates'

hasherv0.13

Configures aspects of smart hashing layer.

optimization

Determines the optimization level to utilize when hashing content before running targets.

  • accuracy (default) - When hashing dependency versions, utilize the resolved value in the lockfile. This requires parsing the lockfile, which may reduce performance.
  • performance - When hashing dependency versions, utilize the value defined in the manifest. This is typically a version range or requirement.
.moon/workspace.yml
hasher:
optimization: 'performance'

notifierv0.17

Configures how moon notifies and interacts with a developer or an external system.

webhookUrl

Defines an HTTPS URL that all pipeline events will be posted to. View the webhooks guide for more information on available events.

.moon/workspace.yml
notifier:
webhookUrl: 'https://api.company.com/some/endpoint'

runnerv0.13

Configures aspects of the action pipeline.

cacheLifetimev0.11

The maximum lifetime of cached artifacts before they're marked as stale and automatically removed by the action pipeline. Defaults to "7 days". This field requires an integer and a timeframe unit that can be parsed as a duration.

.moon/workspace.yml
runner:
cacheLifetime: '24 hours'

archivableTargetsv0.20

Defines a list of targets, with or without a project scope, that will be cached and archived within the runner. Tasks that produce outputs are automatically archived, and do not need to be defined here. Defaults to an empty list.

.moon/workspace.yml
runner:
archivableTargets:
- ':test'
- 'app:typecheck'

This setting primarily exists for remote caching as it will create and persist tar archives located in .moon/cache/outputs.

inheritColorsForPipedTasksv0.3

Force colors to be inherited from the current terminal for all tasks that are ran as a child process and their output is piped to the action pipeline. Defaults to true. View more about color handling in moon.

.moon/workspace.yml
runner:
inheritColorsForPipedTasks: true

logRunningCommandv0.4

When enabled, will log the task's command, resolved arguments, and working directory when a target is ran. Defaults to false.

.moon/workspace.yml
runner:
logRunningCommand: true

vcs

Configures the version control system to utilize within the workspace (and repository). A VCS is required for determining touched (added, modified, etc) files, calculating file hashes, computing affected files, and much more.

defaultBranch

Defines the default branch in the repository for comparing differences against. For git, this is typically "master" (default) or "main". For svn, this should always be "trunk".

.moon/workspace.yml
vcs:
defaultBranch: 'master'

manager

Defines the VCS tool/binary that is being used for managing the repository. Accepts "git" (default) or "svn" (experimental, in development).

.moon/workspace.yml
vcs:
manager: 'git'

remoteCandidates v0.20

(Git only) Defines a list of remote candidates to query agaist to determine merge bases. Defaults to "origin" and "upstream".

.moon/workspace.yml
vcs:
remoteCandidates:
- 'origin'
- 'upstream'

versionConstraintv0.22

Defines a semantic version requirement for the currently running moon binary. This provides a mechanism for enforcing that the globally installed moon on every developers machine is using an applicable version.

.moon/workspace.yml
versionConstraint: '>=0.20.0'