diff --git a/README.md b/README.md index 96867b996b..4aed6b80b0 100644 --- a/README.md +++ b/README.md @@ -1,42 +1,57 @@ # Not only Composer tools to build a Monorepo -[![Downloads total](https://img.shields.io/packagist/dt/symplify/monorepo-builder.svg?style=flat-square)](https://packagist.org/packages/symplify/monorepo-builder/stats) +[![Downloads total](https://img.shields.io/packagist/dt/symplify/monorepo-builder.svg?style=flat-square)](https://packagist.org/packages/symplify/monorepo-builder) -Do you maintain [a monorepo](https://tomasvotruba.com/blog/2019/10/28/all-you-always-wanted-to-know-about-monorepo-but-were-afraid-to-ask/) with more packages? +Do you maintain a monorepo with multiple packages? **This package has few useful tools, that will make that easier**. ## Install ```bash +# Latest version (PHP 8.2+) composer require symplify/monorepo-builder --dev + +# For PHP 8.1 (legacy version, no longer maintained) +composer require "symplify/monorepo-builder:^11.2" --dev ``` +**Requirements:** +- PHP 8.2 or higher (for version 12.x) + +**For older PHP versions:** +- Use version 11.x (no longer maintained) + ## Usage ### 1. Are you New to Monorepo? -The best to lean-in fast is to read basic intro at blog post [All You Always Wanted to Know About Monorepo](https://www.tomasvotruba.com/blog/2019/10/28/all-you-always-wanted-to-know-about-monorepo-but-were-afraid-to-ask/#what-is-monorepo). -We also made a simple command to make that easy for you: +If you're new to monorepos, you can start with a basic setup using our initialization command: ```bash vendor/bin/monorepo-builder init ``` -And the basic setup is done! +This creates a basic monorepo structure with the necessary configuration files. + ### 2. Merge local `composer.json` to the Root One Merges configured sections to the root `composer.json`, so you can only edit `composer.json` of particular packages and let script to synchronize it. -Sections that are needed for monorepo to work will be merged: +Sections that will be merged from packages to root: -- 'require' -- 'require-dev' -- 'autoload' -- 'autoload-dev' -- 'repositories' -- 'extra' +- `require` - Dependencies needed by packages +- `require-dev` - Development dependencies +- `autoload` - PSR-4 autoloading configuration +- `autoload-dev` - Development autoloading configuration +- `repositories` - Package repositories +- `extra` - Extra configuration data +- `provide` - Virtual packages provided +- `authors` - Package authors information +- `minimum-stability` - Minimum package stability +- `prefer-stable` - Prefer stable packages +- `replace` - Packages replaced by this one To merge run: @@ -46,10 +61,9 @@ vendor/bin/monorepo-builder merge
-Typical location for packages is `/packages`. But what if you have different naming or extra `/projects` directory? ```php -use Symplify\MonorepoBuilder\ComposerJsonManipulator\ValueObject\ComposerJsonSection; +use Symplify\ComposerJsonManipulator\ValueObject\ComposerJsonSection; use Symplify\MonorepoBuilder\Config\MBConfig; use Symplify\MonorepoBuilder\ValueObject\Option; @@ -75,7 +89,7 @@ return static function (MBConfig $mbConfig): void { ], ], ComposerJsonSection::REQUIRE_DEV => [ - 'phpstan/phpstan' => '^0.12', + 'phpstan/phpstan' => '^2.1', ], ]); @@ -143,9 +157,9 @@ return static function (MBConfig $mbConfig): void { ### 6. Split Directories to Git Repositories -Thanks to GitHub Actions, this was never simpler to set up. Use [symplify/github-action-monorepo-split](https://github.com/symplify/github-action-monorepo-split). +You can split packages from your monorepo into separate repositories using GitHub Actions. Use [symplify/github-action-monorepo-split](https://github.com/symplify/github-action-monorepo-split) for this purpose. -How to configure it? See our local setup at [.github/workflows/split_monorepo.yaml](https://github.com/danharrin/monorepo-split-github-action/blob/main/.github/workflows/split.yaml) +For configuration examples, you can refer to the [GitHub Action workflow documentation](https://github.com/danharrin/monorepo-split-github-action). ### 7. Release Flow @@ -216,3 +230,21 @@ vendor/bin/monorepo-builder release patch ``` You can use `minor` and `major` too. + +## Available Commands + +Here are all available commands you can use with monorepo-builder: + +- `init` - Creates empty monorepo directory and composer.json structure +- `merge` - Merge "composer.json" from all found packages to root one +- `bump-interdependency` - Bump dependency of split packages on each other +- `validate` - Validates synchronized versions in "composer.json" in all found packages +- `package-alias` - Updates branch alias in "composer.json" all found packages +- `propagate` - Propagate versions from root "composer.json" to all packages, the opposite of "merge" command +- `localize-composer-paths` - Set mutual package paths to local packages - use for pre-split package testing +- `release` - Perform release process with set Release Workers + +To see detailed help for any command, run: +```bash +vendor/bin/monorepo-builder --help +```