-
Notifications
You must be signed in to change notification settings - Fork 36
/
Copy pathMakefile
119 lines (92 loc) · 3 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
# Include env file
ifneq (,$(wildcard ./.env))
include .env
export
endif
.DEFAULT_GOAL := all
MAKEFLAGS += --no-print-directory
.PHONY: bootstrap ## setup dev environment
bootstrap: install
npx husky install
npx husky add .husky/commit-msg 'npx --no-install commitlint --edit "$1"'
# When --ci option is provided, Jest will assume it is running in a CI environment.
# This changes the behavior when a new snapshot is encountered. Instead of the regular behavior of storing a new snapshot automatically,
# it will fail the test and require Jest to be run with --updateSnapshot.
.PHONY: test ## run tests
test:
npx jest --ci --verbose --coverage=false
.PHONY: testcov ## run test coverage
testcov:
npx jest --ci --coverage | tee ./coverage.txt
.PHONY: clean ## clean installation and dist files
clean:
rm -rf coverage
rm -rf dist
rm -rf out
rm -rf node_modules
npm cache clean -f
.PHONY: install ## install dependencies
install:
npm ci
.PHONY: lint ## lint standard js
lint:
npx standard "src/{main,render}/**/*.{js,jsx}" $(filter-out $@,$(MAKECMDGOALS))
.PHONY: format ## auto-format js source files
format:
@$(MAKE) lint -- --fix
.PHONY: runweb ## run dev mode
runweb:
npx vite
.PHONY: runelectron ## run electron dev mode
runelectron:
npx electron-vite
.PHONY: buildweb ## build web app
buildweb:
npx vite build
.PHONY: buildelectron ## build app
buildelectron:
npx electron-vite build
.PHONY: buildicons ## generate a new icon bundle from tpl1024
buildicons:
npx electron-icon-maker --input ./tpl1024.png --output ./icons
.PHONY: package ## generate a new electron package
package: buildelectron
npx electron-builder build $(filter-out $@,$(MAKECMDGOALS))
.PHONY: packagemac ## generate a new electron mac package
packagemac:
@$(MAKE) package -- --mac $(filter-out $@,$(MAKECMDGOALS))
.PHONY: packagelinux ## generate a new electron linux package
packagelinux:
@$(MAKE) package -- --linux $(filter-out $@,$(MAKECMDGOALS))
.PHONY: packagewin ## generate a new electron win package
packagewin:
@$(MAKE) package -- --win --x64 --ia32 $(filter-out $@,$(MAKECMDGOALS))
.PHONY: publishmac ## publish a new electron mac package
publishmac:
@$(MAKE) packagemac -- --publish always
.PHONY: publishlinux ## publish a new electron linux package
publishlinux:
@$(MAKE) packagelinux -- --publish always
.PHONY: publishwin ## publish a new electron win package
publishwin:
@$(MAKE) packagewin -- --publish always
.PHONY: release ## generate a new release version
release:
npx standard-version
.PHONY: syncenv ## pull environments to dotenv vault
syncenv:
npx dotenv-vault@latest pull $(stage) -y
.PHONY: pushenv ## push environments to dotenv vault
pushenv:
npx dotenv-vault@latest push $(stage) -y
rebuild: clean
all: publish-win publish-mac publish-linux
.PHONY: help ## display this message
help:
@grep -E \
'^.PHONY: .*?## .*$$' $(MAKEFILE_LIST) | \
sort | \
awk 'BEGIN {FS = ".PHONY: |## "}; {printf "\033[36m%-19s\033[0m %s\n", $$2, $$3}'
# Prevent Make from trying to interpret `--` as a target
%:
@: