fix: prettier formatting and downgrade upload-artifact to v3 for Gitea
CI / Code Health (pull_request) Successful in 24s
CI / Lint, Test & Build (pull_request) Successful in 59s

This commit is contained in:
fristy committed 2026-09-12 00:47:38 +03:00
1 parent 7fa3a94278
commit ed149ded52
9 files changed
+32 -23

No files matched your search

+1 -1
View File
@@ -54,7 +54,7 @@ jobs:
run: | run: |
pipx run --spec desloppify desloppify scan --profile ci --path . --no-badge pipx run --spec desloppify desloppify scan --profile ci --path . --no-badge
- name: Upload scorecard - name: Upload scorecard
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v3
with: with:
name: desloppify-scorecard name: desloppify-scorecard
path: scorecard.png path: scorecard.png
+3 -1
View File
@@ -22,7 +22,9 @@ export async function GET(
try { try {
info = await getDiscordAppInfo(id); info = await getDiscordAppInfo(id);
} catch (error) { } catch (error) {
warnDev(`discord-app upstream failed: ${id} -> ${error instanceof Error ? error.message : error}`); warnDev(
`discord-app upstream failed: ${id} -> ${error instanceof Error ? error.message : error}`,
);
return jsonErrorWithCors({ error: "Upstream unavailable" }, 502, 60, origin); return jsonErrorWithCors({ error: "Upstream unavailable" }, 502, 60, origin);
} }
if (!info) { if (!info) {
+3 -1
View File
@@ -285,7 +285,9 @@ export function GameProfileModal({
</dl> </dl>
) : null} ) : null}
{profile ? <ModalReviews profile={profile} dict={dict} localeTag={localeTag} /> : null} {profile ? (
<ModalReviews profile={profile} dict={dict} localeTag={localeTag} />
) : null}
{profile?.itad && (bestPrice || historyLow) ? ( {profile?.itad && (bestPrice || historyLow) ? (
<ModalPrices <ModalPrices
+5 -1
View File
@@ -9,7 +9,11 @@ describe("ModalReviews", () => {
it("renders nothing without review sources", () => { it("renders nothing without review sources", () => {
const dict = getDictionary("en"); const dict = getDictionary("en");
const { container } = render( const { container } = render(
<ModalReviews profile={profileFixture()} dict={dict.discord.gameModal} localeTag="en-US" />, <ModalReviews
profile={profileFixture()}
dict={dict.discord.gameModal}
localeTag="en-US"
/>,
); );
expect(container.textContent).toBe(""); expect(container.textContent).toBe("");
}); });
+2 -9
View File
@@ -22,10 +22,7 @@ export function isAllowedOrigin(request: Request): boolean {
} }
function resolveAllowedOrigin(origin: string | null): string { function resolveAllowedOrigin(origin: string | null): string {
if ( if (origin !== null && (origin === ALLOWED_ORIGIN || (isDev() && DEV_ORIGINS.has(origin)))) {
origin !== null &&
(origin === ALLOWED_ORIGIN || (isDev() && DEV_ORIGINS.has(origin)))
) {
return origin; return origin;
} }
return ALLOWED_ORIGIN; return ALLOWED_ORIGIN;
@@ -79,11 +76,7 @@ export function jsonErrorWithCors(
}, },
}); });
} }
export function jsonWithCors( export function jsonWithCors(data: unknown, sMaxage = 3600, origin?: string | null): NextResponse {
data: unknown,
sMaxage = 3600,
origin?: string | null,
): NextResponse {
return NextResponse.json(data, { return NextResponse.json(data, {
headers: { headers: {
"Cache-Control": `public, s-maxage=${sMaxage}, stale-while-revalidate=86400`, "Cache-Control": `public, s-maxage=${sMaxage}, stale-while-revalidate=86400`,
+5 -1
View File
@@ -69,7 +69,11 @@ export function formatReleaseDate(value: string, localeTag: string): string {
return value; return value;
} }
export function formatCount(value: number | null | undefined, localeTag: string, unit: string): string { export function formatCount(
value: number | null | undefined,
localeTag: string,
unit: string,
): string {
if (value == null) { if (value == null) {
return "—"; return "—";
} }
+6 -1
View File
@@ -1,5 +1,10 @@
import { describe, expect, it } from "vitest"; import { describe, expect, it } from "vitest";
import { buildLinks, mergePeople, mergePlatforms, selectScreenshots } from "@/lib/game/game-profile"; import {
buildLinks,
mergePeople,
mergePlatforms,
selectScreenshots,
} from "@/lib/game/game-profile";
import type { IgdbGame } from "@/lib/game/game-profile-types"; import type { IgdbGame } from "@/lib/game/game-profile-types";
describe("mergePeople", () => { describe("mergePeople", () => {
+4 -5
View File
@@ -186,7 +186,9 @@ export function toPricePoint(p: ItadOverviewPrice["current"]): GamePricePoint |
export function mapItadBlock( export function mapItadBlock(
itadInfo: ItadGameInfo | null, itadInfo: ItadGameInfo | null,
priceEntry: { current?: ItadOverviewPrice["current"]; lowest?: ItadOverviewPrice["current"] } | undefined, priceEntry:
| { current?: ItadOverviewPrice["current"]; lowest?: ItadOverviewPrice["current"] }
| undefined,
): NonNullable<GameProfile["itad"]> | null { ): NonNullable<GameProfile["itad"]> | null {
if (!process.env.ITAD_API_KEY || (!itadInfo && !priceEntry)) { if (!process.env.ITAD_API_KEY || (!itadInfo && !priceEntry)) {
return null; return null;
@@ -197,10 +199,7 @@ export function mapItadBlock(
pageUrl: itadInfo?.urls?.game ?? null, pageUrl: itadInfo?.urls?.game ?? null,
playerCount: itadInfo?.players?.recent ?? null, playerCount: itadInfo?.players?.recent ?? null,
reviews: (itadInfo?.reviews ?? []) reviews: (itadInfo?.reviews ?? [])
.filter( .filter((r): r is ItadReview & { source: string; url: string } => !!r.source && !!r.url)
(r): r is ItadReview & { source: string; url: string } =>
!!r.source && !!r.url,
)
.map((r) => ({ .map((r) => ({
score: r.score ?? null, score: r.score ?? null,
source: r.source, source: r.source,
+3 -3
View File
@@ -25,9 +25,9 @@ describe("activityImageUrl", () => {
}); });
it("resolves Spotify keys", () => { it("resolves Spotify keys", () => {
expect(activityImageUrl(activity({ assets: { large_image: "spotify:img" } }), "large")).toBe( expect(
"https://i.scdn.co/image/img", activityImageUrl(activity({ assets: { large_image: "spotify:img" } }), "large"),
); ).toBe("https://i.scdn.co/image/img");
}); });
it("resolves app assets with application id", () => { it("resolves app assets with application id", () => {