schranz/mono

A binary to run commands in a monorepo

2.2.0 2024-03-16 12:03 UTC

This package is auto-updated.

Last update: 2024-11-16 13:23:41 UTC


README

Managing a monorepository?

Mono helps you to initialize subtree split and run composer and other commands for all your package directories.

Installation

composer require schranz/mono --dev

Usage

Init Split Command

First create your mono repository and push it to Github.

Create your packages into different directories make sure for to create for all packages you want to split a composer.json with a name in it.

Then run:

vendor/bin/mono init-split

It will create the configuration for frankdejonge/use-subsplit-publish Github Action. Make sure to configure your PERSONAL_ACCESS_TOKEN as a secret in your Github repository. And configure the user in the newly created .github/workflows/publish-subsplits.yml file.

Run Command

To install the dependencies of all your mono repositories, just run:

vendor/bin/mono run composer install

To update them run:

vendor/bin/mono run composer update

To run a custom custom composer script use:

vendor/bin/mono run composer fix # runs in my case rector + php-cs-fixer

vendor/bin/mono run composer lint # runs in my case various linters (phpstan, php-cs, ...)

Mono is used and was build for managing schranz-search monorepository.

Upgrade dependency

If you have one dependency used in multiple packages and want to upgrade it in all packages you can use:

vendor/bin/mono upgrade-dependency phpstan/phpstan

Mono search for all packages which has then phpstan/phpstan in it and update it to the latest stable version.

Rename branch

If you want to rename a branch on all your packages in your mono repository you can use the following command:

PERSONAL_ACCESS_TOKEN=<token> vendor/bin/mono rename-branch 0.3 0.4

Mono search for all your packages and uses the Github API to rename a specific given branch to the new name.

You require at least a PERSONAL_ACCESS_TOKEN with contents:write or admins:write (default branch) scope.

Projects using mono

Let me know via an issue if you are using mono.