forked from neos/neos-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
219 lines (173 loc) · 6.9 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
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
################################################################################
#
# 888b 88 88888888888 ,ad8888ba, ad88888ba
# 8888b 88 88 d8"' `"8b d8" "8b
# 88 `8b 88 88 d8' `8b y8,
# 88 `8b 88 88aaaaa 88 88 `y8aaaaa,
# 88 `8b 88 88""""" 88 88 `"""""8b,
# 88 `8b 88 88 y8, ,8p `8b
# 88 `8888 88 y8a. .a8p y8a a8p
# 88 `888 88888888888 `"Y8888Y"' "Y88888P"
#
# <Makefile>
#
# 88 88 88
# 88 88 88
# 88 88 88
# 88 88 88
# 88 88 88
# 88 88 88
# Y8a. .a8P 88
# `"Y8888Y"' 88
#
#
################################################################################
################################################################################
# Make ALL targets phony targets (Rebuild every time)
################################################################################
.PHONY: check-requirements install setup \
build build-watch build-watch-poll build-production \
storybook test test-e2e lint lint-js lint-editorconfig \
called-with-version bump-version publish-npm \
clean
################################################################################
# Variables
################################################################################
# Add alias as there are currently some MacOS problems
# and putting it into the $PATH is simply not enough
editorconfigChecker = ./node_modules/.bin/editorconfig-checker
crossenv = ./node_modules/.bin/crossenv
# Define colors
GREEN := $(shell tput -Txterm setaf 2)
YELLOW := $(shell tput -Txterm setaf 3)
WHITE := $(shell tput -Txterm setaf 7)
RESET := $(shell tput -Txterm sgr0)
################################################################################
# Setup
################################################################################
check-requirements:
@which yarn &>/dev/null || \
(echo yarn is not installed: https://github.com/yarnpkg/yarn && false)
install: ## Install dependencies
yarn install
setup: check-requirements install build ## Run a clean setup
@echo Please remember to set frontendDevelopmentMode \
to true in your Settings.yaml.
@echo
@echo 'Neos:'
@echo ' Neos:'
@echo ' Ui:'
@echo ' frontendDevelopmentMode: true'
################################################################################
# Builds
################################################################################
# TODO: figure out how to pass a parameter to other targets to reduce redundancy
# Builds the subpackages for standalone use.
build-subpackages:
yarn workspaces foreach --parallel --topological-dev run build
make build-react-ui-components-standalone
# we build the react UI components ready for standalone usage;
# so that they can be published on NPM properly.
## Build the react UI components ready for standalone usage.
build-react-ui-components-standalone:
yarn workspace @neos-project/react-ui-components build-standalone-esm
## Runs the development build.
build:
NEOS_BUILD_ROOT=$(shell pwd) node esbuild.js
## Watches the source files for changes and runs a build in case.
build-watch:
NEOS_BUILD_ROOT=$(shell pwd) node esbuild.js --watch
## Watches (and polls) the source files on a file share.
build-watch-poll:
echo "not implemented in esbuild, yet! PR Welcome!"
# clean anything before building for production just to be sure
## Runs the production build. And also builds the subpackages for standalone use.
build-production:
$(cross-env) NODE_ENV=production NEOS_BUILD_ROOT=$(shell pwd) \
node esbuild.js
make build-subpackages
build-e2e-testing:
$(cross-env) NODE_ENV=production NEOS_BUILD_ROOT=$(shell pwd) \
node esbuild.js --e2e-testing
################################################################################
# Code Quality
################################################################################
## Starts the storybook server on port 9001.
storybook:
@mkdir -p ./packages/react-ui-components/node_modules/@neos-project/ && \
ln -s ../../../build-essentials/src \
./packages/react-ui-components/node_modules/@neos-project/build-essentials
yarn workspace @neos-project/react-ui-components start
## Executes the unit test on all source files.
test:
yarn workspaces foreach run test
test-parallel:
yarn workspaces foreach --parallel run test
## Executes integration tests on saucelabs.
test-e2e-saucelabs:
bash Tests/IntegrationTests/e2e.sh "saucelabs:chrome:Windows 10"
## Executes integration tests locally.
test-e2e:
bash Tests/IntegrationTests/e2e.sh chrome
## Executes integration tests locally in a docker-compose setup.
test-e2e-docker: build-e2e-testing
@bash Tests/IntegrationTests/e2e-docker.sh $(or $(browser),chrome)
## Executes make lint-js and make lint-editorconfig.
lint: lint-js lint-editorconfig
lint-parallel: lint-js-parallel lint-editorconfig
## Runs lint test in all subpackages
lint-js:
yarn workspaces foreach run lint
lint-js-parallel:
yarn workspaces foreach --parallel run lint
## Tests if all files respect the .editorconfig.
lint-editorconfig:
# TODO: editorconfig-checker seems broken in node >14
# see https://github.com/editorconfig-checker/editorconfig-checker/issues/178
# $(editorconfigChecker) -config .ecrc.json
################################################################################
# Releasing
################################################################################
called-with-version:
ifeq ($(VERSION),)
@echo No version information given.
@echo Please run this command like this:
@echo VERSION=1.0.0 make bump-version
@false
endif
bump-version: called-with-version
yarn workspaces foreach version $(VERSION) --deferred
yarn version apply --all
publish-npm: called-with-version
yarn workspaces foreach --no-private npm publish --access public
################################################################################
# Misc
################################################################################
## Cleans dependency folders
clean:
rm -Rf node_modules; rm -rf packages/*/node_modules
################################################################################
# help command as default
################################################################################
# define indention for descriptions
TARGET_MAX_CHAR_NUM=40
## Show help
help:
@echo ''
@echo '${GREEN}CLI command list of neos-ui:${RESET}'
@echo ''
@echo 'Usage:'
@echo ' ${YELLOW}make${RESET} ${GREEN}<target>${RESET}'
@echo ''
@echo 'Targets:'
@awk '/^[a-zA-Z0-9_-]+:/ { \
helpMessage = match(lastLine, /^## (.*)/); \
if (helpMessage) { \
helpCommand = substr($$1, 0, index($$1, ":")-1); \
helpMessage = substr(lastLine, RSTART + 3, RLENGTH); \
printf " ${YELLOW}%-$(TARGET_MAX_CHAR_NUM)s${RESET} ${GREEN}%s${RESET}\n", helpCommand, helpMessage; \
} \
} \
{ lastLine = $$0 }' $(MAKEFILE_LIST)
@echo ''
.DEFAULT_GOAL := help