-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
75 lines (58 loc) · 1.89 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
ModulePrefix:=wener-apis
# Keep file
.PRECIOUS: public/modules/$(ModulePrefix)-%.system.js
# eval $$
.SECONDEXPANSION:
.PHONEY: always
SHELL:=/bin/bash
# all modules
# ls src/modules/*/index.ts | egrep -o '[^/]*/index' | egrep -o '^[^/]*'
# ls src/modules/*/index.ts | egrep -o '[^/]*/index' | egrep -o '^[^/]*' | paste -sd ',' -
MODULES:=$(shell ls src/modules/*/index.ts | egrep -o '[^/]*/index' | egrep -o '^[^/]*' | paste -sd ' ' -)
empty:=
space:= $(empty) $(empty)
comma:= ,
mod-dev:
pnpm exec rollup -c rollup.mod.ts --watch
# pre build
make-%: always
-$(MAKE) -f src/modules/$*/Makefile build
## 如果文件存在才执行
#ifneq (,$(wildcard src/modules/$*/Makefile))
# $(MAKE) -f src/modules/$*/Makefile build
#else
# @echo Skip - no makefile $(wildcard src/modules/$*/Makefile)
#endif
modules-pre: $(addprefix make-,$(MODULES))
modules: modules-pre
@echo Building all modules $(MODULES)
NODE_ENV=production MOD_NAME="$(subst $(space),$(comma),${MODULES})" pnpm exec rollup -c rollup.mod.ts
build-%: public/modules/$(ModulePrefix)-%.system.js
@echo Done build
public/modules/$(ModulePrefix)-%.system.js: $$(shell find src/modules/% -type f -name '*.ts' -o -name '*.tsx')
MOD_NAME=$* pnpm exec rollup -c rollup.mod.ts
clean-%:
rm -rfv public/modules/$(ModulePrefix)-$**
clean:
rm -rfv public/modules/$(ModulePrefix)*
always:
calc:
npx esbuild src/apps/calc/index.ts --outfile=out/apps/calc.js --bundle --minify --sourcemap --target=chrome80 --define:process.env.NODE_ENV=\"production\" --external:react
# --target=chrome58,firefox57,safari11,edge16
postinstall:
npm link ../ui
build: always
npx next build
# tsc --project tsconfig.server.json && yarn run gen && next build
now-build:
npm run build
npm run set-platform NOW
dev:
npm run dev
lint:
npx eslint src --ext .ts,.tsx
fmt:
npx prettier -w src --loglevel warn
fix:
npx prettier -w src --loglevel warn
npx eslint src --fix --ext .ts,.tsx