feat: Make configuration module file-name optional, so that it is not required by a config file.
All checks were successful
CI / Ubuntu (push) Successful in 2m35s

This commit is contained in:
2024-12-24 17:13:54 -05:00
parent fb60c22257
commit 04bfd4a6ae
3 changed files with 24 additions and 7 deletions

View File

@@ -1,12 +1,14 @@
{ {
"strategy" : { "strategy" : {
"branch" : { "semvar" : {
"includeCommitSha": true "preRelease" : {
"strategy" : { "gitTag" : {} }
}
} }
}, },
"target" : { "target" : {
"module" : { "module" : {
"name" : "cli-version" "name" : "bump-version"
} }
} }
} }

View File

@@ -47,7 +47,7 @@ extension Configuration.Target {
path = "Sources/\(path)" path = "Sources/\(path)"
} }
filePath = "\(path)/\(module.fileName)" filePath = "\(path)/\(module.fileNameOrDefault)"
} }
if let gitDirectory { if let gitDirectory {

View File

@@ -150,13 +150,13 @@ public extension Configuration {
/// Represents a module target for a version file. /// Represents a module target for a version file.
/// ///
public struct Module: Codable, Equatable, Sendable { public struct Module: Codable, Equatable, Sendable, CustomDumpReflectable {
/// The module directory name. /// The module directory name.
public let name: String public let name: String
/// The version file name located in the module directory. /// The version file name located in the module directory.
public let fileName: String public let fileName: String?
/// Create a new module target. /// Create a new module target.
/// ///
@@ -165,12 +165,27 @@ public extension Configuration {
/// - fileName: The file name located in the module directory. /// - fileName: The file name located in the module directory.
public init( public init(
_ name: String, _ name: String,
fileName: String = "Version.swift" fileName: String? = "Version.swift"
) { ) {
self.name = name self.name = name
self.fileName = fileName self.fileName = fileName
} }
public var fileNameOrDefault: String {
fileName ?? "Version.swift"
}
public var customDumpMirror: Mirror {
.init(
self,
children: [
"name": name,
"fileName": fileNameOrDefault
],
displayStyle: .struct
)
}
} }
public var customDumpMirror: Mirror { public var customDumpMirror: Mirror {