Repository navigation
Expand file tree
/
Copy pathTaskfile.yml
More file actions
145 lines (124 loc) · 4.92 KB
/
Copy pathTaskfile.yml
File metadata and controls
145 lines (124 loc) · 4.92 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
version: '3'
# Loads CLOUDFLARE_API_TOKEN (and anything else) from a local .env that
# is gitignored. Copy .env.example -> .env and fill the token. Missing
# file is fine for tasks that don't need it.
dotenv: ['.env']
# SQL Schema Visualizer — pnpm workspace monorepo
# packages/core @khanakia/sql-schema-core parser, layout, share codec (pure TS)
# packages/react @khanakia/sql-schema-react composable React components
# apps/web the GitHub Pages app (bundles @khanakia/sql-schema-* from source)
#
# Run `task` (or `task --list`) to see everything.
tasks:
default:
desc: List all tasks
cmds:
- task --list
silent: true
setup:
desc: Install all workspace dependencies (pnpm)
cmds:
- pnpm install
dev:
desc: Run the web app dev server (HMR across packages)
cmds:
- pnpm --filter @khanakia/sql-schema-web dev
build:
desc: Build libraries then the web app
cmds:
- pnpm run build
build:libs:
desc: Build @khanakia/sql-schema-core + @khanakia/sql-schema-react (tsup → ESM + d.ts)
cmds:
- pnpm run build:libs
build:web:
desc: Build only the web app
cmds:
- pnpm --filter @khanakia/sql-schema-web build
preview:
desc: Serve the production web build locally
cmds:
- pnpm --filter @khanakia/sql-schema-web preview
test:
desc: Run unit tests (@khanakia/sql-schema-core, Vitest)
cmds:
- pnpm test
test:watch:
desc: Unit tests in watch mode
cmds:
- pnpm --filter @khanakia/sql-schema-core exec vitest
typecheck:
desc: Typecheck every package
cmds:
- pnpm -r typecheck
routes:
desc: Regenerate the TanStack route tree for the app
dir: apps/web
cmds:
- pnpm exec tsr generate
check:
desc: Full pre-push gate — typecheck + test + build
cmds:
- task: typecheck
- task: test
- task: build
changeset:
desc: Record a change for the next release (interactive)
cmds:
- pnpm changeset
release:status:
desc: Show the latest Release (changesets) workflow runs
cmds:
- gh run list --workflow=release.yml --limit 5
publish:local:
desc: Manual local publish fallback (requires `npm login` to @khanakia)
cmds:
- pnpm run build:libs
- pnpm changeset publish
deploy:status:
desc: Show the latest GitHub Pages deploy run
cmds:
- gh run list --workflow=deploy.yml --limit 5
# WHY build:cf (not plain build): the app is served at
# khanakia.com/apps/sql-schema-visualizer/ via the edge gateway, which
# forwards the path UNCHANGED (no rewriting). So the origin must serve
# at exactly /apps/sql-schema-visualizer/. Vite `base` makes assets
# absolute under that path, and build:cf physically nests the output
# under dist-cf/apps/sql-schema-visualizer/ so the file layout matches
# the URL. Plain `build` outputs at the root → blank page through the
# gateway. See docsi/DEPLOY-CLOUDFLARE.md.
build:cf:
desc: Build the web app + nest output under dist-cf/apps/sql-schema-visualizer/ (Cloudflare)
cmds:
- pnpm --filter @khanakia/sql-schema-web build:cf
# WHY this task exists: turns the multi-step manual deploy (cd, export
# token, build:cf, wrangler deploy from the right dir) into one
# `task deploy:cf`. Each piece:
# - dotenv loads CLOUDFLARE_API_TOKEN from .env (gitignored) so the
# token never lives in shell history or the Taskfile. The token is
# account-scoped (aman@khanakia.com) so it deploys to the correct
# Cloudflare account regardless of browser login — that's why we
# use a token, not `wrangler login` (which grabs whatever account
# the browser is on; this repo's owner has two).
# - precondition: fail fast with a clear message instead of letting
# wrangler emit a confusing auth error when the token is missing.
# - build:cf MUST run before deploy (wrangler uploads dist-cf/); run
# it from repo root via --dir ../.. because pnpm workspace filters
# resolve from the workspace root, but `dir: apps/web` is required
# for `wrangler deploy` since wrangler.jsonc lives there.
# - final echo: the verify curl, so a green deploy is actually
# confirmed reachable, not just uploaded.
deploy:cf:
desc: Build + deploy the app to Cloudflare Workers Static Assets (token from .env)
dir: apps/web
preconditions:
- sh: '[ -n "$CLOUDFLARE_API_TOKEN" ]'
msg: "CLOUDFLARE_API_TOKEN not set. Copy .env.example -> .env and add the aman@khanakia.com 'Edit Cloudflare Workers' token."
cmds:
- pnpm --dir ../.. --filter @khanakia/sql-schema-web build:cf
- npx wrangler deploy
- 'echo "Deployed. Verify: curl -sI https://sql-schema-visualizer.aman-f4d.workers.dev/apps/sql-schema-visualizer/ | head -1"'
clean:
desc: Remove build output and all node_modules
cmds:
- rm -rf packages/*/dist apps/*/dist node_modules packages/*/node_modules apps/*/node_modules