Last active
July 22, 2022 15:36
-
-
Save dfelton/862e71abf8159f45e667f8e035080c30 to your computer and use it in GitHub Desktop.
High level steps for developing Magento packages locally outside of vendor, while having those changes reflected in vendor.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This assumes that you have your Magento project and its dependent composer packages in separate repositories. | |
# | |
# While developing directly inside the vendor/VENDOR_NAME/PACKAGE_NAME/ of Magento is possible, this practice | |
# can potentially lead to mistakes being made and work lost, as the vendor/ diretory should be treated | |
# as volatile and able to be deleted at any time. | |
# Values below in capital letters are the variable aspects of these instructions. | |
# navigate to your package root and create a new branch for your development purposes | |
cd /PATH/TO/COMPOSER_PACKAGE/ | |
git switch -c feature/FOO_BAR | |
# navigate to your project root and configure composer for development on your package | |
cd /PATH/TO/PROJECT_ROOT/ | |
composer config minimum-stability dev | |
composer config repositories.WORK_IN_PROGRESS_PACKAGE path /PATH/TO/COMPOSER_PACKAGE/ | |
composer require VENDOR_NAME/PACKAGE_NAME:dev-feature/FOO_BAR | |
# your package will now be installed into the vendor/ directory as a symlink. | |
# you can develop from the root of your package, and changes are immediately reflected | |
# within the project. | |
# in the event that the "compose require" statement above fails due to version constraints | |
# on it from other packages dependent on it, then use an inline alias in your require command | |
# | |
# https://getcomposer.org/doc/articles/aliases.md#require-inline-alias | |
# | |
# Example: | |
# (replace "1.2.3" with the latest version constraints your other package(s) were depending on) | |
composer require VENDOR_NAME/PACKAGE_NAME:"dev-feature/FOO_BAR as 1.2.3" | |
# Once your are done performing your work on the package, commit your changes in the package, | |
# do NOT commit your composer.json and composer.lock changes in the project. | |
# Revert these back to HEAD within the project. | |
composer checkout -- composer.json composer.lock | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment