contao / monorepo-tools
Contao 单一仓库工具
0.2.0
2024-03-27 21:32 UTC
Requires
- php: ^8.1
- ext-json: *
- ext-zlib: *
- composer/semver: ^3.2
- phpspec/php-diff: ^1.0
- symfony/config: ^5.4 || ^6.4 || ^7.0
- symfony/console: ^5.4 || ^6.4 || ^7.0
- symfony/filesystem: ^5.4 || ^6.4 || ^7.0
- symfony/process: ^5.4 || ^6.4 || ^7.0
- symfony/yaml: ^5.4 || ^6.4 || ^7.0
Requires (Dev)
- ausi/remote-git: ^0.2.5
- contao/code-quality: ^1.0
- phpstan/phpstan: ^1.0
- phpstan/phpstan-symfony: ^1.0
- phpunit/phpunit: ^9.5
Conflicts
- composer/semver: 3.2.8
This package is auto-updated.
Last update: 2024-09-13 16:11:02 UTC
README
本项目提供用于与单一仓库一起工作的工具。主要用途是将PHP项目的单一仓库持续分割成多个只读分割,以适应每次提交、分支和标签。它还提供了一个命令,可以将分割的composer.json文件合并成一个根目录下的单个composer.json文件,以便将单一仓库本身作为单一包的替代品安装。
还有一个合并器可用,可以将多个项目合并到一个单一仓库中,作为一次性的过程,但它仍然处于实验阶段,应谨慎使用。
安装
composer require --dev contao/monorepo-tools
使用
工具在实际中的使用可以在Contao项目的monorepo.yml和.github/workflows/ci.yml文件中看到。
分割命令
vendor/bin/monorepo-tools split [--force-push] [<branch-or-tag>]
根据在monorepo.yml文件中配置的子文件夹分割单一仓库,并将结果推送到配置的远程服务器。
Composer-json命令
vendor/bin/monorepo-tools composer-json [--validate]
更新(或验证)根composer.json文件,包括所有分割的设置。自动加载配置被重写以包含正确路径的正确子文件夹。要求版本约束和冲突通过交集和并集进行合并。
合并命令
将多个仓库合并到一个单一仓库中。这是一个一次性过程,可能需要一些微调。使用它的最大好处是它是可逆的,这意味着在将单一仓库再次分割后,过去分割的提交历史保持不变。
如果您考虑将其用于您的项目,请随时联系我(@ausi
)在Contao Slack工作空间。
配置
配置存储在您的单一仓库项目的根目录下的monorepo.yml文件中。
# URL or absolute path to the remote GIT repository of the monorepo monorepo_url: https://github.com/YOUR-VENDORNAME/YOUR-PROJECT.git # All branches that match this regular expression will be split by default branch_filter: /^(main|develop|\d+\.\d+)$/ # List of all split projects repositories: # The first split project living in the folder /first-subfolder first-subfolder: # URL or absolute path to the remote GIT repository url: https://github.com/YOUR-VENDORNAME/YOUR-FIRST-SPLIT-PROJECT.git # Second split project living in the folder /second-subfolder second-subfolder: # URL or absolute path to the remote GIT repository url: https://github.com/YOUR-VENDORNAME/YOUR-SECOND-SPLIT-PROJECT.git # Optional mapping of commit hashes between the monorepo and split repo # This is only relevant to projects that got merged from existing split repos in the past mapping: # <commit-hash-in-the-monorepo>: <commit-hash-in-the-split> 86f7e437faa5a7fce15d1ddcb9eaeaea377667b8: e9d71f5ee7c92d6dc9e92ffdad17b8bd49418f98 # Optional additional composer settings for the root composer.json composer: require-dev: contao/monorepo-tools: ^1.0 require: vendor/package: ^1.2.3 conflict: vendor/package: ^1.2.3