Table for contents
- Generator
- Getting information
- Laravel and composer
- Endpoints
- Log file
- Running developer tools
- Tinker
- Testing
- Testing
- Clean up
- Clear cache
- Clear storage
- Clear log file (default configuration)
You can generate recipes at Nicomedes.
Laravel and composer
.PHONY: info
info:
php artisan about
php composer.phar diagnose
Endpoints
.PHONY: routes
routes:
php artisan route:list
Log file
.PHONY: logs
logs:
grep ERROR storage/logs/laravel.log
Tinker
.PHONY: tinker
tinker:
php composer.phar dump-autoload
php artisan tinker
Testing
.PHONY: test
test:
php artisan test --env=testing --stop-on-failure
Clean up
Clear cache
php composer.phar dump-autoload
php artisan optimize:clear
Clear storage
.PHONY: clear\:storage
clear\:storage:
rm -rf ./storage/app/*
Clear log file (default configuration)
.PHONY: clear\:log
clear\:log:
rm storage/logs/laravel.log
Table of contents
- Open hyperlinks (Ubuntu)
- Run multiple tasks
- Select specific npm version
Open hyperlinks (Ubuntu)
A handy recipe to automatically open links via a makefile:
.PHONY: browse
browse:
xdg-open http://localhost:8000
Run multiple tasks
.PHONY: serve
serve:
make -j 2 serve-backend serve-frontend browse
.PHONY: serve-frontend
serve-frontend:
npm run hot
.PHONY: serve-backend
serve-backend:
php artisan serve
Select specific npm version
.PHONY: install
install:
. ${NVM_DIR}/nvm.sh && nvm install 14.0.0 && npm install
.PHONY: serve
serve:
reset && . ${NVM_DIR}/nvm.sh && nvm use 14.0.0 && npm run serve
Small snippet to print all rules starting with a specific prefix (for example ssh) when you use semicolon to organize subrecipes:
.PHONY: ssh
ssh:
@echo "recipes:"
@cat makefile | grep -o "^ssh\\\\:[^(: )]*" | sed 's/\\//' | sed 's/^/ - /'
Then you can add recipes with the following format:
.PHONY: ssh\:x
ssh\:x:
...
.PHONY: ssh\:y
ssh\:y:
...
.PHONY: ssh\:z
ssh\:z:
...
Typing make ssh will print the available options while typing make ssh:x will only execute recipe x.
See: https://medium.com/stack-me-up/using-makefiles-the-right-way-a82091286950
TSC=./node_modules/.bin/tsc
SASS=./node_modules/.bin/sass
MARKUP_FILES=$(wildcard src/index.hbs src/partials/*hbs)
STYLE_FILES=$(wildcard src/index.sass src/styles/*.sass)
SCRIPT_FILES=$(wildcard src/index.ts src/scripts/*.ts)
IMAGES=$(wildcard src/index.ts src/media/*.jpeg)
VIDEOS=$(wildcard src/index.ts src/media/*.mp4)
# ...
.DEFAULT_TARGET: all
all: build markup scripts styles media
build:
mkdir -p $@
touch $@
node_modules: package.json
npm install
touch $@
markup: build/index.html
build/index.html: $(MARKUP_FILES)
hbs src/index.hbs --partial 'src/partials/*.hbs' -o ./build
scripts: build/index.js
build:index.js: tsconfig.json $(SCRIPT_FILES) node_modules
$(TSC) --build $<
styles: build/index.css
build/index.css: $(STYLE_FILES) node_modules
$(SASS) $< $@
media: images videos
images: $(IMAGES)
for image in $^; do \
imagemin $$image > build/media/$$image ; \
done
touch $@
videos: $(VIDEOS)
for video in $^; do \
HandBrakeCLI -i $$video -o build/media/$$video ; \
done
touch $@
.PHONY: clean
clean:
rm -Rf ./build/*
Personal portal to the Internet