Skip to content

Commit a371499

Browse files
authored
chore: switch from Makefile to Mise (#8)
1 parent be83f2f commit a371499

11 files changed

Lines changed: 82 additions & 77 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,3 +88,4 @@ fastlane/test_output
8888
# https://github.com/johnno1962/injectionforxcode
8989

9090
iOSInjectionProject/
91+
.swiftpm/

.swiftformat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Stream rules
22

3-
--swiftversion 5.3
3+
--swiftversion 5.10
44

55
# Use 'swiftformat --options' to list all of the possible options
66

.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata

Lines changed: 0 additions & 7 deletions
This file was deleted.

Makefile

Lines changed: 0 additions & 19 deletions
This file was deleted.

Mintfile

Lines changed: 0 additions & 2 deletions
This file was deleted.

Package@swift-5.7.swift

Lines changed: 0 additions & 16 deletions
This file was deleted.

Package@swift-5.8.swift

Lines changed: 0 additions & 16 deletions
This file was deleted.

Package@swift-5.9.swift

Lines changed: 0 additions & 16 deletions
This file was deleted.

mise.toml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[tools]
2+
git-cliff = "2.9.1"
3+
swiftlint = "0.63.2"
4+
swiftformat = "0.59.1"
5+
6+
[settings]
7+
experimental = true
8+
9+
[hooks]
10+
postinstall = "mise run install"

mise/tasks/install.sh

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
echo "🔧 Installing git hooks..."
6+
7+
# Find git repository root
8+
GIT_ROOT=$(git rev-parse --show-toplevel 2>/dev/null)
9+
10+
if [ -z "$GIT_ROOT" ]; then
11+
echo "❌ Error: Not a git repository"
12+
exit 1
13+
fi
14+
15+
echo "📁 Git root: $GIT_ROOT"
16+
17+
# Create hooks directory if it doesn't exist
18+
mkdir -p "$GIT_ROOT/.git/hooks"
19+
20+
# Create pre-commit hook
21+
cat > "$GIT_ROOT/.git/hooks/pre-commit" <<'HOOK_EOF'
22+
#!/bin/bash
23+
24+
echo "🔍 Running linters..."
25+
26+
echo "📝 Formatting staged Swift files..."
27+
git diff --diff-filter=d --staged --name-only | grep -e '\.swift$' | while read line; do
28+
if [[ $line == *"/Generated"* ]]; then
29+
echo "⏭️ Skipping generated file: $line"
30+
else
31+
echo "✨ Formatting: $line"
32+
mise exec swiftformat -- swiftformat "${line}"
33+
git add "$line"
34+
fi
35+
done
36+
37+
if ! mise run lint; then
38+
echo "❌ Lint failed. Please fix the issues before committing."
39+
echo "💡 Tip: Run 'mise run format' to auto-fix some issues"
40+
echo "⚠️ To skip this hook, use: git commit --no-verify"
41+
exit 1
42+
fi
43+
44+
echo "✅ All checks passed!"
45+
exit 0
46+
HOOK_EOF
47+
48+
chmod +x "$GIT_ROOT/.git/hooks/pre-commit"
49+
50+
echo "✅ Git hooks installed successfully!"
51+
echo "📍 Hook location: $GIT_ROOT/.git/hooks/pre-commit"
52+
echo ""
53+
echo "Pre-commit hook will:"
54+
echo " 1. Format staged Swift files (except /Generated)"
55+
echo " 2. Run mise lint"
56+
echo ""
57+
echo "To skip the hook, use: git commit --no-verify"

0 commit comments

Comments
 (0)