Last active
December 11, 2021 20:39
-
-
Save rostockahoi/beb31c907de6a32c28bac976672de3f9 to your computer and use it in GitHub Desktop.
Development commands for Laravel based projects
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
################################################ | |
# The Makefile | |
# | |
### @version 0.2 | |
### @link https://gist.github.com/rostockahoi/beb31c907de6a32c28bac976672de3f9 | |
### @author Johannes Ahrndt | |
### @copyright @webhubworks - webhub GmbH | |
################################################ | |
.SILENT: | |
.ONESHELL: | |
.PHONY: up down rebuild watch what nova-devtools | |
what: | |
echo "up - Build and run Sail, install composer deps, migrate and seed database"; \ | |
echo "down - Stop Sail"; \ | |
echo "rebuild - Remove volumes and rebuild from scratch (Warning: Nukes all volumes)"; \ | |
echo "watch - Install node modules and run Mix watcher"; \ | |
echo "nova-devtools - Compile Nova's JavaScript for development to activate Vue DevTools"; \ | |
up: | |
if [ ! -d "./vendor" ]; then \ | |
docker run --rm -u "$(shell id -u):$(shell id -g)" -v $(shell pwd):/var/www/html -w /var/www/html laravelsail/php80-composer:latest composer install --ignore-platform-reqs; \ | |
make up; \ | |
else \ | |
./vendor/bin/sail build; \ | |
./vendor/bin/sail up -d; \ | |
./vendor/bin/sail composer install; \ | |
./vendor/bin/sail art migrate:fresh; \ | |
./vendor/bin/sail art db:seed; \ | |
./vendor/bin/sail logs --follow; \ | |
fi | |
down: | |
./vendor/bin/sail down; \ | |
rebuild: | |
./vendor/bin/sail down -v; \ | |
./vendor/bin/sail build --no-cache; \ | |
watch: | |
if [ -f "./.nvmrc" ]; then \ | |
. ${NVM_DIR}/nvm.sh && nvm use; \ | |
npm install; \ | |
npx husky install; \ | |
npx mix watch; \ | |
else \ | |
echo "\n.nvmrc file is missing! Cannot set node version.\n"; \ | |
exit 1; \ | |
fi | |
nova-devtools: | |
if [ -d "./vendor/laravel/nova" ]; then \ | |
cd ./vendor/laravel/nova; \ | |
mv webpack.mix.js.dist webpack.mix.js; \ | |
npm install; \ | |
npm run dev; \ | |
rm -rf node_modules; \ | |
cd -; \ | |
php artisan nova:publish; \ | |
else \ | |
echo "\nLaravel Nova is not installed!\n"; \ | |
exit 1; \ | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Added
nova-devtools - Compile Nova's JavaScript for development to activate Vue DevTools