forked from entelecheia/hyfi-fetcher
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
125 lines (94 loc) · 4.48 KB
/
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# To do stuff with make, you type `make` in a directory that has a file called
# "Makefile". You can also type `make -f <makefile>` to use a different filename.
#
# A Makefile is a collection of rules. Each rule is a recipe to do a specific
# thing, sort of like a grunt task or an npm package.json script.
#
# A rule looks like this:
#
# <target>: <prerequisites...>
# <commands>
#
# The "target" is required. The prerequisites are optional, and the commands
# are also optional, but you have to have one or the other.
#
# Type `make` to show the available targets and a description of each.
#
.DEFAULT_GOAL := help
.PHONY: help
help: ## Display this help
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%-25s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
##@ Clean-up
clean: ## run all clean commands
@poe clean
##@ Git Branches
show-branches: ## show all branches
@git show-branch --list
dev-checkout: ## checkout the dev branch
@branch=$(shell echo $${branch:-"dev"}) && \
git show-branch --list | grep -q $${branch} && \
git checkout $${branch}
dev-checkout-upstream: ## create and checkout the dev branch, and set the upstream
@branch=$(shell echo $${branch:-"dev"}) && \
git checkout -B $${branch} && \
git push --set-upstream origin $${branch} || true
main-checkout: ## checkout the main branch
@git checkout main
##@ Utilities
large-files: ## show the 20 largest files in the repo
@find . -printf '%s %p\n'| sort -nr | head -20
disk-usage: ## show the disk usage of the repo
@du -h -d 2 .
git-sizer: ## run git-sizer
@git-sizer --verbose
gc-prune: ## garbage collect and prune
@git gc --prune=now
##@ Setup
install-node: ## install node
@export NVM_DIR="$${HOME}/.nvm"; \
[ -s "$${NVM_DIR}/nvm.sh" ] && . "$${NVM_DIR}/nvm.sh"; \
nvm install --lts
nvm-ls: ## list node versions
@export NVM_DIR="$${HOME}/.nvm"; \
[ -s "$${NVM_DIR}/nvm.sh" ] && . "$${NVM_DIR}/nvm.sh"; \
nvm ls
set-default-node: ## set default node
@export NVM_DIR="$${HOME}/.nvm"; \
[ -s "$${NVM_DIR}/nvm.sh" ] && . "$${NVM_DIR}/nvm.sh"; \
nvm alias default node
install-pipx: ## install pipx (pre-requisite for external tools)
@command -v pipx &> /dev/null || pip install --user pipx || true
install-copier: install-pipx ## install copier (pre-requisite for init-project)
@command -v copier &> /dev/null || pipx install copier || true
install-poetry: install-pipx ## install poetry (pre-requisite for install)
@command -v poetry &> /dev/null || pipx install poetry || true
install-poe: install-pipx ## install poetry (pre-requisite for install)
@command -v poe &> /dev/null || pipx install poethepoet || true
install-commitzen: install-pipx ## install commitzen (pre-requisite for commit)
@command -v cz &> /dev/null || pipx install commitizen || true
install-precommit: install-pipx ## install pre-commit
@command -v pre-commit &> /dev/null || pipx install pre-commit || true
install-precommit-hooks: install-precommit ## install pre-commit hooks
@pre-commit install
mkvirtualenv: ## create the project environment
@python3 -m venv "$$WORKON_HOME/hyfi-fetcher"
@. "$$WORKON_HOME/hyfi-fetcher/bin/activate"
@pip install --upgrade pip setuptools wheel
mkvirtualenv-system: ## create the project environment with system site packages
@python3 -m venv "$$WORKON_HOME/hyfi-fetcher" --system-site-packages
@. "$$WORKON_HOME/hyfi-fetcher/bin/activate"
@pip install --upgrade pip setuptools wheel
workon: ## activate the project environment
@. "$$WORKON_HOME/hyfi-fetcher/bin/activate"
initialize: install-pipx ## initialize the project environment
@pipx install copier
@pipx install poethepoet
@pipx install commitizen
@pipx install pre-commit
@pre-commit install
init-project: initialize remove-template ## initialize the project (Warning: do this only once!)
@copier copy --trust --data 'code_template_source=gh:entelecheia/hyfi-template' --answers-file .copier-config.yaml gh:entelecheia/hyperfast-python-template .
reinit-project: install-copier ## reinitialize the project (Warning: this may overwrite existing files!)
@bash -c 'args=(); while IFS= read -r file; do args+=("--skip" "$$file"); done < .copierignore; copier copy --trust "$${args[@]}" --data 'code_template_source=gh:entelecheia/hyfi-template' --answers-file .copier-config.yaml gh:entelecheia/hyperfast-python-template .'
install-playwright: ## install playwright
@command -v playwright &> /dev/null && playwright install || true