From 38ccea89ccb814b69e3421da9d63b0b0dc08e320 Mon Sep 17 00:00:00 2001 From: tinder-SamMarshall Date: Tue, 25 Mar 2025 16:44:08 -0600 Subject: [PATCH 1/3] Added imports to PluginListInterface File --- Sources/NodesGenerator/Config.swift | 5 +++++ Sources/NodesGenerator/StencilTemplate.swift | 1 + .../__Snapshots__/ConfigTests/testConfig.1.txt | 1 + .../ConfigTests/testConfigWithEmptyFileContents.1.txt | 1 + .../ConfigTests/testDecodingFromEmptyString.1.txt | 1 + .../ConfigTests/testDecodingWithEmptyArray.1.txt | 1 + 6 files changed, 10 insertions(+) diff --git a/Sources/NodesGenerator/Config.swift b/Sources/NodesGenerator/Config.swift index 26ffce943..adc534a96 100644 --- a/Sources/NodesGenerator/Config.swift +++ b/Sources/NodesGenerator/Config.swift @@ -40,6 +40,7 @@ public struct Config: Codable, Equatable { public var flowImports: Set public var interfaceImports: Set public var pluginListImports: Set + public var pluginListInterfaceImports: Set public var viewControllerImports: Set public var dependencies: [Variable] public var analyticsProperties: [Variable] @@ -97,6 +98,7 @@ extension Config { flowImports = [] interfaceImports = [] pluginListImports = [] + pluginListInterfaceImports = [] viewControllerImports = [] dependencies = [] analyticsProperties = [] @@ -176,6 +178,9 @@ extension Config { pluginListImports = (try? decoder.decode(CodingKeys.pluginListImports)) ?? defaults.pluginListImports + pluginListInterfaceImports = + (try? decoder.decode(CodingKeys.pluginListInterfaceImports)) + ?? defaults.pluginListInterfaceImports viewControllerImports = (try? decoder.decode(CodingKeys.viewControllerImports)) ?? defaults.viewControllerImports diff --git a/Sources/NodesGenerator/StencilTemplate.swift b/Sources/NodesGenerator/StencilTemplate.swift index 24bdf604f..c915518d0 100644 --- a/Sources/NodesGenerator/StencilTemplate.swift +++ b/Sources/NodesGenerator/StencilTemplate.swift @@ -305,6 +305,7 @@ public enum StencilTemplate: CustomStringConvertible, Equatable, Sendable { case .pluginListInterface: config.baseImports .union(["Nodes"]) + .union(config.pluginListInterfaceImports) case .pluginListTests: config.baseTestImports .union(["NodesTesting"]) diff --git a/Tests/NodesGeneratorTests/__Snapshots__/ConfigTests/testConfig.1.txt b/Tests/NodesGeneratorTests/__Snapshots__/ConfigTests/testConfig.1.txt index a6d1f8876..23343e404 100644 --- a/Tests/NodesGeneratorTests/__Snapshots__/ConfigTests/testConfig.1.txt +++ b/Tests/NodesGeneratorTests/__Snapshots__/ConfigTests/testConfig.1.txt @@ -49,6 +49,7 @@ ▿ pluginListImports: 2 members - "" - "" + - pluginListInterfaceImports: 0 members - publisherFailureType: "" - publisherType: "" ▿ reactiveImports: 2 members diff --git a/Tests/NodesGeneratorTests/__Snapshots__/ConfigTests/testConfigWithEmptyFileContents.1.txt b/Tests/NodesGeneratorTests/__Snapshots__/ConfigTests/testConfigWithEmptyFileContents.1.txt index 590927a65..0782fb0e3 100644 --- a/Tests/NodesGeneratorTests/__Snapshots__/ConfigTests/testConfigWithEmptyFileContents.1.txt +++ b/Tests/NodesGeneratorTests/__Snapshots__/ConfigTests/testConfigWithEmptyFileContents.1.txt @@ -19,6 +19,7 @@ - isTestTemplatesGenerationEnabled: true - isViewInjectedTemplateEnabled: true - pluginListImports: 0 members + - pluginListInterfaceImports: 0 members - publisherFailureType: "Never" - publisherType: "AnyPublisher" ▿ reactiveImports: 1 member diff --git a/Tests/NodesGeneratorTests/__Snapshots__/ConfigTests/testDecodingFromEmptyString.1.txt b/Tests/NodesGeneratorTests/__Snapshots__/ConfigTests/testDecodingFromEmptyString.1.txt index 590927a65..0782fb0e3 100644 --- a/Tests/NodesGeneratorTests/__Snapshots__/ConfigTests/testDecodingFromEmptyString.1.txt +++ b/Tests/NodesGeneratorTests/__Snapshots__/ConfigTests/testDecodingFromEmptyString.1.txt @@ -19,6 +19,7 @@ - isTestTemplatesGenerationEnabled: true - isViewInjectedTemplateEnabled: true - pluginListImports: 0 members + - pluginListInterfaceImports: 0 members - publisherFailureType: "Never" - publisherType: "AnyPublisher" ▿ reactiveImports: 1 member diff --git a/Tests/NodesGeneratorTests/__Snapshots__/ConfigTests/testDecodingWithEmptyArray.1.txt b/Tests/NodesGeneratorTests/__Snapshots__/ConfigTests/testDecodingWithEmptyArray.1.txt index 590927a65..0782fb0e3 100644 --- a/Tests/NodesGeneratorTests/__Snapshots__/ConfigTests/testDecodingWithEmptyArray.1.txt +++ b/Tests/NodesGeneratorTests/__Snapshots__/ConfigTests/testDecodingWithEmptyArray.1.txt @@ -19,6 +19,7 @@ - isTestTemplatesGenerationEnabled: true - isViewInjectedTemplateEnabled: true - pluginListImports: 0 members + - pluginListInterfaceImports: 0 members - publisherFailureType: "Never" - publisherType: "AnyPublisher" ▿ reactiveImports: 1 member From 6d00ade7af90983962a18e2b082baad7f45ce72e Mon Sep 17 00:00:00 2001 From: tinder-SamMarshall Date: Wed, 26 Mar 2025 13:15:29 -0600 Subject: [PATCH 2/3] Added more configs --- Customization/Configuration.md | 1 + Tests/NodesGeneratorTests/ConfigTests.swift | 3 +++ Tests/NodesGeneratorTests/Support/TestFactories.swift | 1 + .../__Snapshots__/ConfigTests/testConfig.1.txt | 4 +++- .../testPluginListXcodeTemplatePermutation.1.txt | 3 ++- .../XcodeTemplateTests/testPluginListXcodeTemplate.1.txt | 3 ++- 6 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Customization/Configuration.md b/Customization/Configuration.md index ded3d1c95..59581cba0 100644 --- a/Customization/Configuration.md +++ b/Customization/Configuration.md @@ -52,6 +52,7 @@ dependencyInjectionImports: builderImports: [] flowImports: [] pluginListImports: [] +pluginListInterfaceImports: [] viewControllerImports: [] dependencies: [] analyticsProperties: [] diff --git a/Tests/NodesGeneratorTests/ConfigTests.swift b/Tests/NodesGeneratorTests/ConfigTests.swift index fca9dd291..a374f9b6f 100644 --- a/Tests/NodesGeneratorTests/ConfigTests.swift +++ b/Tests/NodesGeneratorTests/ConfigTests.swift @@ -163,6 +163,9 @@ final class ConfigTests: XCTestCase, TestFactories { pluginListImports: - - + pluginListInterfaceImports: + - + - viewControllerImports: - - diff --git a/Tests/NodesGeneratorTests/Support/TestFactories.swift b/Tests/NodesGeneratorTests/Support/TestFactories.swift index 739864f12..5fded2816 100644 --- a/Tests/NodesGeneratorTests/Support/TestFactories.swift +++ b/Tests/NodesGeneratorTests/Support/TestFactories.swift @@ -36,6 +36,7 @@ extension TestFactories { config.flowImports = [""] config.interfaceImports = [""] config.pluginListImports = [""] + config.pluginListInterfaceImports = [""] config.viewControllerImports = [""] config.dependencies = [Variable(name: "", type: "")] config.analyticsProperties = [Variable(name: "", type: "")] diff --git a/Tests/NodesGeneratorTests/__Snapshots__/ConfigTests/testConfig.1.txt b/Tests/NodesGeneratorTests/__Snapshots__/ConfigTests/testConfig.1.txt index 23343e404..bb3c1e2ac 100644 --- a/Tests/NodesGeneratorTests/__Snapshots__/ConfigTests/testConfig.1.txt +++ b/Tests/NodesGeneratorTests/__Snapshots__/ConfigTests/testConfig.1.txt @@ -49,7 +49,9 @@ ▿ pluginListImports: 2 members - "" - "" - - pluginListInterfaceImports: 0 members + ▿ pluginListInterfaceImports: 2 members + - "" + - "" - publisherFailureType: "" - publisherType: "" ▿ reactiveImports: 2 members diff --git a/Tests/NodesGeneratorTests/__Snapshots__/XcodeTemplatePermutationTests/testPluginListXcodeTemplatePermutation.1.txt b/Tests/NodesGeneratorTests/__Snapshots__/XcodeTemplatePermutationTests/testPluginListXcodeTemplatePermutation.1.txt index b72e2526e..a05d90779 100644 --- a/Tests/NodesGeneratorTests/__Snapshots__/XcodeTemplatePermutationTests/testPluginListXcodeTemplatePermutation.1.txt +++ b/Tests/NodesGeneratorTests/__Snapshots__/XcodeTemplatePermutationTests/testPluginListXcodeTemplatePermutation.1.txt @@ -9,8 +9,9 @@ - "" - "" - "Nodes" - ▿ pluginListInterfaceImports: 2 elements + ▿ pluginListInterfaceImports: 3 elements - "" + - "" - "Nodes" - pluginListName: "___VARIABLE_productName___" ▿ pluginListTestsImports: 2 elements diff --git a/Tests/NodesGeneratorTests/__Snapshots__/XcodeTemplateTests/testPluginListXcodeTemplate.1.txt b/Tests/NodesGeneratorTests/__Snapshots__/XcodeTemplateTests/testPluginListXcodeTemplate.1.txt index 3a3f60b1c..29cc8b6d8 100644 --- a/Tests/NodesGeneratorTests/__Snapshots__/XcodeTemplateTests/testPluginListXcodeTemplate.1.txt +++ b/Tests/NodesGeneratorTests/__Snapshots__/XcodeTemplateTests/testPluginListXcodeTemplate.1.txt @@ -12,8 +12,9 @@ - "" - "" - "Nodes" - ▿ pluginListInterfaceImports: 2 elements + ▿ pluginListInterfaceImports: 3 elements - "" + - "" - "Nodes" - pluginListName: "___VARIABLE_productName___" ▿ pluginListTestsImports: 2 elements From 76231426674e73698553c3b8ddafca217915ac4c Mon Sep 17 00:00:00 2001 From: tinder-SamMarshall Date: Wed, 26 Mar 2025 13:37:23 -0600 Subject: [PATCH 3/3] Fixed tests --- Tests/NodesGeneratorTests/StencilTemplateTests.swift | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Tests/NodesGeneratorTests/StencilTemplateTests.swift b/Tests/NodesGeneratorTests/StencilTemplateTests.swift index 5ca1bdc6d..8e374a9df 100644 --- a/Tests/NodesGeneratorTests/StencilTemplateTests.swift +++ b/Tests/NodesGeneratorTests/StencilTemplateTests.swift @@ -369,6 +369,7 @@ final class StencilTemplateTests: XCTestCase, TestFactories { case .pluginListInterface: expect(imports) == [ "", + "", "Nodes" ] case .pluginListTests: @@ -496,6 +497,7 @@ final class StencilTemplateTests: XCTestCase, TestFactories { case .pluginListInterface: expect(imports) == [ "", + "", "Nodes" ] case .pluginListTests: