Skip to content

Commit

Permalink
update laravel-sail.plugin.zsh
Browse files Browse the repository at this point in the history
change default nodejs of `s ninit` to version 20
  • Loading branch information
ariaieboy committed Jun 3, 2023
1 parent 02ea904 commit f194c63
Showing 1 changed file with 19 additions and 18 deletions.
37 changes: 19 additions & 18 deletions laravel-sail.plugin.zsh
Original file line number Diff line number Diff line change
@@ -1,24 +1,39 @@
export APP_SERVICE=${APP_SERVICE:-"laravel.test"}
function _find_sail() {
local dir=.
until [ $dir -ef / ]; do
if [ -f "$dir/sail" ]; then
echo "$dir/sail"
return 0
elif [ -f "$dir/vendor/bin/sail" ]; then
echo "$dir/vendor/bin/sail"
return 0
fi
dir+=/..
done
return 1
}
function s() {
local sail_path=`_find_sail`
local sail_path
sail_path=$(_find_sail)

if [[ $1 == "cinit" ]]; then
docker run --rm \
-u "$(id -u):$(id -g)" \
-v $(pwd):/var/www/html \
-w /var/www/html \
laravelsail/php${2:=82}-composer:latest \
laravelsail/php"${2:=82}"-composer:latest \
composer install --ignore-platform-reqs
elif [[ $1 == "ninit" ]]; then
docker run --rm \
-u "$(id -u):$(id -g)" \
-v $(pwd):/var/www/html \
-w /var/www/html \
node:${2:=18} \
node:${2:=20} \
npm install
else
if [ "$sail_path" = "" ]; then
>&2 echo "laravel-sail: sail executable not found. Are you in a Laravel directory?\nif yes try install Dependencies using 's cinit' command"
>&2 printf "laravel-sail: sail executable not found. Are you in a Laravel directory?\nif yes try install Dependencies using 's cinit' command\n"
return 1
fi
$sail_path $*
Expand Down Expand Up @@ -70,17 +85,3 @@ function _composer() {
compadd $(sc --raw --no-ansi list | sed "s/[[:space:]].*//g")
fi
}
function _find_sail() {
local dir=.
until [ $dir -ef / ]; do
if [ -f "$dir/sail" ]; then
echo "$dir/sail"
return 0
elif [ -f "$dir/vendor/bin/sail" ]; then
echo "$dir/vendor/bin/sail"
return 0
fi
dir+=/..
done
return 1
}

0 comments on commit f194c63

Please sign in to comment.