diff --git a/.gitignore b/.gitignore index 330d167..0649719 100644 --- a/.gitignore +++ b/.gitignore @@ -88,3 +88,4 @@ fastlane/test_output # https://github.com/johnno1962/injectionforxcode iOSInjectionProject/ +.swiftpm/ \ No newline at end of file diff --git a/.swiftformat b/.swiftformat index ba65f63..8dfd3c1 100644 --- a/.swiftformat +++ b/.swiftformat @@ -1,6 +1,6 @@ # Stream rules ---swiftversion 5.3 +--swiftversion 5.10 # Use 'swiftformat --options' to list all of the possible options diff --git a/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata b/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 919434a..0000000 --- a/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/Makefile b/Makefile deleted file mode 100644 index de1897f..0000000 --- a/Makefile +++ /dev/null @@ -1,19 +0,0 @@ -all: bootstrap - -bootstrap: hook - mint bootstrap - -hook: - ln -sf ../../hooks/pre-commit .git/hooks/pre-commit - chmod +x .git/hooks/pre-commit - -mint: - mint bootstrap - -lint: - mint run swiftlint - -fmt: - mint run swiftformat Sources Tests - -.PHONY: all bootstrap hook mint lint fmt diff --git a/Mintfile b/Mintfile deleted file mode 100644 index e2cdefa..0000000 --- a/Mintfile +++ /dev/null @@ -1,2 +0,0 @@ -nicklockwood/SwiftFormat@0.52.7 -realm/SwiftLint@0.53.0 \ No newline at end of file diff --git a/Package@swift-5.7.swift b/Package@swift-5.7.swift deleted file mode 100644 index 3062d29..0000000 --- a/Package@swift-5.7.swift +++ /dev/null @@ -1,16 +0,0 @@ -// swift-tools-version: 5.7 -// The swift-tools-version declares the minimum version of Swift required to build this package. - -import PackageDescription - -let package = Package( - name: "overlay-container", - platforms: [.iOS(.v12)], - products: [ - .library(name: "OverlayContainer", targets: ["OverlayContainer"]), - ], - targets: [ - .target(name: "OverlayContainer"), - .testTarget(name: "OverlayContainerTests", dependencies: ["OverlayContainer"]), - ] -) diff --git a/Package@swift-5.8.swift b/Package@swift-5.8.swift deleted file mode 100644 index 48c09c9..0000000 --- a/Package@swift-5.8.swift +++ /dev/null @@ -1,16 +0,0 @@ -// swift-tools-version: 5.8 -// The swift-tools-version declares the minimum version of Swift required to build this package. - -import PackageDescription - -let package = Package( - name: "overlay-container", - platforms: [.iOS(.v12)], - products: [ - .library(name: "OverlayContainer", targets: ["OverlayContainer"]), - ], - targets: [ - .target(name: "OverlayContainer"), - .testTarget(name: "OverlayContainerTests", dependencies: ["OverlayContainer"]), - ] -) diff --git a/Package@swift-5.9.swift b/Package@swift-5.9.swift deleted file mode 100644 index b8b4ffb..0000000 --- a/Package@swift-5.9.swift +++ /dev/null @@ -1,16 +0,0 @@ -// swift-tools-version: 5.9 -// The swift-tools-version declares the minimum version of Swift required to build this package. - -import PackageDescription - -let package = Package( - name: "overlay-container", - platforms: [.iOS(.v12)], - products: [ - .library(name: "OverlayContainer", targets: ["OverlayContainer"]), - ], - targets: [ - .target(name: "OverlayContainer"), - .testTarget(name: "OverlayContainerTests", dependencies: ["OverlayContainer"]), - ] -) diff --git a/mise.toml b/mise.toml new file mode 100644 index 0000000..222ebfb --- /dev/null +++ b/mise.toml @@ -0,0 +1,10 @@ +[tools] +git-cliff = "2.9.1" +swiftlint = "0.63.2" +swiftformat = "0.59.1" + +[settings] +experimental = true + +[hooks] +postinstall = "mise run install" \ No newline at end of file diff --git a/mise/tasks/install.sh b/mise/tasks/install.sh new file mode 100755 index 0000000..aeba03b --- /dev/null +++ b/mise/tasks/install.sh @@ -0,0 +1,57 @@ +#!/bin/bash + +set -e + +echo "🔧 Installing git hooks..." + +# Find git repository root +GIT_ROOT=$(git rev-parse --show-toplevel 2>/dev/null) + +if [ -z "$GIT_ROOT" ]; then + echo "❌ Error: Not a git repository" + exit 1 +fi + +echo "📁 Git root: $GIT_ROOT" + +# Create hooks directory if it doesn't exist +mkdir -p "$GIT_ROOT/.git/hooks" + +# Create pre-commit hook +cat > "$GIT_ROOT/.git/hooks/pre-commit" <<'HOOK_EOF' +#!/bin/bash + +echo "🔍 Running linters..." + +echo "📝 Formatting staged Swift files..." +git diff --diff-filter=d --staged --name-only | grep -e '\.swift$' | while read line; do + if [[ $line == *"/Generated"* ]]; then + echo "⏭️ Skipping generated file: $line" + else + echo "✨ Formatting: $line" + mise exec swiftformat -- swiftformat "${line}" + git add "$line" + fi +done + +if ! mise run lint; then + echo "❌ Lint failed. Please fix the issues before committing." + echo "💡 Tip: Run 'mise run format' to auto-fix some issues" + echo "⚠️ To skip this hook, use: git commit --no-verify" + exit 1 +fi + +echo "✅ All checks passed!" +exit 0 +HOOK_EOF + +chmod +x "$GIT_ROOT/.git/hooks/pre-commit" + +echo "✅ Git hooks installed successfully!" +echo "📍 Hook location: $GIT_ROOT/.git/hooks/pre-commit" +echo "" +echo "Pre-commit hook will:" +echo " 1. Format staged Swift files (except /Generated)" +echo " 2. Run mise lint" +echo "" +echo "To skip the hook, use: git commit --no-verify" \ No newline at end of file diff --git a/mise/tasks/lint b/mise/tasks/lint new file mode 100755 index 0000000..c8541e6 --- /dev/null +++ b/mise/tasks/lint @@ -0,0 +1,13 @@ +#!/bin/bash +#MISE description="Lint the overlay-container package using SwiftLint and SwiftFormat" +#MISE usage flag "-f --fix" help="Fix the fixable issues" + +set -eo pipefail + +if [ "$usage_fix" = "true" ]; then + swiftformat Sources Tests + swiftlint lint --fix --strict --config .swiftlint.yml Sources Tests +else + swiftformat Sources Tests --lint + swiftlint lint --strict --config .swiftlint.yml Sources Tests +fi \ No newline at end of file