54 lines
1.8 KiB
Makefile

.PHONY: help clean get upgrade format lint gen watch run-dev run-stg run-prod
# Adding a help file: https://gist.github.com/prwhite/8168133#gistcomment-1313022
help: ## This help dialog.
@IFS=$$'\n' ; \
help_lines=(`fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//'`); \
for help_line in $${help_lines[@]}; do \
IFS=$$'#' ; \
help_split=($$help_line) ; \
help_command=`echo $${help_split[0]} | sed -e 's/^ *//' -e 's/ *$$//'` ; \
help_info=`echo $${help_split[2]} | sed -e 's/^ *//' -e 's/ *$$//'` ; \
printf "%-30s %s\n" $$help_command $$help_info ; \
done
clean: ## Cleans the environment.
@echo "• Cleaning the project..."
@rm -rf pubspec.lock
@flutter clean
get: ## Gets the dependencies.
@echo "• Getting the dependencies..."
@flutter pub get
upgrade: clean ## Upgrades dependencies.
@echo "• Upgrading dependencies..."
@flutter pub upgrade
format: ## Formats the code.
@echo "• Formatting the code"
@dart format . --fix
lint: ## Lints the code.
@echo "• Verifying code..."
@dart analyze . || (echo "Error in project"; exit 1)
gen: get ## Run build_runner build (Freezed, Fluttergen, Hive etc...)
@echo "• build_runner build"
@flutter pub run build_runner build
watch: get ## Run build_runner watch (Freezed, Fluttergen, Hive etc...)
@echo "• build_runner watch"
@flutter pub run build_runner watch
run-dev: ## Run app in development mode
@echo "• Running the app (development)"
@flutter run --flavor development --target lib/main_development.dart
run-stg: ## Run app in staging mode
@echo "• Running the app (staging)"
@flutter run --flavor staging --target lib/main_staging.dart
run-prod: ## Run app in production mode
@echo "• Running the app (production)"
@flutter run --flavor production --target lib/main_production.dart