-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
82 lines (60 loc) · 1.61 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
_IS_YARN_INSTALLED := $(shell which yarn)
# If yarn is installed, use it to install dependencies
ifeq (, $(_IS_YARN_INSTALLED))
PM := npm run
else
PM := yarn
endif
# Prettify the output when lolcat is installed
_CAN_PRETTY := $(shell which lolcat)
ifeq (, $(_CAN_PRETTY))
COLOR =
else
COLOR = |lolcat
endif
all: .output
@ echo "All done!" $(COLOR)
# Create production build
.output: node_modules
@ $(PM) build
# UTILS ------------------------------------------------------------------
# Live development server
dev: node_modules
@ $(PM) dev
# Production build
build: .output
# Run production preview
preview: build
@ $(PM) preview
# Pre-render production as static HTML
gen: build
@ $(PM) generate
# Run linter
lint: node_modules
@ $(PM) lint
# Install dependencies
node_modules:
@ $(PM) install > /dev/null
@ echo "Installed node_modules" $(COLOR)
# CLEANING ---------------------------------------------------------------
# Remove production build files
clean:
@ rm -rf .output dist
@ echo "clean done!" $(COLOR)
# Remove dependencies
fclean: clean
@ rm -rf node_modules .nuxt .vite
@ echo "fclean done!" $(COLOR)
# OTHER ------------------------------------------------------------------
local: gen
rm -rf /srv/http/public/*
cp -R .output/public/* /srv/http/public/
@ echo ">>> http://localhost" $(COLOR)
# Remove dependencies lock
dep-unlock: fclean
@ rm -rf *.lock *-lock.json
@ echo "Unlocked dependencies!" $(COLOR)
# Force clean install of dependencies & configs
reinstall: fclean node_modules
@ echo "reinstall done!" $(COLOR)
.PHONY: all dev build preview gen lint clean fclean reset preview