Last active
November 3, 2021 21:21
-
-
Save svenmuennich/e26e4859ac88ca59e91aaf62b24ca954 to your computer and use it in GitHub Desktop.
Toggles between composer installed and symlinked shared dependencies of Shopware 5 plugin.
This file contains 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
#!/bin/bash | |
# Check parameters | |
if [[ $# -ne 2 ]]; then | |
echo " Usage: $0 <dev|prod> <plugin_path>" | |
exit 1 | |
fi | |
mode=$1 | |
plugin_path=$(cd $2 && pwd) | |
# Set you dependency root path (the path where your symlinked depencies are located) here | |
dependency_root_path="" | |
# Remove current dependencies | |
rm -rf "$plugin_path/ViisonCommon" | |
rm -rf "$plugin_path/ViisonPickwareCommon" | |
rm -rf "$plugin_path/ViisonShippingCommon" | |
rm -rf "$plugin_path/vendor/viison/shopware-plugin-dependency-loader" | |
rm -rf "$plugin_path/vendor/viison/shopware-order-resource" | |
rm -rf "$plugin_path/vendor/viison/shopwaretestingcommon" | |
if [[ $mode == "dev" ]]; then | |
# Add symlinks | |
ln -s "$dependency_root_path/ViisonCommon/" "$plugin_path/ViisonCommon" | |
ln -s "$dependency_root_path/ShopwareOrderResource/" "$plugin_path/vendor/viison/shopware-order-resource" | |
ln -s "$dependency_root_path/ShopwarePluginDependencyLoader/" "$plugin_path/vendor/viison/shopware-plugin-dependency-loader" | |
ln -s "$dependency_root_path/ShopwareTestingCommon/" "$plugin_path/vendor/viison/shopwaretestingcommon" | |
if [[ $plugin_path == *"ViisonPickwareMobile"* ]] || [[ $plugin_path == *"ViisonPickwarePOS"* ]] || [[ $plugin_path == *"ViisonPickwarePOSReceiptSigningFT"* ]]; then | |
ln -s "$dependency_root_path/ViisonPickwareCommon/" "$plugin_path/ViisonPickwareCommon" | |
fi | |
if [[ $plugin_path == *"ViisonAddressLabel"* ]] || [[ $plugin_path == *"ViisonAustrianPost"* ]] || [[ $plugin_path == *"ViisonDHL"* ]] || [[ $plugin_path == *"ViisonDPD"* ]] || [[ $plugin_path == *"ViisonGLS"* ]] || [[ $plugin_path == *"ViisonPostNL"* ]] || [[ $plugin_path == *"ViisonUPS"* ]] || [[ $plugin_path == *"ViisonSwissPost"* ]] || [[ $plugin_path == *"ViisonGermanPost"* ]]; then | |
ln -s "$dependency_root_path/ShopwareShippingCommon/" "$plugin_path/ViisonShippingCommon" | |
fi | |
elif [[ $mode == "prod" ]]; then | |
# Install composer dependencies | |
cd "$plugin_path" && composer install | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment