Skip to content
/ CIGO Public

A Lightweight monorepo management tool built with go

Notifications You must be signed in to change notification settings

Usman-A/CIGO

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CIGO

A compiled CLI tool to help manage a monorepo and automate CI/CD operations.

Coverage Pipeline

Directories

The documentation is stored under docs/, no PDFs, and the program code is under src.

Key Features

  1. Run project targets
  2. Manage project dependencies
  3. Manage target execution dependencies
  4. Detect updated projects
  5. Search projects
  6. List registered projects
  7. Cache target execution output
  8. Generate json schema for the JSON files
  9. A wizard to add a project to the workspace

How To Use

The tool made here is a command line tool targeted at Unix Machines. It is written in Go, so you need to have Go installed on your machine to run the program, You can download it from here. We are using golang version 1.19.5.

The program can be compiled by first navigating to where the source code is located, /src/ and using the command go build, which should produce a cigo binary.

You can call ./cigo -h to get the help output.

./cigo -h should output the following:

Usage:
  cigo [OPTIONS] <command>

Application Options:
  -d, --dry      Print commands to run in order without running
                 anything.
  -V, --version  Print version

Help Options:
  -h, --help     Show this help message

Available commands:
  add-project
  create-schema
  get-changed
  list
  run
  search

Feel free to add the program to your path.

⚠️ Warning: This program is targeted to Unix machines. Windows is not supported. If you are using Windows, you can use WSL to run the program.

Sample Usage

This repo is already setup with the files that we need to run the program. In the root directory, we have our workspace.json file which contains information about our workspace. We also have sample projects in the /apps directory, each setup with their own project.json files.

Compiling the program:

First navigate to wherever the source code is located.

cd /src/

Use the command go build to generate the cigo binary. A new file should appear in your current directory.

go build

You can then use the compiled tool to manage your monorepo.

Creating schemas to test your workspace and project files against:

Let's create JSON schema's that help us validate our workspace and project files. To create these schemas we call the create-schema command, passing it the type of schema we want to create (workspace' or project').

./cigo create-schema workspace

Searching for specific information in the projects of the workspace:

You can search all the projects with key:value pairs by using the following command:

./cigo search mainLanguage:cpp

Listing all the projects in the workspace:

We have a list command that lists all the projects in the workspace:

./cigo list

Getting changes in the workspace:

This command will get all the projects that have been changed since the last commit. You can specify the branch or commit hash and the head commit to compare. If you don't specify -h , it will use the current HEAD commit.

./cigo get-changed -b main -h HEAD

Running a projects Target:

To run a target, you need to specify the project name and the target name. The target is what will be run, as it contains the commands that will be executed.

To specify a project, you need to use the flag -p or --project and to specify a target, you need to use the flag -t or --target.

./cigo run -p proj_a -t build

The command above would run the build target in the proj_a project.

Adding a project to the workspace:

To add a project to the workspace, you can use the add-project command. It will prompt you with questions regarding the project you want to add, and then will update the workspace and create the project.json file for you.

./cigo add-project

Extra Information:

If you need more information about the commands, you can use the help flag ./cigo -h

If you need more information about a specific command, you can use the help flag with the command name, for example to get help about the run command, you can use the following command:

./cigo run -h

Credits

Contributors

Related

There are other products that have the same purpose, but we couldn't find one that does exactly what we wanted to do. The relevant projects are:

  1. https://nx.dev/
  2. https://bazel.build/
  3. https://rushjs.io/

About

A Lightweight monorepo management tool built with go

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published