-
Notifications
You must be signed in to change notification settings - Fork 33
/
Copy pathrepo.Makefile
40 lines (31 loc) · 1.43 KB
/
repo.Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
default: help
# set variables
GIT_ROOT := $(shell git rev-parse --show-toplevel)
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
check_reset:
@echo -n "Are you sure? This action will delete any files not associated with the git repo, reset all submodules and reset any unchanged work. Files like node_modules, flattened files, etc will be deleted [y/N] " && read ans && [ $${ans:-N} = y ]
reset-submodules: ## hard resets all submodules
git submodule foreach --recursive git clean -xfd
git submodule foreach --recursive git reset --hard
git submodule update --init --recursive
full-reset: check_reset reset-submodules ## Fully reset the repository to it's cloned state
git clean -xfdf
git reset --hard
tidy: ## Runs go mod tidy on all go.mod files in the repo
go work sync
$(GIT_ROOT)/make/scripts/tidy.sh
lint-go: ## Runs make lint in all go.mod files in the repo.
$(GIT_ROOT)/make/scripts/lint.sh
docker-clean: ## stops and removes all containers at once
docker ps -aq | xargs docker stop | xargs docker rm
docker network prune
.PHONY: full-reset check_reset