# mrbt

> Build tools for monorepos

Latest version **0.0.2** (published 2018-07-16) · MIT license · 0 weekly downloads

## Install

```sh
npm install mrbt
pnpm add mrbt
yarn add mrbt
bun add mrbt
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.2 |
| Published | 2018-07-16 |
| First published | 2017-11-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 6.9.0 |
| Dependencies | 3 |
| Unpacked size | 100 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Bogdan Prishedko |
| Maintainers | prishedko |

## Links

- npm: https://www.npmjs.com/package/mrbt
- Repository: https://github.com/prishedko/mrbt
- Homepage: https://github.com/prishedko/mrbt#readme
- Issues: https://github.com/prishedko/mrbt/issues
- npm.io page: https://npm.io/package/mrbt

## Dependencies (3)

- [chalk](https://npm.io/package/chalk.md) 2.3.0
- [tslib](https://npm.io/package/tslib.md) ~1.7.1
- [algorithms-ts](https://npm.io/package/algorithms-ts.md) 0.1.3

## Recent versions

- 0.0.2 (latest) — 2018-07-16
- 0.0.2-SNAPSHOT.2 — 2018-03-21
- 0.0.2-SNAPSHOT.1 — 2017-11-13
- 0.0.2-SNAPSHOT.0 — 2017-11-12
- 0.0.2-SNAPSHOT — 2017-11-10
- 0.0.1 — 2017-11-08
- 0.0.1-alpha.1 — 2017-11-08
- 0.0.1-alpha — 2017-11-08
- 0.0.0 — 2017-11-04

## README

# Introduction
This package is a set of tools that simplifies building of JavaScript monorepositories that are orginized by tools like
[Lerna](https://lernajs.io/) and [Yarn Workspaces](https://yarnpkg.com/blog/2017/08/02/introducing-workspaces/).
*mrbt* has two parts:
1. Monorepo build.
2. Utils.

## Monorepo build

JavaScript monorepositories usually contain several JavaScript packages that are placed in *package* folder and that
depends on each other. So when we want to build such monorepo, we need to build every its package in order that takes in
accout dependencies between packages. *Monorepo build* is a set of classes that:
1. Allows to describe how to build every package in monorepo
2. Executs building commands of packages in correct order

Description of build process answers the following questions:
1. Where are packages? By default packages are placed in *packages* folder, but it can be any other.
2. What is default build command(s)? Quite often build procedure are the same for most packages in a monorepo, for
example, it can include one or several commands that are the same for most repos like:
    ```bash
    yarn clean && yarn gulp && npm publish
    ```
    So to avoid repeating the same set of commands for every package, you define default command(s) that will be
    executed for every package without redefined command (see next item).
3. How to redefine the default build command? For some packages build procedure can be different, so we need to specify
that we don't want to use default command to build this particular package(s) and define what command(s) should be used
instead.

*Monorepo build* has two types of API: Fluent API that allows to describe build process by using builders, and
Description API that allows to describe build process by using description JavaScript object. The APIs functionally
identical. You can find more about APIs in [API documentation](https://prishedko.github.io/mrbt/).

## Utils

Utils contains helpers that are not part of *Monorepo build* and that can be used in any node application outside of
*Monorepo build* process.

Please find [API documentation on GitPages](https://prishedko.github.io/mrbt/)

## Passing command line arguments

Usually command line arguments are described for each executor separately. But also you can pass arguments that will be
passed in every executor of given type. For that you just need to add command line argument for build script, and this
argument shoud have the following format:
```bash
mrbt-[executor command]=[argument value]
```
MRBT will remove prefix and pass *argument value* part as argument in every executor with
*command === executor command part*.
For example, you have several executors that run *mvn* command and you want to
pass *-s /path/settings.xml* in every *mvn* command to enforce using custom settings. For that you can write:
```bash
node build.js mrbt-mvn=-s mrbt-mvn=/path/settings.xml
```
and MRBT will pass *-s* and */path/settings.xml* arguments in every executor that runs *mvn* command; it will be done
in addition to arguments that are described in executors configuration.
Also you can inject arguments with some prefix in partical executors. For example, you build package *package-a* by
using *gulp* and you want to provide list of gulp tasks by using command line arguments. To implement that you need
to define you executor in the following way:
```javascript 1.7
{
    package: 'package-a',
    executor: {
        type: 'gulp',
        args: [...mrbt.utils.args('package-a')]
    }
}
```
and then in command line pass all required tasks like this:
```bash
node build.js package-a=clean package-a=build package-a=deploy
```

---
_Source: https://npm.io/package/mrbt · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
