This repository has been archived by the owner on Aug 4, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Package.swift
41 lines (37 loc) · 1.64 KB
/
Package.swift
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
// swift-tools-version:4.2
import PackageDescription
let package = Package(
name: "Injectable",
products: [
.library(name: "Injectable", targets: ["Injectable"]),
],
dependencies: [
.package(url: "https://github.com/danger/swift.git", from: "1.0.0"),
.package(url: "https://github.com/nicklockwood/SwiftFormat", from: "0.35.8"),
.package(url: "https://github.com/Realm/SwiftLint", from: "0.28.1"),
.package(url: "https://github.com/orta/Komondor", from: "1.0.0"),
],
targets: [
.target(name: "Injectable", dependencies: [], path: "Injectable"),
.testTarget(name: "InjectableTests", dependencies: ["Injectable"], path: "InjectableTests"),
]
)
#if canImport(PackageConfig)
import PackageConfig
let config = PackageConfig([
"komondor": [
// When someone has run `git commit`, first run
// run SwiftFormat and the auto-correcter for SwiftLint
// If there are any modifications then cancel the commit
// so changes can be reviewed
"pre-commit": [
"git diff --cached --name-only | xargs git diff | md5 > .pre_format_hash",
"swift run swiftformat .",
"swift run swiftlint autocorrect --path Injectable/",
"git diff --cached --name-only | xargs git diff | md5 > .post_format_hash",
"diff .pre_format_hash .post_format_hash > /dev/null || { echo \"Staged files modified during commit\" ; rm .pre_format_hash ; rm .post_format_hash ; exit 1; }",
"rm .pre_format_hash ; rm .post_format_hash",
],
],
])
#endif