-
Notifications
You must be signed in to change notification settings - Fork 471
/
Makefile
62 lines (50 loc) · 2.02 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
all: copy-bundle build-loader
.PHONY: all
# build the application bundle
WEB_UI_DIR := ../lex-web-ui
WEB_UI_SRC_FILES := $(shell git ls-files $(WEB_UI_DIR)/src)
WEB_UI_BUNDLE_DIR := $(WEB_UI_DIR)/dist/bundle
LIBRARY_SRC_FILES := $(wildcard $(WEB_UI_BUNDLE_DIR)/lex-web-ui.*)
LIBRARY_SRC_FILES += $(wildcard $(WEB_UI_BUNDLE_DIR)/*-worker.*)
LIBRARY_FILES := $(patsubst $(WEB_UI_BUNDLE_DIR)/%,%,$(LIBRARY_SRC_FILES))
# build the application bundle
$(LIBRARY_SRC_FILES): $(WEB_UI_SRC_FILES)
@echo "[INFO] Building from dir [$(WEB_UI_DIR)]"
cd $(WEB_UI_DIR) && npm run build-dist
# copy library files to dist dir
$(LIBRARY_FILES): $(LIBRARY_SRC_FILES)
@echo "[INFO] Copying library files"
cp $(?) .
copy-bundle: $(LIBRARY_SRC_FILES) $(LIBRARY_FILES)
# copy website bot loader files from source to dist dir
SRC_DIR := ../src
LOADER_SRC_DIR := $(SRC_DIR)/lex-web-ui-loader
LOADER_SRC_DEPENDENCIES := $(wildcard $(SRC_DIR)/dependencies/*.*)
LOADER_SRC_JS_FILES := \
$(wildcard $(LOADER_SRC_DIR)/js/*.js) \
$(wildcard $(LOADER_SRC_DIR)/lib/*.js)
LOADER_SRC_CSS_FILES := $(wildcard $(LOADER_SRC_DIR)/css/*.css)
LOADER_SRC_FILES := $(LOADER_SRC_JS_FILES) $(LOADER_SRC_CSS_FILES)
LOADER_SRC_BASE_NAME := lex-web-ui-loader
LOADER_TARGET_PROD_FILES := \
$(LOADER_SRC_BASE_NAME).min.js \
$(LOADER_SRC_BASE_NAME).min.js.map \
$(LOADER_SRC_BASE_NAME).min.css \
$(LOADER_SRC_BASE_NAME).min.css.map
LOADER_TARGET_DEV_FILES := $(subst .min,,$(LOADER_TARGET_PROD_FILES))
$(LOADER_TARGET_PROD_FILES): $(LOADER_SRC_FILES)
@echo "[INFO] building loader prod library files"
npm run build-prod
build-loader-prod: $(LOADER_TARGET_PROD_FILES)
$(LOADER_TARGET_DEV_FILES): $(LOADER_SRC_FILES)
@echo "[INFO] building loader dev library files"
npm run build-dev
build-loader-dev: $(LOADER_TARGET_DEV_FILES)
# copy dependency files to dist dir
copy-dependencies: $(LOADER_SRC_DEPENDENCIES)
@echo "[INFO] Copying library files"
cp $(?) .
build-loader: build-loader-dev build-loader-prod copy-dependencies
clean:
-rm -f ./*.{css,js,json,html,map,yml,zip}
.PHONY: clean