This directory contains a dummy package responsible for managing WooCommerce dependencies that require conflict avoidance.
The contents of the packages and classes directories get automatically generated by composer install and composer update.
This allows us to prefix namespaces and classmap classes to avoid conflicts with plugins that include the same package.
All namespaces are prefixed with Automattic\WooCommerce\Vendor and classmap classes prefixed with WC_Vendor_.
Do not make direct changes in the files contained in packages or classes! Any changes will be lost!
In order to avoid including the original dependencies in the root autoloader we must utilize require-dev for them.
Composer treats require dependencies as transitive while require-dev dependencies get ignored by consumers.
- Add package to
require-devsection ofcomposer.json - Add package slug to
extra/mozart/packagessection ofcomposer.json - Run
composer run-script build-libfrom the root directory (You should now see the package inpackages/VendorName/PackageNameorclasses)
Updating a package is as easy as changing the version in composer.json and then running composer run-script build-lib from the root directory.
If you would like to add a package which does not undergo conflict avoidance you must take steps to ensure it appears in the root autoloader.
- Add package to the
requiresection of both thelib/composer.jsonand rootcomposer.jsonfile instead ofrequire-dev - Add package slug to
extra/mozart/excluded-packagessection ofcomposer.json - Run
composer run-script build-libfrom the root directory (You should not see the package inpackages/VendorName/PackageNameorclasses)