legolasbo / composer-patches-plugin
Composer补丁插件
1.2.1
2016-01-06 11:59 UTC
Requires
- composer-plugin-api: ^1.0
Requires (Dev)
- composer/composer: 1.*
This package is not auto-updated.
Last update: 2024-09-23 13:26:00 UTC
README
此插件允许您为任何包提供补丁,无论它来自哪个包。
如果您不希望在根包之外创建补丁包,可以考虑将其作为repositories键中的一个包提供
{ "name": "vendor/package", "type": "project", "repositories": [ { "type": "package", "package": { "type": "metapackage", "name": "vendor/package-patches", "version": "1.0.0", "require": { "netresearch/composer-patches-plugin": "~1.0" }, "extra": { "patches": { "vendor/name": [ { "url": "https://my-domain.com/path/to/my.patch" } ] } } } } ], "require": { "vendor/package-patches": "~1.0" } }
有关此插件原始想法的演示,请参阅以下链接: http://de.slideshare.net/christianopitz/distributed-patching-with-composer
补丁属性
您可以为每个包提供补丁,并且可以选择性地通过版本约束提供补丁
仅通过包提供补丁
{ "name": "netresearch/typo3-patches", "version": "1.0.0", "type": "metapackage", "require": { "netresearch/composer-patches-plugin": "~1.0" }, "extra": { "patches": { "typo3/cms": [ { "title": "[FEATURE] Allow registration of different login forms", "url": "https://git.typo3.org/Packages/TYPO3.CMS.git/patch/32f331fead9c7aa50d9248c54e3c0af75d793539" }, { "title": "[PATCH] [BUGFIX] Flexform \"required\" on input fields applies to last field only", "url": "https://git.typo3.org/Packages/TYPO3.CMS.git/patch/a48f8b0dae11ce7246eff43132d986bccf55b786" } ] } } }
通过包和版本或版本约束提供补丁
composer.json
{ "name": "netresearch/typo3-patches", "version": "1.0.0", "type": "metapackage", "require": { "netresearch/composer-patches-plugin": "~1.0" }, "extra": { "patches": { "typo3/cms": { "6.2.0-beta1": [ { "title": "[FEATURE] Allow registration of different login forms", "url": "https://git.typo3.org/Packages/TYPO3.CMS.git/patch/32f331fead9c7aa50d9248c54e3c0af75d793539" }, { "title": "[PATCH] [BUGFIX] Flexform \"required\" on input fields applies to last field only", "url": "https://git.typo3.org/Packages/TYPO3.CMS.git/patch/a48f8b0dae11ce7246eff43132d986bccf55b786" } ], "6.2.0-beta2": [ { "title": "[PATCH] [BUGFIX] Flexform \"required\" on input fields applies to last field only", "url": "https://git.typo3.org/Packages/TYPO3.CMS.git/patch/a48f8b0dae11ce7246eff43132d986bccf55b786" } ], "6.2.*": [ { "title": "[BUGFIX] Ignore dependencies on non typo3-cms-extension", "url": "https://git.typo3.org/Packages/TYPO3.CMS.git/patch/9fe856ac96e6a53fef8277f36a4a80bace6f0ae9", "sha1": "b56a1c47a67d1596c0bd8270e61c44f8911af425" } ] } } } }
注意: 当多个版本约束匹配目标包的版本时,所有匹配的补丁都将被应用(通过它们的校验和进行规范化,因此不应该出现重复)。
通过URL或路径提供补丁
您可以将补丁对象的任何部分放入另一个JSON文件中,并通过URL(或路径)加载它
composer.json
{ "name": "netresearch/typo3-patches", "version": "1.0.0", "type": "metapackage", "require": { "netresearch/composer-patches-plugin": "~1.0" }, "extra": { "patches": { "typo3/cms": "http://example.com/typo3-patches.json" } } }
http://example.com/typo3-patches.json
{ "6.2.0-beta1": [ { "title": "[FEATURE] Allow registration of different login forms", "url": "https://git.typo3.org/Packages/TYPO3.CMS.git/patch/32f331fead9c7aa50d9248c54e3c0af75d793539" }, { "title": "[PATCH] [BUGFIX] Flexform \"required\" on input fields applies to last field only", "url": "https://git.typo3.org/Packages/TYPO3.CMS.git/patch/a48f8b0dae11ce7246eff43132d986bccf55b786" } ], "6.2.0-beta2": [ { "title": "[PATCH] [BUGFIX] Flexform \"required\" on input fields applies to last field only", "url": "https://git.typo3.org/Packages/TYPO3.CMS.git/patch/a48f8b0dae11ce7246eff43132d986bccf55b786" } ], "6.2.*": [ { "title": "[BUGFIX] Ignore dependencies on non typo3-cms-extension", "url": "https://git.typo3.org/Packages/TYPO3.CMS.git/patch/9fe856ac96e6a53fef8277f36a4a80bace6f0ae9", "sha1": "b56a1c47a67d1596c0bd8270e61c44f8911af425" } ] }
要求补丁
只需要求带有补丁的包。
{ "name": "netresearch/patched-typo3", "type": "project", "description": "A patched version of typo3", "minimum-stability": "dev", "require": { "netresearch/typo3-patches": "~1.0", "typo3/cms": "6.2.0-beta3" } }