-
Notifications
You must be signed in to change notification settings - Fork 0
/
Taskfile.yml
68 lines (60 loc) · 1.65 KB
/
Taskfile.yml
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
version: "3"
set: [pipefail, errexit, nounset]
vars:
HOST: '{{ .HOST | default "localhost" }}'
PORT: '{{ .PORT | default "5000" }}'
requires:
vars:
- WSBRIDGE_URL
- WSBRIDGE_NUMBER_SELF
- WSBRIDGE_NUMBER_SERVER
tasks:
default:
deps: [dev]
dev:
deps: [node_modules, generate-ts-proto]
env:
VITE_WSBRIDGE_URL: "{{ .WSBRIDGE_URL }}"
VITE_WSBRIDGE_NUMBER_SELF: "{{ .WSBRIDGE_NUMBER_SELF }}"
VITE_WSBRIDGE_NUMBER_SERVER: "{{ .WSBRIDGE_NUMBER_SERVER }}"
cmds:
- env | grep ^VITE_
- vite --clearScreen=false --host="$HOST" --port="$PORT"
build:
deps: [node_modules, generate-ts-proto]
env:
VITE_WSBRIDGE_URL: "{{ .WSBRIDGE_URL }}"
VITE_WSBRIDGE_NUMBER_SELF: "{{ .WSBRIDGE_NUMBER_SELF }}"
VITE_WSBRIDGE_NUMBER_SERVER: "{{ .WSBRIDGE_NUMBER_SERVER }}"
cmds:
- vite build
generate-ts-proto:
watch: true
requires:
vars: [PROTO_PATH]
status:
- grep -q "$PROTO_PATH" "$TASK_TEMP_DIR"/proto_path
deps: [node_modules]
cmds:
- for:
var: PROTO_PATH
split: ":"
cmd: |
protoc -I={{ shellQuote .ITEM }} \
--plugin=node_modules/.bin/protoc-gen-ts_proto \
--ts_proto_opt=esModuleInterop=true \
--ts_proto_opt=importSuffix=.js \
--ts_proto_out=src/lib/proto \
{{ shellQuote .ITEM }}/*.proto
- prettier -w src/lib/proto
- echo "$PROTO_PATH" > "$TASK_TEMP_DIR"/proto_path
generates:
- src/lib/proto/*.ts
node_modules:
cmds:
- npm install
sources:
- package.json
- package-lock.json
generates:
- node_modules