@@ -21,7 +21,10 @@ MAGENTO_CLI="bin/magento"
21
21
MAGERUN_CLI=" "
22
22
REDIS_CLI=" redis-cli"
23
23
VARNISH_CLI=" varnishadm" # We never use varnish on a local machine, and prefer to never use it
24
+ PHP_CLI=" php"
24
25
COMPOSER_CLI=" composer"
26
+ NODE_CLI=" node"
27
+ NPM_CLI=" npm"
25
28
PURGE_CLI=" rm -rf"
26
29
OPEN_CLI=" xdg-open" # Linux
27
30
GET_CLI=" wget" # Linux
@@ -56,7 +59,10 @@ if [ -f .env ] && grep -q "WARDEN_ENV_NAME" .env && [[ ! "$PATH" == /var/www/htm
56
59
MAGERUN_CLI=" warden env exec php-fpm n98-magerun"
57
60
REDIS_CLI=" warden env exec redis redis-cli"
58
61
VARNISH_CLI=" warden env exec -T varnish varnishadm"
62
+ PHP_CLI=" warden env exec php-fpm php"
59
63
COMPOSER_CLI=" warden env exec php-fpm composer"
64
+ NODE_CLI=" warden env exec php-fpm node"
65
+ NPM_CLI=" warden env exec php-fpm npm"
60
66
# Run removal within environment, so that changes are in effect immediately.
61
67
# Changes will get synced back to the host
62
68
PURGE_CLI=" warden env exec -T php-fpm rm -rf"
@@ -120,6 +126,10 @@ function get_mage_store_uri() {
120
126
echo $store_url
121
127
}
122
128
129
+ function get_composer_pkg_version() {
130
+ echo -e $( $COMPOSER_CLI show $1 | grep ' versions' | grep -o -E ' \*\ .+' | awk ' {print $2}' | cut -d' ,' -f1)
131
+ }
132
+
123
133
function mage_add_hyva() {
124
134
echo " Installing Hyva theme..."
125
135
echo " Make sure you have and license key or access to the gitlab env"
@@ -152,6 +162,7 @@ function mage_add_hyva() {
152
162
done
153
163
154
164
$COMPOSER_CLI config repositories.hyva-themes/magento2-graphql-tokens git
[email protected] :hyva-themes/magento2-graphql-tokens.git
165
+ $COMPOSER_CLI config repositories.hyva-themes/magento2-mollie-theme-bundle git
[email protected] :hyva-themes/hyva-compat/magento2-mollie-theme-bundle.git
155
166
$COMPOSER_CLI require hyva-themes/magento2-luma-checkout --prefer-source
156
167
$COMPOSER_CLI require hyva-themes/magento2-default-theme --prefer-source
157
168
fi
@@ -189,7 +200,14 @@ function mage_add_checkout() {
189
200
fi
190
201
}
191
202
192
- MAGE_VERSION=" 2.3.1"
203
+ function mage_build_hyva() {
204
+ if [ ! -d vendor/hyva-themes/magento2-default-theme/web/tailwind/node_modules ]; then
205
+ $NPM_CLI --prefix vendor/hyva-themes/magento2-default-theme/web/tailwind install;
206
+ fi
207
+ $NPM_CLI --prefix vendor/hyva-themes/magento2-default-theme/web/tailwind run build;
208
+ }
209
+
210
+ MAGE_VERSION=" 2.3.2"
193
211
194
212
function mage_version() {
195
213
echo -e " \n${BOLD} Mage ${GREEN}${MAGE_VERSION}${RESET} "
@@ -373,7 +391,16 @@ function mage_open() {
373
391
374
392
# Prefetch admin URL data for open steps
375
393
if [[ " $store " == " admin" ]]; then
376
- local admin_path=$( grep frontName app/etc/env.php | tail -1 | cut -d ' >' -f2 | cut -d ' "' -f2 | cut -d " '" -f2)
394
+ local admin_custom_path=$( $MAGENTO_CLI config:show admin/url/use_custom_path)
395
+
396
+ if [[ $admin_custom_path == " 1" ]]; then
397
+ local admin_path=$( $MAGENTO_CLI config:show admin/url/custom_path)
398
+ else
399
+ local admin_path=$( php -r "
400
+ \$ array = include('app/etc/env.php');
401
+ if (isset(\$ array['backend']['frontName'])) { echo \$ array['backend']['frontName']; }
402
+ " 2> /dev/null)
403
+ fi
377
404
fi
378
405
379
406
if [[ -z " $store_url " ]]; then
@@ -447,6 +474,10 @@ function mage_add_patch() {
447
474
echo -e " Patch added to the composer.json in extra.patches.$vendor_folder_name "
448
475
}
449
476
477
+ function mage_new_patch_branch_diff() {
478
+ git diff $( git rev-parse --abbrev-ref origin/HEAD) ..$( git branch --show-current) > $( git branch --show-current) .patch
479
+ }
480
+
450
481
function mage_new_patch_file() {
451
482
local src=${1}
452
483
@@ -565,12 +596,18 @@ case "${@}" in
565
596
;;
566
597
567
598
" info" )
568
- $MAGENTO_CLI --version
599
+ echo -e " Magento: $GREEN $( $MAGENTO_CLI --version | sed ' s/Magento CLI //' ) $RESET "
600
+ if $COMPOSER_CLI show hyva-themes/magento2-default-theme > /dev/null 2>&1 ; then
601
+ echo -e " Hyva Theme: $GREEN $( get_composer_pkg_version ' hyva-themes/magento2-default-theme' ) $RESET "
602
+ echo -e " Hyva Module: $GREEN $( get_composer_pkg_version ' hyva-themes/magento2-theme-module' ) $RESET "
603
+ fi
604
+ echo -e " PHP: $GREEN $( $PHP_CLI --version | grep ^PHP | cut -d' ' -f2) $RESET "
605
+ echo -e " NODE: $GREEN $( $NODE_CLI --version | sed ' s/v//' ) $RESET "
569
606
echo -e " Base URI: $( get_mage_base_uri) "
570
607
echo -e " Admin URI: $( grep frontName app/etc/env.php | tail -1 | cut -d " >" -f2 | cut -d " '" -f2) "
571
608
echo -e " Database: $( grep dbname app/etc/env.php | tail -1 | cut -d " >" -f2 | cut -d " '" -f2) "
572
- $MAGENTO_CLI maintenance:status
573
609
$MAGENTO_CLI deploy:mode:show
610
+ $MAGENTO_CLI maintenance:status
574
611
if [[ -n " $MAGENTO_CLI config:show catalog/search/engine" ]]; then
575
612
echo -e " Search Engine: $( $MAGENTO_CLI config:show catalog/search/engine) "
576
613
fi
@@ -605,7 +642,7 @@ case "${@}" in
605
642
606
643
if [[ $WARDEN == 1 ]]; then
607
644
# NOTE: we need to sadly hard code the path,
608
- # but lukcy we can since the warden container is always the same
645
+ # but lucky we can since the warden container is always the same
609
646
warden env exec php-fpm /home/www-data/.composer/vendor/bin/cache-clean.js -w
610
647
else
611
648
$cache_cli
@@ -704,12 +741,12 @@ case "${@}" in
704
741
;;
705
742
706
743
" add baldr" )
707
- composer config repositories.siteation/magento2-theme-baldr git
[email protected] :Siteation/magento2-theme-baldr.git
708
- composer require siteation/magento2-theme-baldr
744
+ $COMPOSER_CLI config repositories.siteation/magento2-theme-baldr git
[email protected] :Siteation/magento2-theme-baldr.git
745
+ $COMPOSER_CLI require siteation/magento2-theme-baldr
709
746
;;
710
747
711
748
" set theme" * )
712
- if composer show yireo/magento2-theme-commands > /dev/null 2>&1 ; then
749
+ if $COMPOSER_CLI show yireo/magento2-theme-commands > /dev/null 2>&1 ; then
713
750
$MAGENTO_CLI theme:change $3
714
751
$MAGENTO_CLI cache:flush;
715
752
else
@@ -811,6 +848,10 @@ case "${@}" in
811
848
$COMPOSER_CLI outdated --direct --no-dev --ignore symfony/finder --ignore symfony/process --format json > composer-outdated.json
812
849
;;
813
850
851
+ " build hyva" )
852
+ mage_build_hyva
853
+ ;;
854
+
814
855
" build" * )
815
856
default_args=" -j 4"
816
857
args=${@: 2}
@@ -819,14 +860,14 @@ case "${@}" in
819
860
820
861
" run" * )
821
862
if [[ -n " $MAGERUN_CLI " ]]; then
822
- $MAGERUN_CLI ${@: 2}
863
+ $MAGERUN_CLI " ${@: 2} "
823
864
else
824
865
echo $NO_MAGERUN_MSG
825
866
fi
826
867
;;
827
868
828
869
* )
829
- $MAGENTO_CLI $@
870
+ $MAGENTO_CLI " $@ "
830
871
;;
831
872
esac
832
873
0 commit comments