-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
194 lines (177 loc) · 5.67 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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
#----------------------------------------------------------------------------------
# Variables
#----------------------------------------------------------------------------------
VERSION := 0.0.1
UI_ROOT_DIR := projects/ui
UI_ARGS=VITE_UI_VERSION=$(VERSION)
#
# PORTAL_SERVER_URL
ifneq ($(VITE_PORTAL_SERVER_URL),)
UI_ARGS += VITE_PORTAL_SERVER_URL=$(VITE_PORTAL_SERVER_URL)
else ifneq ($(PORTAL_SERVER_URL),)
UI_ARGS += VITE_PORTAL_SERVER_URL=$(PORTAL_SERVER_URL)
endif
#
# CLIENT_ID
ifneq ($(VITE_CLIENT_ID),)
UI_ARGS += VITE_CLIENT_ID=$(VITE_CLIENT_ID)
else ifneq ($(CLIENT_ID),)
UI_ARGS += VITE_CLIENT_ID=$(CLIENT_ID)
endif
#
# TOKEN_ENDPOINT
ifneq ($(VITE_TOKEN_ENDPOINT),)
UI_ARGS += VITE_TOKEN_ENDPOINT=$(VITE_TOKEN_ENDPOINT)
else ifneq ($(TOKEN_ENDPOINT),)
UI_ARGS += VITE_TOKEN_ENDPOINT=$(TOKEN_ENDPOINT)
endif
#
# AUTH_ENDPOINT
ifneq ($(VITE_AUTH_ENDPOINT),)
UI_ARGS += VITE_AUTH_ENDPOINT=$(VITE_AUTH_ENDPOINT)
else ifneq ($(AUTH_ENDPOINT),)
UI_ARGS += VITE_AUTH_ENDPOINT=$(AUTH_ENDPOINT)
endif
#
# LOGOUT_ENDPOINT
ifneq ($(VITE_LOGOUT_ENDPOINT),)
UI_ARGS += VITE_LOGOUT_ENDPOINT=$(VITE_LOGOUT_ENDPOINT)
else ifneq ($(LOGOUT_ENDPOINT),)
UI_ARGS += VITE_LOGOUT_ENDPOINT=$(LOGOUT_ENDPOINT)
endif
#
# APPLIED_OIDC_AUTH_CODE_CONFIG
ifneq ($(VITE_APPLIED_OIDC_AUTH_CODE_CONFIG),)
UI_ARGS += VITE_APPLIED_OIDC_AUTH_CODE_CONFIG=$(VITE_APPLIED_OIDC_AUTH_CODE_CONFIG)
else ifneq ($(APPLIED_OIDC_AUTH_CODE_CONFIG),)
UI_ARGS += VITE_APPLIED_OIDC_AUTH_CODE_CONFIG=$(APPLIED_OIDC_AUTH_CODE_CONFIG)
endif
#
# OIDC_AUTH_CODE_CONFIG_CALLBACK_PATH
ifneq ($(VITE_OIDC_AUTH_CODE_CONFIG_CALLBACK_PATH),)
UI_ARGS += VITE_OIDC_AUTH_CODE_CONFIG_CALLBACK_PATH=$(VITE_OIDC_AUTH_CODE_CONFIG_CALLBACK_PATH)
else ifneq ($(OIDC_AUTH_CODE_CONFIG_CALLBACK_PATH),)
UI_ARGS += VITE_OIDC_AUTH_CODE_CONFIG_CALLBACK_PATH=$(OIDC_AUTH_CODE_CONFIG_CALLBACK_PATH)
endif
#
# OIDC_AUTH_CODE_CONFIG_LOGOUT_PATH
ifneq ($(VITE_OIDC_AUTH_CODE_CONFIG_LOGOUT_PATH),)
UI_ARGS += VITE_OIDC_AUTH_CODE_CONFIG_LOGOUT_PATH=$(VITE_OIDC_AUTH_CODE_CONFIG_LOGOUT_PATH)
else ifneq ($(OIDC_AUTH_CODE_CONFIG_LOGOUT_PATH),)
UI_ARGS += VITE_OIDC_AUTH_CODE_CONFIG_LOGOUT_PATH=$(OIDC_AUTH_CODE_CONFIG_LOGOUT_PATH)
endif
#
# SWAGGER_CONFIG_URL
ifneq ($(VITE_SWAGGER_CONFIG_URL),)
UI_ARGS += VITE_SWAGGER_CONFIG_URL=$(VITE_SWAGGER_CONFIG_URL)
else ifneq ($(SWAGGER_CONFIG_URL),)
UI_ARGS += VITE_SWAGGER_CONFIG_URL=$(SWAGGER_CONFIG_URL)
endif
#
# AUDIENCE
ifneq ($(VITE_AUDIENCE),)
UI_ARGS += VITE_AUDIENCE=$(VITE_AUDIENCE)
else ifneq ($(AUDIENCE),)
UI_ARGS += VITE_AUDIENCE=$(AUDIENCE)
endif
#
# HOME_IMAGE_URL
ifneq ($(VITE_HOME_IMAGE_URL),)
UI_ARGS += VITE_HOME_IMAGE_URL=$(VITE_HOME_IMAGE_URL)
else ifneq ($(HOME_IMAGE_URL),)
UI_ARGS += VITE_HOME_IMAGE_URL=$(HOME_IMAGE_URL)
endif
#
# BANNER_IMAGE_URL
ifneq ($(VITE_BANNER_IMAGE_URL),)
UI_ARGS += VITE_BANNER_IMAGE_URL=$(VITE_BANNER_IMAGE_URL)
else ifneq ($(BANNER_IMAGE_URL),)
UI_ARGS += VITE_BANNER_IMAGE_URL=$(BANNER_IMAGE_URL)
endif
#
# LOGO_IMAGE_URL
ifneq ($(VITE_LOGO_IMAGE_URL),)
UI_ARGS += VITE_LOGO_IMAGE_URL=$(VITE_LOGO_IMAGE_URL)
else ifneq ($(LOGO_IMAGE_URL),)
UI_ARGS += VITE_LOGO_IMAGE_URL=$(LOGO_IMAGE_URL)
endif
#
# COMPANY_NAME
ifneq ($(VITE_COMPANY_NAME),)
UI_ARGS += VITE_COMPANY_NAME=$(VITE_COMPANY_NAME)
else ifneq ($(COMPANY_NAME),)
UI_ARGS += VITE_COMPANY_NAME=$(COMPANY_NAME)
endif
#
# CUSTOM PAGES
ifneq ($(VITE_CUSTOM_PAGES),)
UI_ARGS += VITE_CUSTOM_PAGES=$(VITE_CUSTOM_PAGES)
else ifneq ($(CUSTOM_PAGES),)
UI_ARGS += VITE_CUSTOM_PAGES=$(CUSTOM_PAGES)
endif
#
# SWAGGER_PREFILL_API_KEY
ifneq ($(VITE_SWAGGER_PREFILL_API_KEY),)
UI_ARGS += VITE_SWAGGER_PREFILL_API_KEY=$(VITE_SWAGGER_PREFILL_API_KEY)
else ifneq ($(SWAGGER_PREFILL_API_KEY),)
UI_ARGS += VITE_SWAGGER_PREFILL_API_KEY=$(SWAGGER_PREFILL_API_KEY)
endif
#
# SWAGGER_PREFILL_OAUTH
ifneq ($(VITE_SWAGGER_PREFILL_OAUTH),)
UI_ARGS += VITE_SWAGGER_PREFILL_OAUTH=$(VITE_SWAGGER_PREFILL_OAUTH)
else ifneq ($(SWAGGER_PREFILL_OAUTH),)
UI_ARGS += VITE_SWAGGER_PREFILL_OAUTH=$(SWAGGER_PREFILL_OAUTH)
endif
#
# SWAGGER_PREFILL_BASIC
ifneq ($(VITE_SWAGGER_PREFILL_BASIC),)
UI_ARGS += VITE_SWAGGER_PREFILL_BASIC=$(VITE_SWAGGER_PREFILL_BASIC)
else ifneq ($(SWAGGER_PREFILL_BASIC),)
UI_ARGS += VITE_SWAGGER_PREFILL_BASIC=$(SWAGGER_PREFILL_BASIC)
endif
#
# DEFAULT_APP_AUTH
ifneq ($(VITE_DEFAULT_APP_AUTH),)
UI_ARGS += VITE_DEFAULT_APP_AUTH=$(VITE_DEFAULT_APP_AUTH)
else ifneq ($(DEFAULT_APP_AUTH),)
UI_ARGS += VITE_DEFAULT_APP_AUTH=$(DEFAULT_APP_AUTH)
endif
# API_PAGE_RELOAD
ifneq ($(VITE_API_PAGE_RELOAD),)
UI_ARGS += VITE_API_PAGE_RELOAD=$(VITE_API_PAGE_RELOAD)
else ifneq ($(API_PAGE_RELOAD),)
UI_ARGS += VITE_API_PAGE_RELOAD=$(API_PAGE_RELOAD)
endif
#----------------------------------------------------------------------------------
# Targets
#----------------------------------------------------------------------------------
.PHONY: clean
clean:
rm -rf $(UI_ROOT_DIR)/node_modules
.PHONY: install-tools
install-tools: update-ui-deps
.PHONY: update-ui-deps
update-ui-deps:
yarn --cwd=$(UI_ROOT_DIR) install
.PHONY: run-ui
run-ui: update-ui-deps
$(UI_ARGS) yarn --cwd=$(UI_ROOT_DIR) start
.PHONY: run-storybook
run-storybook:
$(UI_ARGS) yarn --cwd=$(UI_ROOT_DIR) storybook
.PHONY: build-ui
build-ui: update-ui-deps
$(UI_ARGS) yarn --cwd=$(UI_ROOT_DIR) build
.PHONY: preview-ui
preview-ui: update-ui-deps
$(UI_ARGS) yarn --cwd=$(UI_ROOT_DIR) preview
# # Note: if using the engineering-demos frontend-portal deployment,
# # the built image must be pushed to dockerhub for the deployed image to be
# # updated, if imagePullPolicy=Always
# .PHONY: build-ui-image
# build-ui-image:
# docker build -t $(IMAGE_NAME) . --platform=linux/amd64
.PHONY: lint-ui-code
lint-ui-code: update-ui-deps
yarn tsc --cwd=$(UI_ROOT_DIR) && yarn --cwd=$(UI_ROOT_DIR) lint --max-warnings=0