/
makefile
131 lines (100 loc) · 3.13 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
.PHONY: build dev tsc lint fix test ci cypress clean-build clean-deps install reinstall upgrade clear setup
# these means you can run the binaries in node_modules
# like with npm scripts
export PATH := node_modules/.bin:$(PATH)
export SHELL := /usr/bin/env bash
# messaging
define log
@node scripts/log $(1)
endef
define banner
@node scripts/banner $(1)
endef
# prod
build: clear clean-build setup install
$(call log, "building production bundles 📦")
@pnpm run build
build-analyze: clear clean-build setup install
$(call log, "building production bundles and analyze bundle size 🕵️📦")
@pnpm run build:analyze
# dev
setup: clear
$(call log, "setting up development environment 🛠️")
$(call log, "enabling pnpm")
@corepack enable
@corepack prepare pnpm@latest --activate
dev: clean-build clear setup install
$(call banner, "gateway is starting")
$(call log, "starting development server 👩💻")
@(pnpm run watch:server & pnpm run watch & wait)
# QA
tsc: clear install
$(call log, "checking for type errors 🧐")
@pnpm run tsc
lint: clear install
$(call log, "checking for lint errors 🧹")
@pnpm run lint
fix: clear install
$(call log, "attempting to fix lint errors 🧰")
@pnpm run lint --fix
test: clear install
$(call log, "running tests 🧪")
@pnpm run test --verbose --runInBand
$(call log, "everything seems 👌")
test-unit: clear install
$(call log, "running only unit-tests 🧪")
@pnpm run test:unit --verbose --runInBand
$(call log, "everything seems 👌")
ci: clear setup
$(call log, "running CI 🤖")
@(./ci.sh)
cypress-mocked: clear
$(call log, "opening cypress using mocks 🌲")
@(./cypress-mocked.sh)
cypress-mocked-dev: export DEV_MODE = true
cypress-mocked-dev: clear
$(call log, "opening cypress in dev mode using mocks 🌲")
@(./cypress-mocked.sh)
cypress-ete: clear
$(call log, "opening cypress 🌲")
@(./cypress-ete.sh)
cypress-ete-dev: export DEV_MODE = true
cypress-ete-dev: clear
$(call log, "opening cypress 🌲")
@(./cypress-ete.sh)
cypress-ete-okta: export USE_OKTA = true
cypress-ete-okta: clear
$(call log, "opening cypress using okta tests 🌲")
@(./cypress-ete.sh)
cypress-ete-okta-dev: export USE_OKTA = true
cypress-ete-okta-dev: export DEV_MODE = true
cypress-ete-okta-dev: clear
$(call log, "opening cypress in dev mode using okta tests 🌲")
@(./cypress-ete.sh)
cypress-mocked-okta: clear
$(call log, "opening cypress using Okta mocked tests 🌲")
@(./cypress-mocked-okta.sh)
cypress-mocked-okta-dev: export DEV_MODE = true
cypress-mocked-okta-dev: clear
$(call log, "opening cypress in dev mode using Okta mocked tests 🌲")
@(./cypress-mocked-okta.sh)
storybook: clear
$(call log, "opening storybook 📖")
@pnpm run storybook
# helpers
clean-build:
$(call log, "trashing build 🗑️")
@rm -rf build
clean-deps:
$(call log, "trashing dependencies 🚮")
@rm -rf node_modules
install:
$(call log, "installing dependencies 📦")
@pnpm install
reinstall: clear clean-deps install
$(call log, "dependencies have been reinstalled ♻️")
upgrade: clear
$(call log, "upgrading dependencies 🚀")
@pnpm update -L -i
clear: # private
@clear