diff --git a/Packages/Web/.swiftpm/xcode/xcshareddata/xcschemes/Web.xcscheme b/Packages/Infrastructure/.swiftpm/xcode/xcshareddata/xcschemes/Infrastructure.xcscheme similarity index 88% rename from Packages/Web/.swiftpm/xcode/xcshareddata/xcschemes/Web.xcscheme rename to Packages/Infrastructure/.swiftpm/xcode/xcshareddata/xcschemes/Infrastructure.xcscheme index 5212084..56914ab 100644 --- a/Packages/Web/.swiftpm/xcode/xcshareddata/xcschemes/Web.xcscheme +++ b/Packages/Infrastructure/.swiftpm/xcode/xcshareddata/xcschemes/Infrastructure.xcscheme @@ -15,8 +15,8 @@ buildForAnalyzing = "YES"> @@ -33,8 +33,8 @@ skipped = "NO"> @@ -61,8 +61,8 @@ diff --git a/Packages/Web/Package.swift b/Packages/Infrastructure/Package.swift similarity index 79% rename from Packages/Web/Package.swift rename to Packages/Infrastructure/Package.swift index c0c94e8..2f9227a 100644 --- a/Packages/Web/Package.swift +++ b/Packages/Infrastructure/Package.swift @@ -3,15 +3,15 @@ import PackageDescription let package = Package( - name: "Web", + name: "Infrastructure", platforms: [ .macOS(.v15), ], products: [ .library( - name: "Web", + name: "Infrastructure", targets: [ - "Web" + "Infrastructure" ] ), ], @@ -23,7 +23,7 @@ let package = Package( ], targets: [ .target( - name: "Web", + name: "Infrastructure", dependencies: [ .product( name: "Hummingbird", @@ -33,9 +33,9 @@ let package = Package( path: "Sources" ), .testTarget( - name: "WebTests", + name: "InfrastructureTests", dependencies: [ - .byName(name: "Web"), + .byName(name: "Infrastructure"), .product( name: "HummingbirdTesting", package: "hummingbird" diff --git a/Packages/Web/Sources/Public/Builders/RouteCollectionBuilder.swift b/Packages/Infrastructure/Sources/Public/Builders/RouteCollectionBuilder.swift similarity index 100% rename from Packages/Web/Sources/Public/Builders/RouteCollectionBuilder.swift rename to Packages/Infrastructure/Sources/Public/Builders/RouteCollectionBuilder.swift diff --git a/Packages/Web/Sources/Public/Extensions/RouterMethods+RouteCollections.swift b/Packages/Infrastructure/Sources/Public/Extensions/RouterMethods+RouteCollections.swift similarity index 100% rename from Packages/Web/Sources/Public/Extensions/RouterMethods+RouteCollections.swift rename to Packages/Infrastructure/Sources/Public/Extensions/RouterMethods+RouteCollections.swift diff --git a/Packages/Web/Sources/Public/Protocols/RouterController.swift b/Packages/Infrastructure/Sources/Public/Protocols/RouterController.swift similarity index 100% rename from Packages/Web/Sources/Public/Protocols/RouterController.swift rename to Packages/Infrastructure/Sources/Public/Protocols/RouterController.swift diff --git a/Packages/Web/Tests/Cases/Public/Extensions/RouterMethods+RouteCollectionsTests.swift b/Packages/Infrastructure/Tests/Cases/Public/Extensions/RouterMethods+RouteCollectionsTests.swift similarity index 99% rename from Packages/Web/Tests/Cases/Public/Extensions/RouterMethods+RouteCollectionsTests.swift rename to Packages/Infrastructure/Tests/Cases/Public/Extensions/RouterMethods+RouteCollectionsTests.swift index 2f6edc5..0bae410 100644 --- a/Packages/Web/Tests/Cases/Public/Extensions/RouterMethods+RouteCollectionsTests.swift +++ b/Packages/Infrastructure/Tests/Cases/Public/Extensions/RouterMethods+RouteCollectionsTests.swift @@ -3,7 +3,7 @@ import HummingbirdTesting import NIOCore import Testing -@testable import Web +@testable import Infrastructure @Suite("addController method") struct RouterMethodsTests { diff --git a/Packages/Web/Tests/Utils/Controllers/StubController.swift b/Packages/Infrastructure/Tests/Utils/Controllers/StubController.swift similarity index 96% rename from Packages/Web/Tests/Utils/Controllers/StubController.swift rename to Packages/Infrastructure/Tests/Utils/Controllers/StubController.swift index 75b7586..48e2e24 100644 --- a/Packages/Web/Tests/Utils/Controllers/StubController.swift +++ b/Packages/Infrastructure/Tests/Utils/Controllers/StubController.swift @@ -1,5 +1,5 @@ import Hummingbird -import Web +import Infrastructure /// A controller serving its path back as plain text, used to observe route registration. struct StubController { diff --git a/Services/Website/Dockerfile b/Services/Website/Dockerfile index 98ac38a..f0fef04 100644 --- a/Services/Website/Dockerfile +++ b/Services/Website/Dockerfile @@ -49,7 +49,7 @@ WORKDIR /build # a relative path, so its manifest must be present for resolution to succeed. COPY ./Packages/Localization/Package.swift ./Packages/Localization/ COPY ./Packages/Persistence/Package.swift ./Packages/Persistence/ -COPY ./Packages/Web/Package.swift ./Packages/Web/ +COPY ./Packages/Infrastructure/Package.swift ./Packages/Infrastructure/ COPY ./Services/Website/Package.swift ./Services/Website/Package.resolved ./Services/Website/ RUN swift package --package-path ./Services/Website resolve @@ -57,7 +57,7 @@ RUN swift package --package-path ./Services/Website resolve # in the assets stage and copied into staging after the binary is produced. COPY ./Packages/Localization/Sources ./Packages/Localization/Sources COPY ./Packages/Persistence/Sources ./Packages/Persistence/Sources -COPY ./Packages/Web/Sources ./Packages/Web/Sources +COPY ./Packages/Infrastructure/Sources ./Packages/Infrastructure/Sources COPY ./Services/Website/Sources ./Services/Website/Sources COPY ./Services/Website/Tests ./Services/Website/Tests diff --git a/Services/Website/Package.swift b/Services/Website/Package.swift index 39c5aad..72dd107 100644 --- a/Services/Website/Package.swift +++ b/Services/Website/Package.swift @@ -27,7 +27,7 @@ let package = Package( path: "../../Packages/Persistence" ), .package( - path: "../../Packages/Web" + path: "../../Packages/Infrastructure" ), .package( url: "https://github.com/elementary-swift/elementary.git", @@ -80,7 +80,7 @@ let package = Package( dependencies: [ .byName(name: "Localization"), .byName(name: "Persistence"), - .byName(name: "Web"), + .byName(name: "Infrastructure"), .product( name: "Configuration", package: "swift-configuration" @@ -120,7 +120,7 @@ let package = Package( name: "WebsiteLibraryTests", dependencies: [ .byName(name: "Persistence"), - .byName(name: "Web"), + .byName(name: "Infrastructure"), .byName(name: "WebsiteLibrary"), .product( name: "Elementary", diff --git a/Services/Website/README.md b/Services/Website/README.md index ccaa62c..8178dfc 100644 --- a/Services/Website/README.md +++ b/Services/Website/README.md @@ -26,7 +26,7 @@ Two SwiftPM targets: The `Website` executable depends on three local packages: - `Localization` (`Packages/Localization`) — the `Localize` and `Negotiate` helpers and the `LanguageList` of catalog languages (used by `WebsiteLibrary`). -- `Web` (`Packages/Web`) — the `RouterController` protocol the controllers conform to and the `addController` result-builder extension that registers their routes on the router declaratively. +- `Infrastructure` (`Packages/Infrastructure`) — the `RouterController` protocol the controllers conform to and the `addController` result-builder extension that registers their routes on the router declaratively. - `Persistence` (`Packages/Persistence`) — the Fluent-based data layer: the `Driver` selector, the `Service` factory that builds the `Fluent` service, the `PrepareDB` registrar that declares the migrations, and the `Probe` consulted by the readiness check; the models, migrations, and repositories stay internal to the package. It has no dependency on `swift-configuration`; the executable maps the `database.*` keys onto the driver. The persistence backend runs as a `Fluent` service inside the application's ServiceLifecycle group, so it starts and stops alongside the HTTP server (which owns its connection-pool shutdown on graceful termination). diff --git a/Services/Website/Sources/App/Extensions/App+Build.swift b/Services/Website/Sources/App/Extensions/App+Build.swift index 45814b8..e7bd7bc 100644 --- a/Services/Website/Sources/App/Extensions/App+Build.swift +++ b/Services/Website/Sources/App/Extensions/App+Build.swift @@ -3,7 +3,7 @@ import Hummingbird import HummingbirdCompression import Logging import Persistence -import Web +import Infrastructure import WebsiteLibrary /// Builds the website application. diff --git a/Services/Website/Sources/Library/Public/Controllers/HealthController.swift b/Services/Website/Sources/Library/Public/Controllers/HealthController.swift index 55f732e..4597e27 100644 --- a/Services/Website/Sources/Library/Public/Controllers/HealthController.swift +++ b/Services/Website/Sources/Library/Public/Controllers/HealthController.swift @@ -1,7 +1,7 @@ import Hummingbird import NIOCore import Persistence -import Web +import Infrastructure /// Serves the website's health-check routes. /// diff --git a/Services/Website/Sources/Library/Public/Controllers/RootController.swift b/Services/Website/Sources/Library/Public/Controllers/RootController.swift index 7a0dff0..f4995ed 100644 --- a/Services/Website/Sources/Library/Public/Controllers/RootController.swift +++ b/Services/Website/Sources/Library/Public/Controllers/RootController.swift @@ -1,5 +1,5 @@ import Hummingbird -import Web +import Infrastructure /// Serves the website's root routes. /// diff --git a/Services/Website/Tests/App/AppTests.swift b/Services/Website/Tests/App/AppTests.swift index 1b45edb..23fe521 100644 --- a/Services/Website/Tests/App/AppTests.swift +++ b/Services/Website/Tests/App/AppTests.swift @@ -48,22 +48,6 @@ struct AppTests { } } - @Test - func `landing page to answer a head request`() async throws { - try await app( - staticFilesPath: staticFilesPath - ).test(.router) { client in - try await client.execute( - uri: "/", - method: .head - ) { response in - #expect(response.status == .ok) - #expect(response.headers[.contentType] == "text/html; charset=utf-8") - #expect(response.body.readableBytes == 0) - } - } - } - @Test func `health check to be served at the health path`() async throws { try await app( diff --git a/Services/Website/Tests/Website.xctestplan b/Services/Website/Tests/Website.xctestplan index 0a36976..b82c471 100644 --- a/Services/Website/Tests/Website.xctestplan +++ b/Services/Website/Tests/Website.xctestplan @@ -48,9 +48,9 @@ }, { "target" : { - "containerPath" : "container:..\/..\/Packages\/Web", - "identifier" : "WebTests", - "name" : "WebTests" + "containerPath" : "container:..\/..\/Packages\/Infrastructure", + "identifier" : "InfrastructureTests", + "name" : "InfrastructureTests" } } ],