Skip to content

desirable-objects/monorepo-tools

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

Monorepo Tools

Tools for building and maintaining a monorepo

Currently tested with https://lernajs.io/ and used to build the https://github.com/vudash/vudash-core monorepo.

Setup

Make sure you're using zsh. This tool relies on a lot of zsh's powerful functionality.

This tool will only ever run on Linux/Mac/Unix, or other POS*X environments. Not windows. Ain't nobody got time for 'dat!

Usage

./add_to_monorepo.sh

A tool for combining the git history of all the repositories that you want to become part of the monorepo.

To use it, pick an existing repository which will become your monorepo. We'll call this the parent.

If we were going to turn this into a https://lernajs.io/ monorepo, we'd do the following:

  1. Move all existing files from the parent into a subirectory of the parent called .tmp. This is to avoid conflicts from incoming modules.

Your monorepo should now look like this. Commit it!

$ tree -aL 1
.
├── .git
└── .tmp
  1. For each repo you want to add, run the ./add_to_monorepo.sh script:

./add_to_monorepo.sh <git-remote-url> <submodule-name>

Your repo will now look like:

$ tree -aL 2
.
├── .git
│    └── ...
└── .tmp
    ├── ...
    └── your-new-submodule
  1. Keep doing this until your project looks like a monorepo under .tmp
$ tree -aL 2
.
├── .git
│    └── ...
└── .tmp
    ├── module-a
    ├── module-b
    ├── module-c
    ├── module-d
    └── module-e
  1. You're done. Move all the files from .tmp into your root and commit it! Monorepo!
$ tree -aL 2
.
├── .git
│    └── ...
├── module-a
├── module-b
├── module-c
├── module-d
└── module-e

Releases

No releases published

Packages

No packages published

Languages