-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
145 lines (104 loc) · 3.95 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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
SHELL=/bin/bash
client="./radiomag-client-vue"
server="./radiomag-server-express"
to_client=cd $(client)
to_server=cd $(server)
session_name="radiomag_app"
panel_client=0
panel_server=1
.PHONY: screenshots
start: start_ide start_dev ## Run editor and developer dashboard
start_dev: ## Run developer dashboard with start project
tmux new-session -d -s $(session_name)
tmux split-window -h
tmux send-keys -t $(panel_client) \
"make start_client" Enter
tmux send-keys -t $(panel_server) \
"make start_server" Enter
tmux select-pane -t $(panel_client)
tmux attach-session -t $(session_name)
start_ide: ## Run editor (VSCode)
code
start_browser: ## Run chromium (fullscreen + devtools)
@RADIOMAG_HOST=radiomag node ./tools/startBrowser.mjs
install: init_dev_env hooks init_database ## Init project first time
check_package: ## Check version of npm packages, only the direct dependencies of the root project
npm outdated | tee outdated.txt
check_packages_all: ## Check version of all npm packages, find all outdated meta-dependencies
npm outdated --all --long | sort -u -k1,1 -k2,2 | nl | tee outdated-all.txt
list_installed_packages: ## List installed packages
npm list --all > list_installed_packages.txt
explore_packages: check_package check_packages_all list_installed_packages ## Get info about installed packages
start_client: start_browser ## Run developer client
@$(to_client) && npm run dev
start_server: ## Run developer server
@$(to_server) && npm run dev
update_interactive: ## Update packages interactive
npx npm-check-updates && npx npm-check-updates -i
hooks: ## Add project git hooks
cp ./.hooks/* ./.git/hooks && \
chmod +x ./.git/hooks/commit-msg && \
chmod +x ./.git/hooks/pre-commit && \
chmod +x ./.git/hooks/pre-push
tests_server: ## Run server tests
cd $(server) && npm run tests
tests_client: ## Run client tests
cd $(client) && npm run test:run
tests: tests_server tests_client ## Run all tests
test_client_create: ## Create new client test file
node ./tools/test_client_create.mjs
build_server: ## Build server
cd $(server) && npm run build
build_client: ## Build client
cd $(client) && npm run build
build: build_client build_server ## Build project
git_clear: ## Delete unmerged branches
git branch | grep -v -e "dev" -e "main" | xargs git branch -d
git_config: ## Add git config for this project
git config --add include.path '../gitconfig'
git_lint: ## Lint all files that has been add after last commit
@./tools/git_lint.sh
init_dev_env: ## Install npm packages
rm -rf node_modules && npm i
diagram: ## Create diagram of files dependencies
npm run diagram
find_comments: ## Find all comments
egrep -e '^(\/\/|\/\*((.|\n|\r)*)\*\/)' -r -I -n \
--exclude-dir=node_modules \
--exclude=*.d.ts \
--exclude=*config* .
find_console: ## Find "console."
grep -e "console\." -r -n \
--exclude-dir=node_modules \
--exclude-dir=dist .
init_database: ## Setup database
cd $(server) && npm run migrate && npm run seeds
clear: ## Delete files
rm db.sqlite
list_of_commands: ## Show list of commands
@echo "List of commands: "
@grep -e "^\w*:" ./Makefile | \
sort | \
cut -d ":" -f 1 | \
awk '{print "make", $$0}' | \
nl -s" " -w2
run_command: ## Run "Makefile" command
@./tools/run_command
help: ## Show available commands
@echo "Available 'make' commands:"
@egrep -h '\s##\s' ./Makefile | \
sort | \
awk 'BEGIN {FS = ":.*?## "}; \
{printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
update_changelog: ## Append commits to CHANGELOG.md file
@./tools/changelog.mjs
screenshots: ## Make screenshots of pages
@rm -f ./screenshots/*
@node ./tools/screenshotsUpdate.mjs
story: ## Run storybook server
cd $(client) && npm run storybook
story_check: ## Show list of components without own directory and stories(storybook)
@chmod +x ./tools/stories.sh && ./tools/stories.sh
metrics: ## Puppeteer metrics(file .metrics) and lighthouse metrics(folder .metrics_lighthouse)
node ./tools/metrics.mjs | tee .metrics
node ./tools/metrics.lighthouse.mjs