Renamed the WebsiteCore target in the Website service package as WebsiteLibrary. (#14)

This PR contains the work done to rename the _Website_ service's library SwiftPM target from `WebsiteCore` to `WebsiteLibrary`, updating every reference across the manifest, source, tests, Xcode schemes, and documentations.

Reviewed-on: rock-n-code/loud-amsterdam#14
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:
2026-07-11 09:41:21 +00:00
committed by javier
parent dc6b22e648
commit a0f5c79434
16 changed files with 31 additions and 26 deletions
@@ -26,8 +26,13 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
shouldAutocreateTestPlan = "YES">
shouldUseLaunchSchemeArgsEnv = "YES">
<TestPlans>
<TestPlanReference
reference = "container:Tests/Website.xctestplan"
default = "YES">
</TestPlanReference>
</TestPlans>
<Testables>
<TestableReference
skipped = "NO">
@@ -18,8 +18,8 @@
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "WebsiteCoreTests"
BuildableName = "WebsiteCoreTests"
BlueprintIdentifier = "WebsiteLibraryTests"
BuildableName = "WebsiteLibraryTests"
ReferencedContainer = "container:">
</BuildableReference>
</TestableReference>
+5 -5
View File
@@ -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"
+4 -4
View File
@@ -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
@@ -3,7 +3,7 @@ import Hummingbird
import HummingbirdCompression
import Logging
import Persistence
import WebsiteCore
import WebsiteLibrary
/// Builds the website application.
///
@@ -2,7 +2,7 @@ import Configuration
import Hummingbird
import Logging
import Persistence
import WebsiteCore
import WebsiteLibrary
package extension ConfigReader {
+1 -1
View File
@@ -7,7 +7,7 @@ import NIOCore
import Testing
@testable import Website
@testable import WebsiteCore
@testable import WebsiteLibrary
@Suite("App executable")
struct AppTests {
@@ -1,7 +1,7 @@
import Foundation
import Testing
@testable import WebsiteCore
@testable import WebsiteLibrary
@Suite("StaticFile enumeration")
struct StaticFileTests {
@@ -2,7 +2,7 @@ import Elementary
import Foundation
import Testing
@testable import WebsiteCore
@testable import WebsiteLibrary
@Suite("ErrorPage page")
struct ErrorPageTests {
@@ -2,7 +2,7 @@ import Elementary
import Foundation
import Testing
@testable import WebsiteCore
@testable import WebsiteLibrary
@Suite("IndexPage page")
struct IndexPageTests {
@@ -5,7 +5,7 @@ import NIOCore
import Persistence
import Testing
@testable import WebsiteCore
@testable import WebsiteLibrary
@Suite("HealthController controller")
struct HealthControllerTests {
@@ -3,7 +3,7 @@ import HummingbirdTesting
import NIOCore
import Testing
@testable import WebsiteCore
@testable import WebsiteLibrary
@Suite("RootController controller")
struct RootControllerTests {
@@ -4,7 +4,7 @@ import HummingbirdTesting
import NIOCore
import Testing
@testable import WebsiteCore
@testable import WebsiteLibrary
@Suite("LocalizationMiddleware middleware")
struct LocalizationMiddlewareTests {
@@ -3,7 +3,7 @@ import HummingbirdTesting
import NIOCore
import Testing
@testable import WebsiteCore
@testable import WebsiteLibrary
@Suite("NotFoundMiddleware middleware")
struct NotFoundMiddlewareTests {
@@ -2,7 +2,7 @@ import Hummingbird
import HummingbirdTesting
import Testing
@testable import WebsiteCore
@testable import WebsiteLibrary
@Suite("SecurityHeadersMiddleware middleware")
struct SecurityHeadersMiddlewareTests {
@@ -28,8 +28,8 @@
{
"target" : {
"containerPath" : "container:",
"identifier" : "WebsiteCoreTests",
"name" : "WebsiteCoreTests"
"identifier" : "WebsiteLibraryTests",
"name" : "WebsiteLibraryTests"
}
}
],