10 Commits

Author SHA1 Message Date
739e4b5bef Fix Tests
Some checks failed
gitea-openium/resgen.swift/pipeline/head Build started...
gitea-openium/resgen.swift/pipeline/pr-master There was a failure building this commit
2025-07-17 10:44:28 +02:00
bc17e23039 Fix génération de tag
Some checks failed
gitea-openium/resgen.swift/pipeline/pr-master There was a failure building this commit
gitea-openium/resgen.swift/pipeline/head There was a failure building this commit
2025-07-17 08:56:25 +02:00
ae69a63a6a RES-32 Ajouter la possibilité désactiver des traqueurs spécifiques
Some checks failed
gitea-openium/resgen.swift/pipeline/pr-master There was a failure building this commit
2025-07-16 17:25:49 +02:00
821af9ee08 Disable tag for previews 2025-07-16 17:24:35 +02:00
b509cf2797 Fix some error when value and replaceIn 2025-07-16 17:23:15 +02:00
29f0b91e8f Update README.md 2025-07-16 17:23:06 +02:00
f29a076541 Add parameter defaultValue and value and add replaceIn parameter in another parameter 2025-07-16 17:23:06 +02:00
8f7fd8cbe2 Update README.md 2025-07-16 17:18:04 +02:00
323bd18e00 fix: Static function 2025-07-16 17:18:04 +02:00
17aecbc8ec fix: Use category and action if not matomo 2025-07-16 17:18:04 +02:00
5 changed files with 35 additions and 65 deletions

View File

@@ -36,7 +36,7 @@ swift run -c release ResgenSwift fonts $FORCE_FLAG "./Fonts/fonts.txt" \
## Colors ## Colors
Colors generator generates colorsets in specified xcassets and an extension of `Color` (or a custom class) associated to those colorsets. If the extension name is not specified, no extension will be generated. Colors generator generates an extension of `UIColor` (or a custom class) along with colorsets in specified xcassets.
```sh ```sh
swift run -c release ResgenSwift colors $FORCE_FLAG "./Colors/colors.txt" \ swift run -c release ResgenSwift colors $FORCE_FLAG "./Colors/colors.txt" \

View File

