Skip to content

alexander-schranz/mono

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Mono helps to manage your PHP Mono Repositories

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.