Skip to main content

Setup workspace

2 min

Once moon has been installed, we must setup the workspace, which is denoted by the .moon folder — this is known as the workspace root. The workspace is in charge of:

  • Integrating with a version control system.
  • Defining configuration that applies to its entire tree.
  • Housing projects to build a project graph.
  • Running tasks and the build system.

Initializing the repository

Let's scaffold and initialize moon in a repository with the moon init command. This should typically be ran at the root, but can be nested within a directory.

$ moon init

When executed, the following operations will be applied.

  • Creates a .moon folder with associated .moon/workspace.yml, .moon/toolchain.yml, and .moon/tasks.yml configuration files.
  • Appends necessary ignore patterns to the relative .gitignore.
  • Infers languages and dependency managers to register in the toolchain.
  • Infers the version control system from the environment.
info

If you're investigating moon, or merely want to prototype, you can use moon init --minimal to quickly initialize and create minimal configuration files.

Configuring a version control system

moon requires a version control system (VCS) to be present for functionality like file diffing, hashing, and revision comparison. The VCS and its default branch can be configured through the vcs setting.

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

moon defaults to git and the settings above, so feel free to skip this.

Next steps