-
-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathTaskfile.yml
More file actions
251 lines (251 loc) · 9.5 KB
/
Taskfile.yml
File metadata and controls
251 lines (251 loc) · 9.5 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
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
# yaml-language-server: $schema=https://taskfile.dev/schema.json
version: "3"
vars:
INCOMPATIBLE: '{{.INCOMPATIBLE | default "false"}}'
UPGRADE_INCOMPAT_FLAG: '{{if eq .INCOMPATIBLE "true"}}--incompatible{{end}}'
MACOSX_DEPLOYMENT_TARGET: "11.0"
FLATPAK_MANIFEST: "packaging/flatpak/io.balatro.ModManager.json"
FLATPAK_REPO: "repo"
FLATPAK_BUILD_DIR: "build-dir"
FLATPAK_BUNDLE: "balatro-mod-manager.flatpak"
FLATPAK_APP_ID: "io.balatro.ModManager"
tasks:
debug:
desc: Start development (desktop)
aliases: [dev]
preconditions:
- sh: command -v cargo >/dev/null 2>&1
msg: "Rust toolchain (cargo) is required"
- sh: command -v bun >/dev/null 2>&1
msg: "Bun is required (used by SvelteKit dev)"
cmds:
- cmd: cargo tauri dev
dev:web:
desc: Start web-only dev server (Vite)
preconditions:
- sh: command -v bun >/dev/null 2>&1
msg: "Bun is required"
cmds:
- cmd: bun run dev
default:
- task: debug
release:
desc: Platform-appropriate release build (delegates by platform)
cmds:
- task: release-macos
vars:
ARCH: '{{.ARCH | default "universal"}}'
- task: release-windows
- task: release-linux
release-macos:
desc: Universal macOS build (Darwin)
platforms: [darwin]
env:
MACOSX_DEPLOYMENT_TARGET: "{{.MACOSX_DEPLOYMENT_TARGET}}"
preconditions:
- sh: 'case "${ARCH:-universal}" in universal|arm64|x86_64) ;; *) exit 1;; esac'
msg: "ARCH must be one of: universal, arm64, x86_64 (e.g., task release-macos ARCH=arm64)"
- sh: 'test "${ARCH:-universal}" != "arm64" || rustup target list --installed | grep -q "^aarch64-apple-darwin$"'
msg: "Install target: rustup target add aarch64-apple-darwin"
- sh: 'test "${ARCH:-universal}" != "x86_64" || rustup target list --installed | grep -q "^x86_64-apple-darwin$"'
msg: "Install target: rustup target add x86_64-apple-darwin"
- sh: 'test "${ARCH:-universal}" != "universal" || (rustup target list --installed | grep -q "^aarch64-apple-darwin$" && rustup target list --installed | grep -q "^x86_64-apple-darwin$")'
msg: "Install both targets: rustup target add aarch64-apple-darwin x86_64-apple-darwin"
cmds:
- cmd: |
case "${ARCH:-universal}" in
universal) TARGET="universal-apple-darwin" ;;
arm64) TARGET="aarch64-apple-darwin" ;;
x86_64) TARGET="x86_64-apple-darwin" ;;
esac
MACOSX_DEPLOYMENT_TARGET={{.MACOSX_DEPLOYMENT_TARGET}} cargo tauri build --target "$TARGET" --verbose
release-windows:
desc: Windows production build
platforms: [windows]
cmds:
- cmd: cargo tauri build --target x86_64-pc-windows-msvc --verbose
release-linux:
desc: Linux production build
platforms: [linux]
env:
NO_STRIP: "1"
cmds:
- cmd: cargo tauri build --target x86_64-unknown-linux-gnu --verbose
release-macos-production:
desc: Signed macOS build (local only, requires identity env)
platforms: [darwin]
preconditions:
- sh: test -n "${APPLE_SIGNING_IDENTITY:-}"
msg: "Set APPLE_SIGNING_IDENTITY in your environment (do not commit secrets)"
- sh: 'case "${ARCH:-universal}" in universal|arm64|x86_64) ;; *) exit 1;; esac'
msg: "ARCH must be one of: universal, arm64, x86_64 (e.g., task release-macos-production ARCH=arm64)"
- sh: 'test "${ARCH:-universal}" != "arm64" || rustup target list --installed | grep -q "^aarch64-apple-darwin$"'
msg: "Install target: rustup target add aarch64-apple-darwin"
- sh: 'test "${ARCH:-universal}" != "x86_64" || rustup target list --installed | grep -q "^x86_64-apple-darwin$"'
msg: "Install target: rustup target add x86_64-apple-darwin"
- sh: 'test "${ARCH:-universal}" != "universal" || (rustup target list --installed | grep -q "^aarch64-apple-darwin$" && rustup target list --installed | grep -q "^x86_64-apple-darwin$")'
msg: "Install both targets: rustup target add aarch64-apple-darwin x86_64-apple-darwin"
env:
MACOSX_DEPLOYMENT_TARGET: "{{.MACOSX_DEPLOYMENT_TARGET}}"
APPLE_SIGNING_IDENTITY: "{{.APPLE_SIGNING_IDENTITY}}"
cmds:
- cmd: |
case "${ARCH:-universal}" in
universal) TARGET="universal-apple-darwin" ;;
arm64) TARGET="aarch64-apple-darwin" ;;
x86_64) TARGET="x86_64-apple-darwin" ;;
esac
cargo tauri build --target "$TARGET" --verbose
release-macos-arm:
desc: macOS build for arm64 (Darwin convenience task)
platforms: [darwin]
cmds:
- task: release-macos
vars:
ARCH: arm64
release-macos-x64:
desc: macOS build for x86_64 (Darwin convenience task)
platforms: [darwin]
cmds:
- task: release-macos
vars:
ARCH: x86_64
update-frontend-deps:
desc: Update frontend dependencies
preconditions:
- sh: command -v bun >/dev/null 2>&1
msg: "Bun is required"
cmds:
- cmd: bun update
update-backend-deps:
desc: Update backend dependencies
dir: ./src-tauri/
preconditions:
- sh: command -v cargo >/dev/null 2>&1
msg: "Rust toolchain (cargo) is required"
- sh: cargo upgrade -V >/dev/null 2>&1
msg: "cargo-edit is required for 'cargo upgrade' (install with: cargo install cargo-edit)"
cmds:
- cmd: cargo update
- cmd: cargo upgrade {{.UPGRADE_INCOMPAT_FLAG}}
- cmd: cd bmm-lib && cargo update
- cmd: cd bmm-lib && cargo upgrade {{.UPGRADE_INCOMPAT_FLAG}}
update-dependencies:
desc: Update front- and backend dependencies
cmds:
- task: update-frontend-deps
- task: update-backend-deps
vars:
INCOMPATIBLE: "{{.INCOMPATIBLE}}"
check:
desc: Typecheck frontend + lint/test Rust + frontend tests
cmds:
- cmd: bun run check
- cmd: bun run lint
- cmd: bun run test
- cmd: cd ./src-tauri && cargo fmt --all --check
- cmd: cd ./src-tauri && cargo clippy -- -D warnings
- cmd: cd ./src-tauri && cargo test -q -- --test-threads=1
- cmd: cd ./src-tauri/bmm-lib && cargo test -q -- --test-threads=1
fmt:
desc: Format Rust and frontend code
cmds:
- task: fmt-rust
- task: fmt-ui
fmt-rust:
desc: Format Rust code
cmds:
- cmd: cd ./src-tauri && cargo fmt --all
fmt-ui:
desc: Format frontend (best effort)
cmds:
- cmd: |
if [ -f package.json ] && grep -q '"format"\s*:' package.json; then
echo "Running: bun run format"
bun run format || true
elif command -v bunx >/dev/null 2>&1; then
echo "Running: bunx prettier -w . --ignore-path .prettierignore (fallback)"
bunx -y prettier -w . --ignore-path .prettierignore || true
else
echo "Skipping frontend format: no 'format' script and no bunx/prettier" >&2
fi
test:
desc: Run Rust tests for both crates
cmds:
- cmd: cd ./src-tauri && cargo test -q -- --test-threads=1
- cmd: cd ./src-tauri/bmm-lib && cargo test -q -- --test-threads=1
clean:
desc: Clean build artifacts
cmds:
- cmd: echo Removing build artifacts...
- cmd: cd ./src-tauri && cargo clean
silent: true
- cmd: cd ./src-tauri/bmm-lib && cargo clean
silent: true
clean-ui:
desc: Clean frontend build artifacts
cmds:
- cmd: rm -rf .svelte-kit build dist 2>/dev/null || true
flatpak:build:
desc: Build Flatpak repo from local checkout
platforms: [linux]
preconditions:
- sh: command -v flatpak-builder >/dev/null 2>&1
msg: "flatpak-builder is required"
- sh: command -v flatpak >/dev/null 2>&1
msg: "flatpak is required"
cmds:
- cmd: |
if [ ! -f "{{.FLATPAK_REPO}}/config" ]; then
rm -rf "{{.FLATPAK_REPO}}"
mkdir -p "{{.FLATPAK_REPO}}"
if command -v ostree >/dev/null 2>&1; then
ostree init --mode=archive --repo="{{.FLATPAK_REPO}}"
else
echo "ostree is required to initialize the Flatpak repo" >&2
exit 1
fi
fi
- cmd: flatpak-builder --force-clean --repo={{.FLATPAK_REPO}} {{.FLATPAK_BUILD_DIR}} {{.FLATPAK_MANIFEST}}
flatpak:bundle:
desc: Create Flatpak bundle from local repo
platforms: [linux]
preconditions:
- sh: command -v flatpak >/dev/null 2>&1
msg: "flatpak is required"
cmds:
- cmd: flatpak build-bundle {{.FLATPAK_REPO}} {{.FLATPAK_BUNDLE}} {{.FLATPAK_APP_ID}} master
flatpak:install:
desc: Install Flatpak bundle to user profile
platforms: [linux]
preconditions:
- sh: command -v flatpak >/dev/null 2>&1
msg: "flatpak is required"
cmds:
- cmd: flatpak install --user {{.FLATPAK_BUNDLE}}
flatpak:run:
desc: Run the Flatpak app
platforms: [linux]
preconditions:
- sh: command -v flatpak >/dev/null 2>&1
msg: "flatpak is required"
cmds:
- cmd: flatpak run {{.FLATPAK_APP_ID}}
flatpak:clean:
desc: Remove Flatpak build artifacts
platforms: [linux]
cmds:
- cmd: rm -rf {{.FLATPAK_BUILD_DIR}} {{.FLATPAK_REPO}} {{.FLATPAK_BUNDLE}} 2>/dev/null || true
flatpak:all:
desc: Build, bundle, install, and run Flatpak locally
platforms: [linux]
cmds:
- task: flatpak:build
- task: flatpak:bundle
- task: flatpak:install
- task: flatpak:run
bootstrap:
desc: Install dev dependencies (idempotent)
cmds:
- cmd: bun install
- cmd: cd ./src-tauri && cargo fetch