Skip to content

Latest commit

History

History
36 lines (30 loc) 路 1 KB

with_swiftpm.md

File metadata and controls

36 lines (30 loc) 路 1 KB

Already using SwiftPM

  1. Add the dependency to your Package.swift.
  2. Set up the git-hooks for komondor via PackageConfig
// swift-tools-version:4.2

import PackageDescription

let package = Package(
    name: "Komondor",
    products: [ ... ],
    dependencies: [
        // My dependencies
        .package(url: "https://github.com/shibapm/PackageConfig.git", from: "1.0.0"),
        // Dev deps
+        .package(url: "https://github.com/shibapm/Komondor.git", from: "1.0.0"),
        .package(url: "https://github.com/nicklockwood/SwiftFormat.git", from: "0.35.8"),
    ],
    targets: [...]
)

+ #if canImport(PackageConfig)
+     import PackageConfig
+
+     let config = PackageConfiguration([
+         "komondor": [
+             "pre-commit": ["swift test", "swift run swiftFormat .", "git add ."],
+             "pre-push": "swift test"
+         ],
+     ])
+ #endif

You can get more information on the config here.