@@ -1,6 +0,0 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@@ -1,7 +1,6 @@
// Generated by ResgenSwift.Analytics 2.1.0 // Generated by ResgenSwift.Analytics 2.1.0
import Foundation import Foundation
import MatomoTracker
import FirebaseAnalytics import FirebaseAnalytics
// MARK: - Protocol // MARK: - Protocol
@@ -199,12 +198,12 @@ class AnalyticsManager {
) )
} }
func logEventS1DefTwo( static func logEventS1DefTwo(
title: String, title: String,
count: String, count: String,
test2: String = "test" test2: String = "test"
) { ) {
logEvent( AnalyticsManager.shared.logEvent(
name: "s1 def two", name: "s1 def two",
action: "test", action: "test",
category: "test", category: "test",

View File

@@ -21,6 +21,8 @@ struct Colors: ParsableCommand {
// MARK: - Static // MARK: - Static
static let toolName = "Color" static let toolName = "Color"
static let defaultExtensionName = "Color"
static let defaultExtensionNameUIKit = "UIColor"
static let assetsColorsFolderName = "Colors" static let assetsColorsFolderName = "Colors"
// MARK: - Command options // MARK: - Command options
@@ -55,28 +57,22 @@ struct Colors: ParsableCommand {
// -> Time: 3.4505380392074585 seconds // -> Time: 3.4505380392074585 seconds
// Generate extension // Generate extension
if let extensionName = options.extensionName, ColorExtensionGenerator.writeExtensionFile(
let extensionFilePath = options.extensionFilePath { colors: parsedColors,
ColorExtensionGenerator.writeExtensionFile( staticVar: options.staticMembers,
colors: parsedColors, extensionName: options.extensionName,
staticVar: options.staticMembers, extensionFilePath: options.extensionFilePath,
extensionName: extensionName, isSwiftUI: true
extensionFilePath: extensionFilePath, )
isSwiftUI: true
)
}
// Generate extension // Generate extension
if let extensionNameUIKit = options.extensionNameUIKit, ColorExtensionGenerator.writeExtensionFile(
let extensionFilePathUIKit = options.extensionFilePathUIKit { colors: parsedColors,
ColorExtensionGenerator.writeExtensionFile( staticVar: options.staticMembers,
colors: parsedColors, extensionName: options.extensionNameUIKit,
staticVar: options.staticMembers, extensionFilePath: options.extensionFilePathUIKit,
extensionName: extensionNameUIKit, isSwiftUI: false
extensionFilePath: extensionFilePathUIKit, )
isSwiftUI: false
)
}
print("[\(Self.toolName)] Colors generated") print("[\(Self.toolName)] Colors generated")
} }
@@ -100,29 +96,18 @@ struct Colors: ParsableCommand {
Self.exit(withError: error) Self.exit(withError: error)
} }
// Extension for UIKit and SwiftUI should have different name (if both are defined) // Extension for UIKit and SwiftUI should have different name
if let extensionName = options.extensionName, guard options.extensionName != options.extensionNameUIKit else {
let extensionNameUIKit = options.extensionNameUIKit { let error = ColorsToolError.extensionNamesCollision(options.extensionName)
guard extensionName != extensionNameUIKit else { print(error.description)
let error = ColorsToolError.extensionNamesCollision(extensionName) Self.exit(withError: error)
print(error.description)
Self.exit(withError: error)
}
} }
// Check if needed to regenerate // Check if needed to regenerate
let fileToCompareToInput: String = {
// If there is no extension file to compare
// Then check the xcassets file instead
if let extensionFilePath = options.extensionFilePath {
return extensionFilePath
}
return options.xcassetsPath
}()
guard GeneratorChecker.shouldGenerate( guard GeneratorChecker.shouldGenerate(
force: options.forceGeneration, force: options.forceGeneration,
inputFilePath: options.inputFile, inputFilePath: options.inputFile,
extensionFilePath: fileToCompareToInput extensionFilePath: options.extensionFilePath
) else { ) else {
print("[\(Self.toolName)] Colors are already up to date :) ") print("[\(Self.toolName)] Colors are already up to date :) ")
return false return false

View File

@@ -30,11 +30,11 @@ struct ColorsToolOptions: ParsableArguments {
@Option(help: "Tell if it will generate static properties or not") @Option(help: "Tell if it will generate static properties or not")
var staticMembers: Bool = false var staticMembers: Bool = false
@Option(help: "Extension name. If not specified, no extension will be generated.") @Option(help: "Extension name. If not specified, it will generate an Color extension.")
var extensionName: String? var extensionName: String = Colors.defaultExtensionName
@Option(help: "SwiftUI Extension name. If not specified, no extension will be generated.") @Option(help: "SwiftUI Extension name. If not specified, it will generate an UIColor extension.")
var extensionNameUIKit: String? var extensionNameUIKit: String = Colors.defaultExtensionNameUIKit
@Option(help: "Extension suffix. Ex: MyApp, it will generate {extensionName}+ColorsMyApp.swift") @Option(help: "Extension suffix. Ex: MyApp, it will generate {extensionName}+ColorsMyApp.swift")
var extensionSuffix: String? var extensionSuffix: String?
@@ -46,35 +46,27 @@ extension ColorsToolOptions {
// MARK: - SwiftUI // MARK: - SwiftUI
var extensionFileName: String? { var extensionFileName: String {
guard let extensionName else { return nil }
if let extensionSuffix { if let extensionSuffix {
return "\(extensionName)+\(extensionSuffix).swift" return "\(extensionName)+\(extensionSuffix).swift"
} }
return "\(extensionName).swift" return "\(extensionName).swift"
} }
var extensionFilePath: String? { var extensionFilePath: String {
guard let extensionFileName else { return nil } "\(extensionOutputPath)/\(extensionFileName)"
return "\(extensionOutputPath)/\(extensionFileName)"
} }
// MARK: - UIKit // MARK: - UIKit
var extensionFileNameUIKit: String? { var extensionFileNameUIKit: String {
guard let extensionNameUIKit else { return nil }
if let extensionSuffix { if let extensionSuffix {
return "\(extensionNameUIKit)+\(extensionSuffix).swift" return "\(extensionNameUIKit)+\(extensionSuffix).swift"
} }
return "\(extensionNameUIKit).swift" return "\(extensionNameUIKit).swift"
} }
var extensionFilePathUIKit: String? { var extensionFilePathUIKit: String {
guard let extensionFileNameUIKit else { return nil } "\(extensionOutputPath)/\(extensionFileNameUIKit)"
return "\(extensionOutputPath)/\(extensionFileNameUIKit)"
} }
} }