symplify / monorepo-builder-prefixed
Prefixed scoped version of "symplify/monorepo-builder" package
Requires
- php: >=7.3
Replaces
- symplify/monorepo-builder: 9.0.19
- dev-master
- 9.0.19
- 9.0.18
- 9.0.17
- 9.0.16
- 9.0.15
- 9.0.14
- 9.0.13
- 9.0.12
- 9.0.11
- 9.0.10
- 9.0.9
- 9.0.8
- 9.0.7
- 9.0.6
- 9.0.5
- 9.0.4
- 9.0.3
- 9.0.2
- 9.0.1
- 9.0.0
- 9.0.0-rc1
- 9.0.0-BETA9
- 9.0.0-BETA8
- 9.0.0-BETA7
- 9.0.0-BETA6
- 9.0.0-BETA5
- 9.0.0-BETA4
- 9.0.0-BETA3
- 9.0.0-BETA2
- 9.0.0-BETA1
- 8.3.48
- 8.3.47
- 8.3.46
- 8.3.45
- 8.3.44
- 8.3.43
- 8.3.42
- 8.3.41
- 8.3.40
- 8.3.39
- 8.3.38
- 8.3.37
- 8.3.36
- 8.3.35
- 8.3.34
- 8.3.33
- 8.3.32
- 8.3.31
- 8.3.30
- 8.3.29
- 8.3.28
- 8.3.27
- 8.3.26
- 8.3.25
- 8.3.24
- 8.3.23
- 8.3.22
- 8.3.21
- 8.3.20
- 8.3.19
- 8.3.18
- 8.3.17
- 8.3.16
- 8.3.15
- 8.3.14
- 8.3.13
- 8.3.12
- 8.3.11
- 8.3.10
- 8.3.9
- 8.3.8
- 8.3.7
- 8.3.6
- 8.3.5
- 8.3.4
- 8.3.3
- 8.3.2
- 8.3.1
- 8.3.0
- 8.2.27
- 8.2.26
- 8.2.25
- 8.2.24
- 8.2.23
- 8.2.22
- 8.2.21
- 8.2.20
- 8.2.19
- 8.2.18
- 8.2.17
- v8.2.16
- v8.2.15
- v8.2.14
- v8.2.13
- v8.2.12
- v8.2.11
- v8.2.10
- v8.2.9
- v8.2.8
- v8.2.7
- v8.2.6
- v8.2.5
- v8.2.4
- v8.2.3
- v8.2.2
- v8.2.1
- v8.2.0
- v8.1.21
- v8.1.20
- v8.1.19
- v8.1.18
- v8.1.17
- v8.1.16
- v8.1.15
- v8.1.14
- v8.1.13
- v8.1.12
- v8.1.11
- v8.1.10
- v8.1.9
- v8.1.8
- v8.1.7
- v8.1.6
- v8.1.5
- v8.1.4
- v8.1.3
- v8.1.2
- v8.1.1
- v8.1.0
- v8.0.1
This package is auto-updated.
Last update: 2021-02-08 15:41:49 UTC
README
Do you maintain a monorepo with more packages?
This package has few useful tools, that will make that easier.
Install
composer require symplify/monorepo-builder --dev
Usage
0. 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. We also made a simple command to make that easy for you:
vendor/bin/monorepo-builder init
And the basic setup is done!
1. 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:
- 'require'
- 'require-dev'
- 'autoload'
- 'autoload-dev'
- 'repositories'
- 'extra'
To merge run:
vendor/bin/monorepo-builder merge
Typical location for packages is /packages
. But what if you have different naming or extra /projects
directory?
// File: monorepo-builder.php use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; use Symplify\MonorepoBuilder\ValueObject\Option; return static function (ContainerConfigurator $containerConfigurator): void { $parameters = $containerConfigurator->parameters(); // where are the packages located? $parameters->set(Option::PACKAGE_DIRECTORIES, [ // default vaulue __DIR__ . '/packages', // custom __DIR__ . '/projects', ]); // how skip packages in loaded direectories? $parameters->set(Option::PACKAGE_DIRECTORIES_EXCLUDES, [__DIR__ . '/packages/secret-package']); // "merge" command related // what extra parts to add after merge? $parameters->set(Option::DATA_TO_APPEND, [ 'autoload-dev' => [ 'psr-4' => [ 'Symplify\Tests\\' => 'tests', ], ], 'require-dev' => [ 'phpstan/phpstan' => '^0.12', ], ]); $parameters->set(Option::DATA_TO_REMOVE, [ 'require' => [ // the line is removed by key, so version is irrelevant, thus * 'phpunit/phpunit' => '*', ], ]); };
2. Bump Package Inter-dependencies
Let's say you release symplify/symplify
4.0 and you need package to depend on version ^4.0
for each other:
vendor/bin/monorepo-builder bump-interdependency "^4.0"
3. Keep Synchronized Package Version
In synchronized monorepo, it's common to use same package version to prevent bugs and WTFs. So if one of your package uses symfony/console
3.4 and the other symfony/console
4.1, this will tell you:
vendor/bin/monorepo-builder validate
4. Keep Package Alias Up-To-Date
You can see this even if there is already version 3.0 out:
{ "extra": { "branch-alias": { "dev-master": "2.0-dev" } } }
Not good. Get rid of this manual work and add this command to your release workflow:
vendor/bin/monorepo-builder package-alias
This will add alias 3.1-dev
to composer.json
in each package.
If you prefer 3.1.x-dev
over default 3.1-dev
, you can configure it:
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; use Symplify\MonorepoBuilder\ValueObject\Option; return static function (ContainerConfigurator $containerConfigurator): void { $parameters = $containerConfigurator->parameters(); // default: "<major>.<minor>-dev" $parameters->set(Option::PACKAGE_ALIAS_FORMAT, '<major>.<minor>.x-dev'); };
5. Split Directories to Git Repositories
Thanks to GitHub Actions, this was never simpler to set up. Use symplify/github-action-monorepo-split.
How to configure it? See our local setup at .github/workflows/split_monorepo.yaml
6. Release Flow
When a new version of your package is released, you have to do many manual steps:
- bump mutual dependencies,
- tag this version,
git push
with tag,- change
CHANGELOG.md
title Unreleated tov<version> - Y-m-d
format - bump alias and mutual dependency to next version alias
But what if you forget one or do it in wrong order? Everything will crash!
The release
command will make you safe:
vendor/bin/monorepo-builder release v7.0
And add the following release workers to your monorepo-builder.php
:
// File: monorepo-builder.php use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; use Symplify\MonorepoBuilder\Release\ReleaseWorker\AddTagToChangelogReleaseWorker; use Symplify\MonorepoBuilder\Release\ReleaseWorker\PushNextDevReleaseWorker; use Symplify\MonorepoBuilder\Release\ReleaseWorker\PushTagReleaseWorker; use Symplify\MonorepoBuilder\Release\ReleaseWorker\SetCurrentMutualDependenciesReleaseWorker; use Symplify\MonorepoBuilder\Release\ReleaseWorker\SetNextMutualDependenciesReleaseWorker; use Symplify\MonorepoBuilder\Release\ReleaseWorker\TagVersionReleaseWorker; use Symplify\MonorepoBuilder\Release\ReleaseWorker\UpdateBranchAliasReleaseWorker; use Symplify\MonorepoBuilder\Release\ReleaseWorker\UpdateReplaceReleaseWorker; return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); # release workers - in order to execute $services->set(UpdateReplaceReleaseWorker::class); $services->set(SetCurrentMutualDependenciesReleaseWorker::class); $services->set(AddTagToChangelogReleaseWorker::class); $services->set(TagVersionReleaseWorker::class); $services->set(PushTagReleaseWorker::class); $services->set(SetNextMutualDependenciesReleaseWorker::class); $services->set(UpdateBranchAliasReleaseWorker::class); $services->set(PushNextDevReleaseWorker::class); };
Are you afraid to tag and push? Use --dry-run
to see only descriptions:
vendor/bin/monorepo-builder release v7.0 --dry-run
Do you want ot release next patch version, e.g. current v0.7.1
→ next v0.7.2
?
vendor/bin/monorepo-builder release patch
You can use minor
and major
too.
7. Set Your Own Release Flow
There is set of few default release workers - classes that implement Symplify\MonorepoBuilder\Release\Contract\ReleaseWorker\ReleaseWorkerInterface
.
You need to register them as services. Feel free to start with default ones:
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); // release workers - in order to execute $services->set(Symplify\MonorepoBuilder\Release\ReleaseWorker\SetCurrentMutualDependenciesReleaseWorker::class); $services->set(Symplify\MonorepoBuilder\Release\ReleaseWorker\AddTagToChangelogReleaseWorker::class); // you can extend with your own $services->set(App\SendPigeonToTwitterReleaseWorker::class); $services->set(Symplify\MonorepoBuilder\Release\ReleaseWorker\TagVersionReleaseWorker::class); $services->set(Symplify\MonorepoBuilder\Release\ReleaseWorker\PushTagReleaseWorker::class); $services->set(Symplify\MonorepoBuilder\Release\ReleaseWorker\SetNextMutualDependenciesReleaseWorker::class); $services->set(Symplify\MonorepoBuilder\Release\ReleaseWorker\UpdateBranchAliasReleaseWorker::class); $services->set(Symplify\MonorepoBuilder\Release\ReleaseWorker\PushNextDevReleaseWorker::class); };
Report Issues
In case you are experiencing a bug or want to request a new feature head over to the Symplify monorepo issue tracker
Contribute
The sources of this package are contained in the Symplify monorepo. We welcome contributions for this package on symplify/symplify.