cnastasi / monorepo-plugin
v0.6.2
2022-10-21 07:28 UTC
Requires
- composer-plugin-api: ^2.0
Requires (Dev)
- composer/composer: ^2.0
README
一个用于简化PHP单仓库(monorepo)方法的插件,自动为您引入本地仓库
用法
在根项目中使用
composer require cnastasi/monorepo-plugin
在子模块中使用
composer require cnastasi/monorepo-plugin --dev
在 composer.json
中添加以下内容
"extra": {
"monorepo_paths": [
"relative/path/where/the/modules/are/located",
"another/relative/path/where/the/modules/are/located",
]
}
或者,为了向后兼容,可以这样做
"extra": {
"monorepo_path": "relative/path/where/the/modules/are/located"
}
两种方式都是可行的,但并不推荐使用第二种
说明
当你在PHP的单仓库中工作时,如果你的代码被拆分成了许多通过composer要求的包,那么你拥有的包越多,你的复杂度就越高。
实际上,对于每一个包,你都需要明确添加一个路径仓库,无论是直接依赖还是间接依赖。
为了帮助解决这个问题,这个插件会为您添加所有依赖的路径仓库,扫描特定文件夹内的所有目录。
按照惯例,期望的文件夹结构如下
+ root
|
+- module1
| +- composer.json
| +- ...
+- module2
+- composer.json
+- ...
NOTE: This is still a beta, use it at your own risk