-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathjustfile
More file actions
209 lines (156 loc) · 7.05 KB
/
justfile
File metadata and controls
209 lines (156 loc) · 7.05 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
# Load environment variables from frontend/.env.local
set dotenv-path := "frontend/.env.local"
set dotenv-required := false
# List available commands
default:
@just --list
# Install frontend dependencies
install:
cd frontend && bun install
# Start the frontend development server
dev:
cd frontend && bun run dev
build:
cd frontend && bun run build
format:
cd frontend && bun run format
lint:
cd frontend && bun run lint
# Run Tauri iOS development build (default simulator)
ios-dev:
cd frontend && bun run tauri ios dev
# Run Tauri iOS development build on specific simulator (e.g., "iPhone 16 Pro iOS 26")
ios-dev-sim simulator:
cd frontend && bun run tauri ios dev '{{simulator}}'
# Run Tauri iOS development build on physical device (e.g., "Your iPhone")
ios-dev-device device:
cd frontend && bun run tauri ios dev --device '{{device}}'
# Build ONNX Runtime for iOS (device + simulator) - required for TTS
ios-build-onnxruntime:
cd frontend/src-tauri && ./scripts/build-ios-onnxruntime-all.sh
# Setup cargo config for iOS ONNX Runtime (run after building ONNX Runtime)
ios-setup-cargo-config:
cd frontend/src-tauri && ./scripts/setup-ios-cargo-config.sh
# Fix arm64-sim Xcode architecture issue (run if you get arm64-sim errors)
ios-fix-arch:
#!/usr/bin/env bash
set -euo pipefail
cd frontend/src-tauri/gen/apple
echo "Fixing arm64-sim architecture issue..."
perl -i -0pe 's/ARCHS = \(\s*arm64,\s*"arm64-sim",\s*\);/ARCHS = arm64;/g' maple.xcodeproj/project.pbxproj
sed -i '' 's/VALID_ARCHS = "arm64 arm64-sim";/VALID_ARCHS = arm64;/g' maple.xcodeproj/project.pbxproj
sed -i '' 's/"EXCLUDED_ARCHS\[sdk=iphoneos\*\]" = "arm64-sim x86_64";/"EXCLUDED_ARCHS[sdk=iphoneos*]" = x86_64;/g' maple.xcodeproj/project.pbxproj
sed -i '' 's/"EXCLUDED_ARCHS\[sdk=iphonesimulator\*\]" = arm64;/"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "";/g' maple.xcodeproj/project.pbxproj
echo "Fixed! Verify with: grep -E 'ARCHS =|VALID_ARCHS|EXCLUDED_ARCHS' maple.xcodeproj/project.pbxproj"
# Build Tauri Android release
android-build:
cd frontend && bun run tauri android build
# Build Tauri desktop release
desktop-build:
cd frontend && bun tauri build
# Build Tauri desktop debug
desktop-build-debug:
cd frontend && bun tauri build --debug
# Build Tauri desktop release (with CC unset for compatibility)
desktop-build-no-cc:
cd frontend && unset CC && bun tauri build
# Build Tauri desktop debug (with CC unset for compatibility)
desktop-build-debug-no-cc:
cd frontend && unset CC && bun tauri build --debug
# Format Rust code
rust-fmt:
cd frontend/src-tauri && cargo fmt
# Check Rust code compiles
rust-check:
cd frontend/src-tauri && cargo check
# Run Clippy lints on Rust code
rust-clippy:
cd frontend/src-tauri && cargo clippy
# Run all Rust checks (fmt check + clippy)
rust-lint:
cd frontend/src-tauri && cargo fmt --check && cargo clippy -- -D warnings
# Update version across all required files
update-version version:
#!/usr/bin/env bash
set -euo pipefail
echo "Updating version to {{version}}..."
# Parse version into components
IFS='.' read -r major minor patch <<< "{{version}}"
# Calculate Android versionCode: M + MMM (minor) + PPP (patch) + 000 (counter reset)
# Format: MMMMPPPCCC (10 digits total)
android_version_code=$(printf "%d%03d%03d000" "$major" "$minor" "$patch")
echo "Calculated Android versionCode: $android_version_code"
# Update package.json
sed -i 's/"version": "[^"]*"/"version": "{{version}}"/' frontend/package.json
# Update tauri.conf.json version
sed -i 's/"version": "[^"]*"/"version": "{{version}}"/' frontend/src-tauri/tauri.conf.json
# Update tauri.conf.json Android versionCode
sed -i "s/\"versionCode\": [0-9]*/\"versionCode\": $android_version_code/" frontend/src-tauri/tauri.conf.json
# Update Cargo.toml
sed -i 's/^version = "[^"]*"/version = "{{version}}"/' frontend/src-tauri/Cargo.toml
# Update project.yml
sed -i 's/CFBundleShortVersionString: .*/CFBundleShortVersionString: {{version}}/' frontend/src-tauri/gen/apple/project.yml
sed -i 's/CFBundleVersion: .*/CFBundleVersion: {{version}}/' frontend/src-tauri/gen/apple/project.yml
# Update Info.plist
sed -i '/<key>CFBundleShortVersionString<\/key>/{n;s/<string>[^<]*<\/string>/<string>{{version}}<\/string>/;}' frontend/src-tauri/gen/apple/maple_iOS/Info.plist
sed -i '/<key>CFBundleVersion<\/key>/{n;s/<string>[^<]*<\/string>/<string>{{version}}<\/string>/;}' frontend/src-tauri/gen/apple/maple_iOS/Info.plist
# Run cargo check to update Cargo.lock
echo "Running cargo check to update Cargo.lock..."
cd frontend/src-tauri && cargo check
echo "Version updated to {{version}} with Android versionCode $android_version_code in all files!"
# Get current version from package.json
get-version:
@jq -r '.version' frontend/package.json
# Bump version by patch (0.0.1)
bump-patch:
#!/usr/bin/env bash
set -euo pipefail
current=$(just get-version)
IFS='.' read -r major minor patch <<< "$current"
new_version="$major.$minor.$((patch + 1))"
just update-version "$new_version"
# Bump version by minor (0.1.0)
bump-minor:
#!/usr/bin/env bash
set -euo pipefail
current=$(just get-version)
IFS='.' read -r major minor patch <<< "$current"
new_version="$major.$((minor + 1)).0"
just update-version "$new_version"
# Bump version by major (1.0.0)
bump-major:
#!/usr/bin/env bash
set -euo pipefail
current=$(just get-version)
IFS='.' read -r major minor patch <<< "$current"
new_version="$((major + 1)).0.0"
just update-version "$new_version"
# Increment Android versionCode counter (last 3 digits) for Play Store updates
update-android-counter:
#!/usr/bin/env bash
set -euo pipefail
# Get current versionCode from tauri.conf.json
current_code=$(jq -r '.bundle.android.versionCode' frontend/src-tauri/tauri.conf.json)
# Extract base (first 7 digits) and counter (last 3 digits)
base=$((current_code / 1000))
counter=$((current_code % 1000))
# Increment counter
new_counter=$((counter + 1))
# Ensure counter doesn't exceed 999
if [ $new_counter -gt 999 ]; then
echo "Error: Counter exceeds maximum (999). Consider bumping the version instead."
exit 1
fi
# Calculate new versionCode
new_code=$((base * 1000 + new_counter))
echo "Updating Android versionCode: $current_code → $new_code"
# Update tauri.conf.json Android versionCode
sed -i "s/\"versionCode\": $current_code/\"versionCode\": $new_code/" frontend/src-tauri/tauri.conf.json
echo "Android versionCode updated to $new_code"
# Create a new release (updates version and creates git tag)
release version:
just update-version {{version}}
git add -A
git commit -m "chore: bump version to {{version}}"
git tag -a "v{{version}}" -m "Release v{{version}}"
echo "Release v{{version}} created! Don't forget to push tags: git push && git push --tags"