-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
94 lines (69 loc) · 2.06 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
.PHONY: install run build format bundle purge
# Set default env as develop if ENV is not specified.
ENV ?= develop
# Define GIT_REVISION and GIT_TAG or provide default values.
GIT_REVISION ?= default_revision
GIT_TAG ?= default_tag
# Define the YARN command with environment variables.
YARN := REACT_APP_GIT_REVISION=$(GIT_REVISION) REACT_APP_GIT_TAG=$(GIT_TAG) yarn
# Common dependencies for run and build.
COMMON_DEPS := install
# Define the DOCKER command.
DOCKER := docker
# Define the DOCKER image and container name.
IMAGE_NAME := react-employee-management
CONTAINER_NAME := docker-employee-management
# Defined DOCKER target volume (Must be the same with WORKDIR in Dockerfile)
TARGET = "/app"
# Docker commands
build-image:
@$(DOCKER) build -t $(CONTAINER_NAME) .
run-container:
@$(DOCKER) run -d -p 3000:3000 --name $(CONTAINER_NAME) --mount type=bind,source="$(CURDIR)",target="$(TARGET)" $(CONTAINER_NAME)
start-container:
@$(DOCKER) start $(CONTAINER_NAME)
stop-container:
@$(DOCKER) stop $(CONTAINER_NAME)
# Yarn commands
install:
@echo "Installing dependencies..."
@$(YARN) install --frozen-lockfile || (echo "Error: Failed to install dependencies."; exit 1)
run: $(COMMON_DEPS)
@echo "Starting the application..."
@$(YARN) dev
build: $(COMMON_DEPS)
@echo "Building the application..."
@NODE_OPTIONS="--max-old-space-size=16384" $(YARN) build
preview:
@echo "Preview the application build..."
@$(YARN) preview
preview-production:
@echo "Preview the application build for production environment..."
@$(YARN) preview:production
purge:
@echo "Removing node_modules..."
@rm -Rf ./node_modules
format:
@echo "Formatting code..."
@$(YARN) format
run-lint:
@echo "Running lint..."
@$(YARN) lint
lint-fix:
@echo "Fixing lint issues..."
@$(YARN) lint:fix
check-types:
@echo "Checking types..."
@$(YARN) check-types
test:
@echo "Running unit test..."
@$(YARN) test
test-e2e:
@echo "Running e2e test..."
@$(YARN) test:e2e
test-e2e-ui:
@echo "Running e2e test with UI..."
@$(YARN) test:e2e:ui
storybook:
@echo "Running storybook..."
@$(YARN) storybook