-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaskfile.yml
More file actions
159 lines (136 loc) · 3.85 KB
/
Taskfile.yml
File metadata and controls
159 lines (136 loc) · 3.85 KB
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
# https://taskfile.dev
version: "3"
tasks:
# gqlkit-sdl tasks (schema introspection fetcher)
gqlkit-sdl:run:
desc: Run gqlkit-sdl module
dir: ./gqlkit-sdl
cmds:
- go run .
gqlkit-sdl:build:
desc: Build gqlkit-sdl module
dir: ./gqlkit-sdl
cmds:
- go build -o ../bin/gqlkit-sdl .
# mockapi tasks (gqlgen-based test GraphQL API)
mockapi:run:
desc: Run mockapi GraphQL server
dir: ./mockapi
cmds:
- go run ./server.go
mockapi:build:
desc: Build mockapi server binary
dir: ./mockapi
cmds:
- go build -o ../bin/mockapi ./server.go
mockapi:generate:
desc: Regenerate gqlgen code for mockapi (uses GOWORK=off)
dir: ./mockapi
cmds:
- GOWORK=off go run github.com/99designs/gqlgen@v0.17.87 generate
# gqlkit-ts tasks (TypeScript runtime library)
gqlkit-ts:install:
desc: Install gqlkit-ts npm dependencies
dir: ./gqlkit-ts
cmds:
- npm install
gqlkit-ts:build:
desc: Build gqlkit-ts TypeScript runtime library
dir: ./gqlkit-ts
cmds:
- npm run build
gqlkit-ts:setup:
desc: Install and build gqlkit-ts
cmds:
- task: gqlkit-ts:install
- task: gqlkit-ts:build
# example-go-mockapi tasks (Go SDK from test API)
example-go-mockapi:fetch-schema:
desc: Fetch schema from mockapi via gqlkit-sdl
dir: .
cmds:
- go run ./gqlkit-sdl fetch --url http://localhost:8081/query --output example-go-mockapi/cmd/generate/schema.graphql
example-go-mockapi:generate:
desc: Generate Go SDK for mockapi schema
dir: ./example-go-mockapi
cmds:
- go run ./cmd/generate
example-go-mockapi:run:
desc: Run Go sample queries against mockapi
dir: ./example-go-mockapi
cmds:
- go run ./cmd/samples
# example-ts tasks (TypeScript SDK generator)
example-ts:install:
desc: Install example-ts npm dependencies
dir: ./example-ts
cmds:
- npm install
example-ts:generate:
desc: Generate TypeScript SDK from schema
dir: ./example-ts
cmds:
- go run ./cmd/generate
example-ts:generate:clean:
desc: Clean and regenerate TypeScript SDK
dir: ./example-ts
cmds:
- rm -rf sdk
- go run ./cmd/generate
example-ts:typecheck:
desc: TypeScript type-check the generated SDK and samples
dir: ./example-ts
cmds:
- npx tsc --noEmit
example-ts:build:
desc: Build the Go TS generator binary
dir: ./example-ts
cmds:
- go build ./cmd/generate/
example-ts:run:
desc: Run TypeScript sample queries (requires mockapi running)
dir: ./example-ts
cmds:
- npm run samples
example-ts:test:
desc: Full test — build generator, clean generate SDK, type-check
dir: ./example-ts
cmds:
- go build ./cmd/generate/
- go vet ./cmd/generate/
- rm -rf sdk
- go run ./cmd/generate
- npx tsc --noEmit
- echo "All checks passed."
example-ts:setup:
desc: First-time setup — build runtime, install deps, generate, type-check
cmds:
- task: gqlkit-ts:setup
- task: example-ts:install
- task: example-ts:generate
- task: example-ts:typecheck
# Workspace tasks
build:
desc: Build all modules
cmds:
- mkdir -p bin
- task: gqlkit-sdl:build
- task: mockapi:build
tidy:
desc: Run go mod tidy on all modules
cmds:
- |
set -ex
for d in $(sed -n '/^use *(/,/^)/p' go.work | tail -n +2 | sed '$d' | sed 's/^[ \t]*//; s/[ \t]*$//'); do
echo ">> Tidying '$d'"
(cd "$d" && go mod tidy)
done
upgrade:
desc: Update all go modules in go.work
cmds:
- |
set -ex
for d in $(sed -n '/^use *(/,/^)/p' go.work | tail -n +2 | sed '$d' | sed 's/^[ \t]*//; s/[ \t]*$//'); do
echo ">> Updating '$d'"
(cd "$d" && go get -u ./... && go mod tidy)
done