Renamed the Web package as Infrastructure (#24)
Reviewed-on: rock-n-code/loud-amsterdam#24 Co-authored-by: Javier Cicchelli <javier@rock-n-code.com> Co-committed-by: Javier Cicchelli <javier@rock-n-code.com>
This commit is contained in:
+6
-6
@@ -15,8 +15,8 @@
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "Web"
|
||||
BuildableName = "Web"
|
||||
BlueprintIdentifier = "Infrastructure"
|
||||
BuildableName = "Infrastructure"
|
||||
ReferencedContainer = "container:">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
@@ -33,8 +33,8 @@
|
||||
skipped = "NO">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "WebTests"
|
||||
BuildableName = "WebTests"
|
||||
BlueprintIdentifier = "InfrastructureTests"
|
||||
BuildableName = "InfrastructureTests"
|
||||
ReferencedContainer = "container:">
|
||||
</BuildableReference>
|
||||
</TestableReference>
|
||||
@@ -61,8 +61,8 @@
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "Web"
|
||||
BuildableName = "Web"
|
||||
BlueprintIdentifier = "Infrastructure"
|
||||
BuildableName = "Infrastructure"
|
||||
ReferencedContainer = "container:">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
@@ -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"
|
||||
+1
-1
@@ -3,7 +3,7 @@ import HummingbirdTesting
|
||||
import NIOCore
|
||||
import Testing
|
||||
|
||||
@testable import Web
|
||||
@testable import Infrastructure
|
||||
|
||||
@Suite("addController method")
|
||||
struct RouterMethodsTests {
|
||||
+1
-1
@@ -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 {
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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).
|
||||
|
||||
@@ -3,7 +3,7 @@ import Hummingbird
|
||||
import HummingbirdCompression
|
||||
import Logging
|
||||
import Persistence
|
||||
import Web
|
||||
import Infrastructure
|
||||
import WebsiteLibrary
|
||||
|
||||
/// Builds the website application.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import Hummingbird
|
||||
import NIOCore
|
||||
import Persistence
|
||||
import Web
|
||||
import Infrastructure
|
||||
|
||||
/// Serves the website's health-check routes.
|
||||
///
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import Hummingbird
|
||||
import Web
|
||||
import Infrastructure
|
||||
|
||||
/// Serves the website's root routes.
|
||||
///
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -48,9 +48,9 @@
|
||||
},
|
||||
{
|
||||
"target" : {
|
||||
"containerPath" : "container:..\/..\/Packages\/Web",
|
||||
"identifier" : "WebTests",
|
||||
"name" : "WebTests"
|
||||
"containerPath" : "container:..\/..\/Packages\/Infrastructure",
|
||||
"identifier" : "InfrastructureTests",
|
||||
"name" : "InfrastructureTests"
|
||||
}
|
||||
}
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user