forked from rifflearning/mattermost-webapp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
82 lines (57 loc) · 2.41 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
.PHONY: build test run clean stop check-style run-unit emojis help
BUILD_SERVER_DIR = ../mattermost-server
EMOJI_TOOLS_DIR = ./build/emoji
check-style: node_modules ## Checks JS file for ESLint conformity
@echo Checking for style guide compliance
npm run check
test: node_modules ## Runs tests
@echo Running jest unit/component testing
npm run test
node_modules: package.json package-lock.json
@echo Getting dependencies using npm
npm install
package: build ## Packages app
@echo Packaging webapp
mkdir tmp
mv dist tmp/client
tar -C tmp -czf mattermost-webapp.tar.gz client
mv tmp/client dist
rmdir tmp
build: node_modules ## Builds the app
@echo Building mattermost Webapp
rm -rf dist
npm run build
run: node_modules ## Runs app
@echo Running mattermost Webapp for development
npm run run &
run-fullmap: node_modules ## Runs the app with the JS mapped to source (good for debugger)
@echo FULL SOURCE MAP Running mattermost Webapp for development FULL SOURCE MAP
npm run run-fullmap &
stop: ## Stops webpack
@echo Stopping changes watching
ifeq ($(OS),Windows_NT)
wmic process where "Caption='node.exe' and CommandLine like '%webpack%'" call terminate
else
@for PROCID in $$(ps -ef | grep "[n]ode.*[w]ebpack" | awk '{ print $$2 }'); do \
echo stopping webpack watch $$PROCID; \
kill $$PROCID; \
done
endif
restart: | stop run ## Restarts the app
clean: ## Clears cached; deletes node_modules and dist directories
@echo Cleaning Webapp
rm -rf dist
rm -rf node_modules
emojis: ## Creates emoji JSX file and extracts emoji images from the system font
gem install bundler
bundle install --gemfile=$(EMOJI_TOOLS_DIR)/Gemfile
BUNDLE_GEMFILE=$(EMOJI_TOOLS_DIR)/Gemfile bundle exec $(EMOJI_TOOLS_DIR)/make-emojis
check-style-ci : THRESHOLD ?= 1830
check-style-ci: node_modules ## Checks JS file for ESLint conformity but only output summary for gitlab job log
-npm run check --silent -- --format=html >build/check-style.log.html
build/check-style-ci-report.sh build/check-style.log.html $(THRESHOLD)
test-ci: node_modules ## Runs tests but only output summary for gitlab job log
npm run test --silent >build/test.log 2>&1 || (sed -n -e '/^Snapshot /,$$p' build/test.log ; false)
## Help documentatin à la https://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'