gilbertsoft / typo3-core-patches
Easily manage TYPO3 Core patches with Composer.
Fund package maintenance!
gilbertsoft
www.paypal.me/SGilli
Installs: 31 572
Dependents: 0
Suggesters: 0
Security: 0
Stars: 12
Watchers: 1
Forks: 5
Open Issues: 0
Type:composer-plugin
Requires
- php: ^7.4.1 || ^8.0
- composer-plugin-api: ^2.0
- ext-json: *
- cweagans/composer-patches: ^1.7
Requires (Dev)
- bamarni/composer-bin-plugin: ^1.8.2
- composer/composer: ^2.0.9
- ergebnis/composer-normalize: >=2.28.3
README
This package let you easily manage TYPO3 Core patches with Composer based on cweagans/composer-patches which is a dependency of this package and requires to be installed as non-dev dependency for production usage.
Table of contents:
Installation
This package requires Composer 2.0 or higher.
Require this package as normal dependency:
composer require gilbertsoft/typo3-core-patches
If the package is installed as dev requirement, the patches won't get applied
using the install option --no-dev
as long as you don't require
cweagans/composer-patches
as normal dependency.
For Composer 2.2 and later, plug-ins must be explicitly allowed using the following command:
composer config --no-plugins allow-plugins.gilbertsoft/typo3-core-patches true composer config --no-plugins allow-plugins.gilbertsoft/cweagans/composer-patches true
Prerelease
To install a prerelease, run the following command using one of the stability
flags dev
, alpha
, beta
or RC
:
composer require gilbertsoft/typo3-core-patches:@<stability>
E.g. this would allow Composer to install beta, RC and stable releases:
composer require gilbertsoft/typo3-core-patches:@beta
Usage
Adding a change
Lookup the change ID at https://forge.typo3.org or https://review.typo3.org and provide it as argument or multiple arguments for multiple changes at once:
composer typo3:patch:apply 12345 composer typo3:patch:apply 12345 23456 34567
This plugin will then properly create patch files for the change and save it to
the patch directory which defaults to patches
. The patch directory can be
changed by the option --patch-dir
or with the shortcut -p
:
composer typo3:patch:apply --patch-dir:path/to/folder 12345 composer typo3:patch:apply -ppath/to/folder 12345
By default changes in tests are exluded. If you also like to include these
changes, provide the option --tests
or the shortcut -t
. This will result in
installing the sources instead of the dist packages for the affected packages.
composer typo3:patch:apply --tests 12345 composer typo3:patch:apply -t 12345
Updating a change
To update the applied patches to the last patch sets from Gerrit just run the following command, which will update all patches:
composer typo3:patch:update
It is also possible to just update some single patches by providing the change ID as argument or multiple arguments for multiple changes to update at once:
composer typo3:patch:update 12345 composer typo3:patch:update 12345 23456 34567
Removing a change
Provide the change ID to remove as argument or multiple arguments for multiple changes to remove at once:
composer typo3:patch:remove 12345 composer typo3:patch:remove 12345 23456 34567
Supported change ID formats
This plugin supports various change-id formats, as described in https://review.typo3.org/Documentation/rest-api-changes.html#change-id.
Additionally, you can also specify the full URL for the change, as shown in the next example:
composer typo3:patch:apply https://review.typo3.org/c/Packages/TYPO3.CMS/+/12345
Configuration
Branch verification
The plugin compares the current installed core version with the target branch of the patch to install and if different, asks for confirmation to anyway try to apply the patch to the different version.
To disabled the branch check for this project, run:
composer config extra.gilbertsoft/typo3-core-patches.ignore-branch true
Outdated patch detection
When running composer update
or composer install
, the plugin detects changes
that already exist in the version being installed and suggests removing the
related patches. If you run Composer with the --no-interaction
option, the
patches are always preserved. This can be changed by the config
force-tidy-patches
see bellow.
Errors may occur if you use the source-dist of packages, which can be solved by
adding the config.discard-changes
configuration option to your composer.json
,
see https://getcomposer.org/doc/06-config.md#discard-changes. Run e.g.
composer config discard-changes true
to add the configuration to your
composer.json
.
If a CI environment is detected, the detection of merged changes is skipped by default. To change this behavior and enable the detection again, run:
composer config extra.gilbertsoft/typo3-core-patches.force-tidy-patches true
To disable the detection of merged changes completely, run:
composer config extra.gilbertsoft/typo3-core-patches.disable-tidy-patches true
CI detection
The plugin tries to detect CI environments and changes its default behavior while running in a CI pipeline. It's possible to override the detection by setting an environment variable:
- Set
GS_CI=1
to force CI mode - Set
GS_CI=0
to disable CI mode
Feedback / Bug reports / Contribution
Bug reports, feature requests, pull requests, and any other kind of feedback are welcome in the GitHub repository.
For support questions or other discussions please use the GitHub Discussions or join the dedicated TYPO3 Slack channel.
License
This package is licensed under the MIT License.