-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile
executable file
·164 lines (130 loc) · 5.16 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
MAKEFLAGS += --no-print-directory
SOURCES = packages
DIR = $(shell pwd)
########################################################################################################################
#
# HELP
#
########################################################################################################################
# COLORS
RED = $(shell printf "\33[31m")
GREEN = $(shell printf "\33[32m")
WHITE = $(shell printf "\33[37m")
YELLOW = $(shell printf "\33[33m")
RESET = $(shell printf "\33[0m")
# Add the following 'help' target to your Makefile
# And add help text after each target name starting with '\#\#'
# A category can be added with @category
HELP_HELPER = \
%help; \
while(<>) { push @{$$help{$$2 // 'options'}}, [$$1, $$3] if /^([a-zA-Z\-\%]+)\s*:.*\#\#(?:@([0-9]+\s[a-zA-Z\-\%_]+))?\s(.*)$$/ }; \
print "usage: make [target]\n\n"; \
for (sort keys %help) { \
print "${WHITE}$$_:${RESET}\n"; \
for (@{$$help{$$_}}) { \
$$sep = " " x (32 - length $$_->[0]); \
print " ${YELLOW}$$_->[0]${RESET}$$sep${GREEN}$$_->[1]${RESET}\n"; \
}; \
print "\n"; }
help: ##prints help
@perl -e '$(HELP_HELPER)' $(MAKEFILE_LIST)
.DEFAULT_GOAL := help
########################################################################################################################
#
# GLOBAL
#
########################################################################################################################
init: ##@1 Global init project before start after each pull
${MAKE} clean
${MAKE} install
${MAKE} build
clean: ##@1 Global uninstall node modules, remove transpiled code & lock files
@rm -rf ./node_modules
@rm -rf ./package-lock.json
@find ./packages -type d -maxdepth 1 ! -path ./packages \
| sed 's|^./packages/||' \
| xargs -I '{}' sh -c '$(MAKE) clean-{}'
clean-%:
@rm -rf ./packages/${*}/dist
@rm -rf ./packages/${*}/node_modules
@rm -rf ./packages/${*}/package-lock.json
@rm -rf ./packages/${*}/yarn.lock
install: ##@1 Global yarn install all packages
@echo "${YELLOW}Running yarn install${RESET}"
@yarn install
@find ./packages -type d -maxdepth 1 ! -path ./packages \
| sed 's|^./packages/||' \
| xargs -I '{}' sh -c '$(MAKE) add-dist-folders-{}'
@echo "${YELLOW}Running lerna bootstrap${RESET}"
@./node_modules/.bin/lerna bootstrap
add-dist-folders-%:
@mkdir -p ./packages/${*}/dist
########################################################################################################################
#
# BUILD Operations
#
########################################################################################################################
build: ##@4 Build build all packages
${MAKE} build-vue
build-%: ##@4 Build build a specific package
@echo "${YELLOW}Building package ${WHITE}${*}${RESET}"
@export NODE_ENV=production; cd ./packages/${*} && yarn build
bw: ##@4 Build parallels build:watch all
@export NODE_ENV=development
@./node_modules/.bin/lerna run build:watch --parallel
bw-%: ##@2 Build build:watch specific package
@export PACKAGE=${*}; cd ./packages/${*} && yarn build:watch
########################################################################################################################
#
# Publish Operations
#
########################################################################################################################
commit-changes:
@git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
@git config user.name "${GITHUB_ACTOR}"
@git add .
@git commit -m "Add generated files" || true
move-package-json-to-dist:
@find ./packages -type d -maxdepth 1 ! -path ./packages \
| sed 's|^./packages/||' \
| xargs -I '{}' sh -c 'node scripts/move-package-json-to-dist.js ./packages/{}'
prerelease-version-upgrade-%:
@find ./packages -type d -maxdepth 1 ! -path ./packages \
| sed 's|^./packages/||' \
| xargs -I '{}' sh -c 'node scripts/update-prerelease-version.js "./packages/{}" "${*}"'
update-version:
@find ./packages -type d -maxdepth 1 ! -path ./packages \
| sed 's|^./packages/||' \
| xargs -I '{}' sh -c 'node scripts/update-entry.js ./packages/{}'
########################################################################################################################
#
# Helpers Operations
#
########################################################################################################################
commit:
@node ./scripts/commit.js
pretty:
@yarn prettier-hook
demo:
cd ./packages/demo-saas && yarn serve
publish-packages-next:
@make publish-package-next-vue
@make publish-package-next-nuxt
publish-package-next-%:
@cp ./.npmrc "./packages/${*}/.npmrc"
@cp ./.npmignore "./packages/${*}/.npmignore"
@cd "./packages/${*}" && npm publish --tag next
publish-packages-alpha:
@make publish-package-alpha-vue
@make publish-package-alpha-nuxt
publish-package-alpha-%:
@cp ./.npmrc "./packages/${*}/.npmrc"
@cp ./.npmignore "./packages/${*}/.npmignore"
@cd "./packages/${*}" && npm publish --tag alpha
publish-packages:
@make publish-package-latest-vue
@make publish-package-latest-nuxt
publish-package-latest-%:
@cp ./.npmrc "./packages/${*}/.npmrc"
@cp ./.npmignore "./packages/${*}/.npmignore"
@cd "./packages/${*}" && npm publish --tag latest