diff --git a/Services/Website/.swiftpm/xcode/xcshareddata/xcschemes/Website.xcscheme b/Services/Website/.swiftpm/xcode/xcshareddata/xcschemes/Website.xcscheme index 2700a30..fe904d8 100644 --- a/Services/Website/.swiftpm/xcode/xcshareddata/xcschemes/Website.xcscheme +++ b/Services/Website/.swiftpm/xcode/xcshareddata/xcschemes/Website.xcscheme @@ -26,8 +26,13 @@ buildConfiguration = "Debug" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" - shouldUseLaunchSchemeArgsEnv = "YES" - shouldAutocreateTestPlan = "YES"> + shouldUseLaunchSchemeArgsEnv = "YES"> + + + + diff --git a/Services/Website/.swiftpm/xcode/xcshareddata/xcschemes/WebsiteCoreTests.xcscheme b/Services/Website/.swiftpm/xcode/xcshareddata/xcschemes/WebsiteLibraryTests.xcscheme similarity index 93% rename from Services/Website/.swiftpm/xcode/xcshareddata/xcschemes/WebsiteCoreTests.xcscheme rename to Services/Website/.swiftpm/xcode/xcshareddata/xcschemes/WebsiteLibraryTests.xcscheme index d5af719..c86f644 100644 --- a/Services/Website/.swiftpm/xcode/xcshareddata/xcschemes/WebsiteCoreTests.xcscheme +++ b/Services/Website/.swiftpm/xcode/xcshareddata/xcschemes/WebsiteLibraryTests.xcscheme @@ -18,8 +18,8 @@ skipped = "NO"> diff --git a/Services/Website/Package.swift b/Services/Website/Package.swift index 5f7eeea..fdd8c5d 100644 --- a/Services/Website/Package.swift +++ b/Services/Website/Package.swift @@ -15,7 +15,7 @@ let package = Package( name: "Website", targets: [ "Website", - "WebsiteCore", + "WebsiteLibrary", ] ) ], @@ -56,7 +56,7 @@ let package = Package( name: "Website", dependencies: [ .byName(name: "Persistence"), - .byName(name: "WebsiteCore"), + .byName(name: "WebsiteLibrary"), .product( name: "Configuration", package: "swift-configuration" @@ -73,7 +73,7 @@ let package = Package( path: "Sources/App" ), .target( - name: "WebsiteCore", + name: "WebsiteLibrary", dependencies: [ .byName(name: "Localization"), .byName(name: "Persistence"), @@ -113,9 +113,9 @@ let package = Package( path: "Tests/App" ), .testTarget( - name: "WebsiteCoreTests", + name: "WebsiteLibraryTests", dependencies: [ - .byName(name: "WebsiteCore"), + .byName(name: "WebsiteLibrary"), .product( name: "Elementary", package: "elementary" diff --git a/Services/Website/README.md b/Services/Website/README.md index 5bccb5c..c705916 100644 --- a/Services/Website/README.md +++ b/Services/Website/README.md @@ -4,7 +4,7 @@ The **Loud** public website service — a [Hummingbird](https://github.com/hummi ## Overview The service: - Serves the landing page at `GET /` (rendered once per supported language with [Elementary](https://github.com/elementary-swift/elementary) and cached). -- Negotiates each request's language from its `Accept-Language` header against the languages in the `WebsiteCore` String Catalog, falling back to the default (`en`); pages are served from the per-language cache with `Content-Language` and `Vary: Accept-Language` headers. +- Negotiates each request's language from its `Accept-Language` header against the languages in the `WebsiteLibrary` String Catalog, falling back to the default (`en`); pages are served from the per-language cache with `Content-Language` and `Vary: Accept-Language` headers. - Answers a liveness check at `GET /health` with a static JSON payload, and a readiness check at `GET /health/ready` that reports whether the database is reachable (`200` ready / `503` unavailable). - Serves static files (CSS, JS, icons, manifest, `robots.txt`) from `Resources/Static` via Hummingbird's `FileMiddleware`, tagged with media-type-specific `Cache-Control`. - Returns a custom HTML 404 page, localized like the landing page, for any request that matches neither a route nor a static file. @@ -22,10 +22,10 @@ Two SwiftPM targets: | Target | Kind | Path | Role | | --- | --- | --- | --- | | `Website` | executable | `Sources/App` | Entry point: reads configuration, builds the persistence service, and either serves the website or runs the migrate-and-exit mode. | -| `WebsiteCore` | library | `Sources/Library` | Controllers, middlewares, pages, cached responses, and configuration helpers. | +| `WebsiteLibrary` | library | `Sources/Library` | Controllers, middlewares, pages, cached responses, and configuration helpers. | The `Website` executable depends on two local packages: -- `Localization` (`Packages/Localization`) — the `Localize` and `Negotiate` helpers and the `LanguageList` of catalog languages (used by `WebsiteCore`). +- `Localization` (`Packages/Localization`) — the `Localize` and `Negotiate` helpers and the `LanguageList` of catalog languages (used by `WebsiteLibrary`). - `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). @@ -164,7 +164,7 @@ make pkg-test # = swift test --disable-xctest --enable-code-coverage --enable-swift-testing --parallel ``` -Tests use the [Swift Testing](https://developer.apple.com/documentation/testing/) framework. The `Website.xctestplan` covers two targets: `WebsiteTests` (the executable/integration tests) and `WebsiteCoreTests` (the library unit tests). +Tests use the [Swift Testing](https://developer.apple.com/documentation/testing/) framework. The `Website.xctestplan` covers two targets: `WebsiteTests` (the executable/integration tests) and `WebsiteLibraryTests` (the library unit tests). The `Persistence` package has its own suite (run it from `Packages/Persistence`). Its tests run against the in-memory backend by default; the MySQL integration test is skipped unless a database is pointed at via `MYSQL_TEST_HOST` (with optional `MYSQL_TEST_PORT`/`NAME`/`USERNAME`/`PASSWORD`), so `swift test` stays runnable with no database: ```sh diff --git a/Services/Website/Sources/App/Extensions/App+Build.swift b/Services/Website/Sources/App/Extensions/App+Build.swift index 06a167b..dad5ec7 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 WebsiteCore +import WebsiteLibrary /// Builds the website application. /// diff --git a/Services/Website/Sources/App/Extensions/ConfigReader+Properties.swift b/Services/Website/Sources/App/Extensions/ConfigReader+Properties.swift index 0ddb7a8..2f9fdc2 100644 --- a/Services/Website/Sources/App/Extensions/ConfigReader+Properties.swift +++ b/Services/Website/Sources/App/Extensions/ConfigReader+Properties.swift @@ -2,7 +2,7 @@ import Configuration import Hummingbird import Logging import Persistence -import WebsiteCore +import WebsiteLibrary package extension ConfigReader { diff --git a/Services/Website/Tests/App/AppTests.swift b/Services/Website/Tests/App/AppTests.swift index e5ed3a7..a677a32 100644 --- a/Services/Website/Tests/App/AppTests.swift +++ b/Services/Website/Tests/App/AppTests.swift @@ -7,7 +7,7 @@ import NIOCore import Testing @testable import Website -@testable import WebsiteCore +@testable import WebsiteLibrary @Suite("App executable") struct AppTests { diff --git a/Services/Website/Tests/Library/Cases/Internal/Enumerations/StaticFileTests.swift b/Services/Website/Tests/Library/Cases/Internal/Enumerations/StaticFileTests.swift index 284009c..110bca2 100644 --- a/Services/Website/Tests/Library/Cases/Internal/Enumerations/StaticFileTests.swift +++ b/Services/Website/Tests/Library/Cases/Internal/Enumerations/StaticFileTests.swift @@ -1,7 +1,7 @@ import Foundation import Testing -@testable import WebsiteCore +@testable import WebsiteLibrary @Suite("StaticFile enumeration") struct StaticFileTests { diff --git a/Services/Website/Tests/Library/Cases/Internal/Pages/ErrorPageTests.swift b/Services/Website/Tests/Library/Cases/Internal/Pages/ErrorPageTests.swift index 463a357..7e03844 100644 --- a/Services/Website/Tests/Library/Cases/Internal/Pages/ErrorPageTests.swift +++ b/Services/Website/Tests/Library/Cases/Internal/Pages/ErrorPageTests.swift @@ -2,7 +2,7 @@ import Elementary import Foundation import Testing -@testable import WebsiteCore +@testable import WebsiteLibrary @Suite("ErrorPage page") struct ErrorPageTests { diff --git a/Services/Website/Tests/Library/Cases/Internal/Pages/IndexPageTests.swift b/Services/Website/Tests/Library/Cases/Internal/Pages/IndexPageTests.swift index be76e76..254b6e3 100644 --- a/Services/Website/Tests/Library/Cases/Internal/Pages/IndexPageTests.swift +++ b/Services/Website/Tests/Library/Cases/Internal/Pages/IndexPageTests.swift @@ -2,7 +2,7 @@ import Elementary import Foundation import Testing -@testable import WebsiteCore +@testable import WebsiteLibrary @Suite("IndexPage page") struct IndexPageTests { diff --git a/Services/Website/Tests/Library/Cases/Public/Controllers/HealthControllerTests.swift b/Services/Website/Tests/Library/Cases/Public/Controllers/HealthControllerTests.swift index 5b3c547..f27ec95 100644 --- a/Services/Website/Tests/Library/Cases/Public/Controllers/HealthControllerTests.swift +++ b/Services/Website/Tests/Library/Cases/Public/Controllers/HealthControllerTests.swift @@ -5,7 +5,7 @@ import NIOCore import Persistence import Testing -@testable import WebsiteCore +@testable import WebsiteLibrary @Suite("HealthController controller") struct HealthControllerTests { diff --git a/Services/Website/Tests/Library/Cases/Public/Controllers/RootControllerTests.swift b/Services/Website/Tests/Library/Cases/Public/Controllers/RootControllerTests.swift index 6f0cd7f..9fb321f 100644 --- a/Services/Website/Tests/Library/Cases/Public/Controllers/RootControllerTests.swift +++ b/Services/Website/Tests/Library/Cases/Public/Controllers/RootControllerTests.swift @@ -3,7 +3,7 @@ import HummingbirdTesting import NIOCore import Testing -@testable import WebsiteCore +@testable import WebsiteLibrary @Suite("RootController controller") struct RootControllerTests { diff --git a/Services/Website/Tests/Library/Cases/Public/Middlewares/LocalizationMiddlewareTests.swift b/Services/Website/Tests/Library/Cases/Public/Middlewares/LocalizationMiddlewareTests.swift index 09046af..607bc3a 100644 --- a/Services/Website/Tests/Library/Cases/Public/Middlewares/LocalizationMiddlewareTests.swift +++ b/Services/Website/Tests/Library/Cases/Public/Middlewares/LocalizationMiddlewareTests.swift @@ -4,7 +4,7 @@ import HummingbirdTesting import NIOCore import Testing -@testable import WebsiteCore +@testable import WebsiteLibrary @Suite("LocalizationMiddleware middleware") struct LocalizationMiddlewareTests { diff --git a/Services/Website/Tests/Library/Cases/Public/Middlewares/NotFoundMiddlewareTests.swift b/Services/Website/Tests/Library/Cases/Public/Middlewares/NotFoundMiddlewareTests.swift index 8ac9e09..5aadb6b 100644 --- a/Services/Website/Tests/Library/Cases/Public/Middlewares/NotFoundMiddlewareTests.swift +++ b/Services/Website/Tests/Library/Cases/Public/Middlewares/NotFoundMiddlewareTests.swift @@ -3,7 +3,7 @@ import HummingbirdTesting import NIOCore import Testing -@testable import WebsiteCore +@testable import WebsiteLibrary @Suite("NotFoundMiddleware middleware") struct NotFoundMiddlewareTests { diff --git a/Services/Website/Tests/Library/Cases/Public/Middlewares/SecurityHeadersMiddlewareTests.swift b/Services/Website/Tests/Library/Cases/Public/Middlewares/SecurityHeadersMiddlewareTests.swift index 9ea5221..224f303 100644 --- a/Services/Website/Tests/Library/Cases/Public/Middlewares/SecurityHeadersMiddlewareTests.swift +++ b/Services/Website/Tests/Library/Cases/Public/Middlewares/SecurityHeadersMiddlewareTests.swift @@ -2,7 +2,7 @@ import Hummingbird import HummingbirdTesting import Testing -@testable import WebsiteCore +@testable import WebsiteLibrary @Suite("SecurityHeadersMiddleware middleware") struct SecurityHeadersMiddlewareTests { diff --git a/Services/Website/Website.xctestplan b/Services/Website/Tests/Website.xctestplan similarity index 88% rename from Services/Website/Website.xctestplan rename to Services/Website/Tests/Website.xctestplan index 5156232..1d7b818 100644 --- a/Services/Website/Website.xctestplan +++ b/Services/Website/Tests/Website.xctestplan @@ -28,8 +28,8 @@ { "target" : { "containerPath" : "container:", - "identifier" : "WebsiteCoreTests", - "name" : "WebsiteCoreTests" + "identifier" : "WebsiteLibraryTests", + "name" : "WebsiteLibraryTests" } } ],