Repository navigation
Expand file tree
/
Copy pathTaskfile.yml
More file actions
206 lines (181 loc) · 5.41 KB
/
Copy pathTaskfile.yml
File metadata and controls
206 lines (181 loc) · 5.41 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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
version: "3"
vars:
# All available variants
VARIANTS: architecture idp mcp gitops jit kitchen-sink security poc-eval billing
# Default variants for build:datasheet (matches original npm script)
DEFAULT_VARIANTS: idp mcp gitops jit
# Directories
DIST_DIR: ./dist
PDF_OUTPUT_DIR: ../../../static/pdfs
CLI_NPM_PACKAGE_DIR: "{{.ROOT_DIR}}/.tmp/facet-cli"
CLI_VERSION:
sh: node -p "require('./cli/package.json').version"
BINARY_EXT: '{{if eq OS "windows"}}.exe{{end}}'
FACET_BINARY: "{{.DIST_DIR}}/facet{{.BINARY_EXT}}"
# Lab deployment
APP_NAME: facet
CHART_DIR: chart
LAB_CONTEXT: k3s
LAB_NAMESPACE: facet
LAB_REGISTRY: docker.c0a801af.sslip.io
LAB_COMMIT:
sh: git rev-parse --short=8 HEAD
LAB_VERSION:
sh: printf '%s-%s\n' "$(git describe --tags --always --dirty --abbrev=8)" "$(date -u +%Y%m%d%H%M%S)" | tr '/' '-'
# Source patterns for watching and dependency tracking
SRC_PATTERN: src/**/*.{tsx,ts,jsx,js,css,mdx}
ASSETS_PATTERN: assets/**/*
STYLES_FILE: styles.css
tasks:
# ============================================================================
# Base Tasks (Parameterized)
# ============================================================================
clean:
desc: "Clean build outputs"
cmds:
- rm -rf {{.DIST_DIR}}
- mkdir -p {{.DIST_DIR}}
build:
sources:
- Taskfile.yml
- package.json
- pnpm-lock.yaml
- openapi.yaml
- postcss.config.js
- tailwind.config.js
- tsconfig.json
- tsconfig.lib.json
- vite.lib.config.ts
- vite.playground.config.ts
- src/**/*
- cli/package.json
- cli/pnpm-lock.yaml
- cli/scripts/**/*
- cli/src/**/*
- cli/tsconfig.json
- cli/tsdown.config.ts
- cli/tsdown.sea.config.ts
generates:
- "{{.FACET_BINARY}}"
cmds:
- pnpm run build
- pnpm run build:binary
build:npm-cli:
desc: "Build the local @flanksource/facet-cli npm package"
cmds:
- pnpm run build
- pnpm --dir cli run build:bundle
- node cli/scripts/pack-npm-cli.cjs "{{.CLI_VERSION}}" "{{.CLI_NPM_PACKAGE_DIR}}"
install:
desc: "Build and globally install the local @flanksource/facet-cli package, replacing the active facet executable"
deps:
- build:npm-cli
cmds:
- npm install --global --force --install-links "{{.CLI_NPM_PACKAGE_DIR}}"
- ln -sf "$(npm root --global)/@flanksource/facet-cli/facet.cjs" "$(which facet)"
install:symlink:
desc: "Globally link the local Facet CLI and component library to this checkout"
deps:
- build:npm-cli
cmds:
- task: install:symlink:library
- task: install:symlink:cli
- ln -sf "$(npm root --global)/@flanksource/facet-cli/facet.cjs" "$(which facet)"
install:symlink:library:
internal: true
dir: "{{.ROOT_DIR}}"
cmds:
- npm link
install:symlink:cli:
internal: true
dir: "{{.CLI_NPM_PACKAGE_DIR}}"
cmds:
- npm link
storybook:
desc: "Run Storybook development server on port 6006"
cmds:
- pnpm run storybook
storybook:build:
desc: "Build static Storybook for deployment"
cmds:
- pnpm run build-storybook
test:
deps:
- test:unit
- test:components
# - test:storybook
lint:
desc: "Typecheck the CLI"
dir: cli
cmds:
- pnpm run lint
gen-version:
desc: "Generate cli/src/version-generated.ts"
dir: cli
cmds:
- node scripts/gen-version.cjs
generates:
- src/version-generated.ts
test:unit:
desc: "Run cli unit tests with vitest"
dir: cli
deps:
- build
cmds:
- pnpm exec vitest run
test:components:
desc: "Run component package unit tests with vitest"
cmds:
- pnpm exec vitest run
test:storybook:
desc: "Build Storybook and verify all stories load without errors"
cmds:
- pnpm run build-storybook
- echo "✓ Storybook build completed successfully"
- echo "✓ All stories compiled without errors"
serve:
desc: "Build and start the playground server"
deps:
- build
cmds:
- "{{.FACET_BINARY}} serve --templates-dir examples"
image:lab:
desc: "Build and push the linux/amd64 Facet image to the lab registry"
cmds:
- >-
docker build
--platform linux/amd64
--build-arg VERSION={{.LAB_VERSION}}
--build-arg GIT_COMMIT={{.LAB_COMMIT}}
--tag {{.LAB_REGISTRY}}/{{.APP_NAME}}:{{.LAB_VERSION}}
.
- docker push {{.LAB_REGISTRY}}/{{.APP_NAME}}:{{.LAB_VERSION}}
deploy:lab:
desc: "Build, push, and deploy Facet to the lab"
vars:
DEPLOY_VERSION: "{{.LAB_VERSION}}"
cmds:
- task: image:lab
vars:
LAB_VERSION: "{{.DEPLOY_VERSION}}"
- >-
helm upgrade --install {{.APP_NAME}} {{.CHART_DIR}}
--kube-context {{.LAB_CONTEXT}}
--namespace {{.LAB_NAMESPACE}}
--create-namespace
--values {{.CHART_DIR}}/values.lab.yaml
--set-string image.repository={{.LAB_REGISTRY}}/{{.APP_NAME}}
--set-string image.tag={{.DEPLOY_VERSION}}
--set-string image.pullPolicy=Always
--rollback-on-failure
--wait
--timeout 10m
- >-
kubectl --context {{.LAB_CONTEXT}}
rollout status deployment/{{.APP_NAME}}
--namespace {{.LAB_NAMESPACE}}
--timeout 5m
default:
desc: "Show available tasks"
cmds:
- task --list