morula

command module
v0.0.0-...-e10d4e8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 2, 2019 License: ISC Imports: 1 Imported by: 0

README

Morula logo

Build Status Build status Go Report Card

Monorepos are Git repositories that contain multiple code bases, typically for subprojects of the project in the repo. Morula runs shell commands for all those subprojects within a monorepo. Optionally only for the ones that contain changes. This makes running administrative tasks, for example tests or linters, on code bases in monorepos easy, reliable, and fast.

Installation

Download the appropriate binary for your platform from the release page and save it somewhere in your PATH.

Commands

Repo structure

Your monorepository should contain the subprojects in top-level folders.

How to make a task do different things in each subproject

Let's say your monorepo contains 2 projects, and you want to use Morula to set all of them up with one command by running morula all setup. However, the different subprojects in your monorepo require different commands to set them up. For example, one project could be Node.JS code base and you need to run npm install to set it up, the other could be written in Ruby and you need to run bundle install to set it up.

A good way to manage this situation is to create helper scripts in each subproject, which contain the commands to set up their respective subproject. In this case, you create a helper script called setup in each subproject. These can be executable Bash scripts for Mac/Linux and CMD files for Windows. Your directory structure looks something like this:

my_monorepo/
  │
  ├─ project_A/
  │  │
  │  ├─ setup      (contains commands to set up project A on Linux)
  │  ├─ setup.cmd  (contains commands to set up project A on Windows)
  │  └─ (code for project A)
  │
  └─ project_B/
     │
     ├─ setup      (contains commands to set up project B on Linux
     ├─ setup.cmd  (contains commands to set up project B on Windows)
     └─ (code for project B)

Another advantage of this setup is that when working within one subproject, you can simply run setup to set it up, and don't have to remember the project-specific commands any longer.

Configuration

You can fine-tune the behavior of Morula via command-line parameters or a configuration file named morula.* in YAML, JSON, TOML, HCL, or Java properties format. The configuration options are:

name description default more info
always always runs the given subproject, even if it has no changes "" spec
never never runs the given subproject, even if it has changes "" spec
after-all runs the given subproject after all others "" spec
before-all runs the given subproject before all others "" spec
color whether print output in color true spec

Directories starting with a dot (e.g. .git) are automatically ignored. To create an example configuration file with the default options, run morula setup.

More info

Lerna

  • only works if all subprojects are NPM packages
  • enforces an unnecessarily nested directory structure

Contributing

Please see our developer documentation

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL