elgentos / magento2-composer-quality-patches
此包已被废弃且不再维护。未建议替代包。
最新版本(0.1.4)的此包没有可用的许可证信息。
将 Magento 的质量补丁转换为 JSON 格式,以便与 vaimo/composer-patches 一起使用
0.1.4
2022-05-13 11:20 UTC
Requires
- magento/magento-composer-installer: *
- magento/quality-patches: ^1.1.14
- vaimo/composer-patches: *
This package is auto-updated.
Last update: 2022-12-01 00:16:17 UTC
README
此扩展添加了一个命令:bin/magento elgentos:quality-patches:convert
它生成一个 composer.quality-patches.json 文件,用于与 vaimo/composer-patches 包一起使用。如果没有设置,它还会将该文件添加到 composer.json 中,并添加一个 post-update-cmd 钩子以自动更新补丁文件。
此依赖于 magento/quality-patches 和 vaimo/composer-patches。
某些补丁将给出“Hmm... 忽略尾部垃圾”警告,导致补丁失败。有两种处理方法;
- 将此添加到您的
composer.json中,以允许补丁失败而不停止修补
{
"extra": {
"patcher": {
"graceful": true
}
}
}
- 将此添加到您的 post-install-cmd 中以修复双空行并再次运行补丁程序
{
"scripts": {
"post-install-cmd": [
"# Remove double new lines from patches to make vaimo/composer-patches process them correctly",
"find vendor/magento/quality-patches -type f -name '*.patch' -exec sed --in-place -e :a -e '/^\\n*$/{$d;N;};/\\n$/ba' {} \\;",
"# Now run patch:apply again to apply the patches and use --no-scripts to avoid an infinite loop",
"composer2 patch:apply --no-scripts"
]
}
}
我们更喜欢第二种方法,因为当使用第一种方法时,其他由于其他原因失败的补丁不会停止我们的部署。
安装 & 使用
composer require elgentos/magento2-composer-quality-patches bin/magento s:up bin/magento elgentos:quality-patches:convert composer patch:apply
自动应用补丁的替代方法
composer require magento/quality-patches- 将其添加到您的
composer.json中;
{
"scripts": {
"post-install-cmd": [
"./vendor/bin/magento-patches status | grep 'Not applied' | cut -d ' ' -f2 | xargs --no-run-if-empty ./vendor/bin/magento-patches apply"
]
}
}