refactor: clean up duplicate imports and dead code
- Merge type and value imports from the same module into single imports - Remove dead import-badges action (flow uses /api/admin/import/badges) - Remove unused babel-plugin-react-compiler devDependency - Remove stray test.txt file - Update knip config: track css imports, drop redundant ignore entries - Update contract test to drop obsolete dead-action assertion
This commit is contained in:
1 parent
76730b84cf
commit
ae1393d3e3
15 files changed
+45
-75
No files matched your search
@@ -7,16 +7,7 @@
|
|||||||
"src/app/**/{error,not-found,loading,template,default,global-error}.{ts,tsx}",
|
"src/app/**/{error,not-found,loading,template,default,global-error}.{ts,tsx}",
|
||||||
"scripts/migrate-aes-cbc-to-gcm.ts"
|
"scripts/migrate-aes-cbc-to-gcm.ts"
|
||||||
],
|
],
|
||||||
"project": ["src/**/*.{ts,tsx}", "scripts/**/*.{ts,js}"],
|
"project": ["src/**/*.{ts,tsx,css}", "scripts/**/*.{ts,js}"],
|
||||||
"ignoreDependencies": [
|
"ignoreDependencies": ["@sentry/nextjs", "pino-pretty", "husky"],
|
||||||
"tailwindcss-animate",
|
|
||||||
"@tailwindcss/forms",
|
|
||||||
"@tailwindcss/typography",
|
|
||||||
"pino-pretty",
|
|
||||||
"tailwindcss",
|
|
||||||
"husky",
|
|
||||||
"@sentry/nextjs"
|
|
||||||
],
|
|
||||||
"ignore": ["src/actions/import-badges.ts"],
|
|
||||||
"ignoreBinaries": ["sendmail"]
|
"ignoreBinaries": ["sendmail"]
|
||||||
}
|
}
|
||||||
@@ -75,7 +75,6 @@
|
|||||||
"@types/react": "19.2.18",
|
"@types/react": "19.2.18",
|
||||||
"@types/react-dom": "19.2.4",
|
"@types/react-dom": "19.2.4",
|
||||||
"@vitest/coverage-v8": "4.1.10",
|
"@vitest/coverage-v8": "4.1.10",
|
||||||
"babel-plugin-react-compiler": "^1.0.0",
|
|
||||||
"dotenv": "^17.4.2",
|
"dotenv": "^17.4.2",
|
||||||
"drizzle-kit": "^0.31.10",
|
"drizzle-kit": "^0.31.10",
|
||||||
"husky": "^9.1.7",
|
"husky": "^9.1.7",
|
||||||
|
|||||||
Generated
+1
-3
@@ -164,9 +164,6 @@ importers:
|
|||||||
'@vitest/coverage-v8':
|
'@vitest/coverage-v8':
|
||||||
specifier: 4.1.10
|
specifier: 4.1.10
|
||||||
version: 4.1.10([email protected])
|
version: 4.1.10([email protected])
|
||||||
babel-plugin-react-compiler:
|
|
||||||
specifier: ^1.0.0
|
|
||||||
version: 1.0.0
|
|
||||||
dotenv:
|
dotenv:
|
||||||
specifier: ^17.4.2
|
specifier: ^17.4.2
|
||||||
version: 17.4.2
|
version: 17.4.2
|
||||||
@@ -4318,6 +4315,7 @@ snapshots:
|
|||||||
[email protected]:
|
[email protected]:
|
||||||
dependencies:
|
dependencies:
|
||||||
'@babel/types': 7.29.8
|
'@babel/types': 7.29.8
|
||||||
|
optional: true
|
||||||
|
|
||||||
[email protected]: {}
|
[email protected]: {}
|
||||||
|
|
||||||
|
|||||||
@@ -1,22 +0,0 @@
|
|||||||
"use server";
|
|
||||||
|
|
||||||
import { requirePermission } from "@/lib/admin/guard";
|
|
||||||
import { PERMS } from "@/lib/permissions";
|
|
||||||
import { importBadgeSynced } from "@/lib/services/import-badge";
|
|
||||||
|
|
||||||
export async function importBadgeFromRemote({
|
|
||||||
code,
|
|
||||||
name,
|
|
||||||
description,
|
|
||||||
}: {
|
|
||||||
code: string;
|
|
||||||
name: string;
|
|
||||||
description: string;
|
|
||||||
}) {
|
|
||||||
await requirePermission(PERMS.ASSETS_IMPORT);
|
|
||||||
const result = await importBadgeSynced({ code, name, description });
|
|
||||||
if (!result.ok) {
|
|
||||||
return { ok: false as const, error: result.error };
|
|
||||||
}
|
|
||||||
return { ok: true as const };
|
|
||||||
}
|
|
||||||
@@ -2,8 +2,7 @@
|
|||||||
|
|
||||||
import { Languages, Package, Settings } from "lucide-react";
|
import { Languages, Package, Settings } from "lucide-react";
|
||||||
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
|
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
|
||||||
import type { CatalogItemData } from "./catalog-items-table";
|
import { type CatalogItemData, CatalogItemsTable } from "./catalog-items-table";
|
||||||
import { CatalogItemsTable } from "./catalog-items-table";
|
|
||||||
import { CatalogPageForm } from "./catalog-page-form";
|
import { CatalogPageForm } from "./catalog-page-form";
|
||||||
import { CatalogTranslateTab } from "./catalog-translate-tab";
|
import { CatalogTranslateTab } from "./catalog-translate-tab";
|
||||||
|
|
||||||
|
|||||||
@@ -90,8 +90,14 @@ import {
|
|||||||
} from "./field-helpers";
|
} from "./field-helpers";
|
||||||
import { FurniIcon } from "./furni-icon";
|
import { FurniIcon } from "./furni-icon";
|
||||||
import { SongPicker } from "./song-picker";
|
import { SongPicker } from "./song-picker";
|
||||||
import type { BaseItemData, CatalogItemData, InlineEdit } from "./types";
|
import {
|
||||||
import { DEFAULT_NEW_ITEM, getPointsLabel, POINTS_TYPES } from "./types";
|
type BaseItemData,
|
||||||
|
type CatalogItemData,
|
||||||
|
DEFAULT_NEW_ITEM,
|
||||||
|
getPointsLabel,
|
||||||
|
type InlineEdit,
|
||||||
|
POINTS_TYPES,
|
||||||
|
} from "./types";
|
||||||
|
|
||||||
export type { BaseItemData, CatalogItemData };
|
export type { BaseItemData, CatalogItemData };
|
||||||
|
|
||||||
|
|||||||
@@ -11,13 +11,14 @@ import {
|
|||||||
} from "@/components/ui/select";
|
} from "@/components/ui/select";
|
||||||
import {
|
import {
|
||||||
getCachedSongPickerOptions,
|
getCachedSongPickerOptions,
|
||||||
|
invalidateSongPickerCache,
|
||||||
loadSongPickerOptions,
|
loadSongPickerOptions,
|
||||||
type SoundtrackOption,
|
type SoundtrackOption,
|
||||||
} from "@/lib/client-cache/song-picker-cache";
|
} from "@/lib/client-cache/song-picker-cache";
|
||||||
|
|
||||||
// Re-export so existing `import { invalidateSongPickerCache } from '.../song-picker'`
|
// Re-export so existing `import { invalidateSongPickerCache } from '.../song-picker'`
|
||||||
// callsites keep working. New code should import from the lib module directly.
|
// callsites keep working. New code should import from the lib module directly.
|
||||||
export { invalidateSongPickerCache } from "@/lib/client-cache/song-picker-cache";
|
export { invalidateSongPickerCache };
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
value: number;
|
value: number;
|
||||||
|
|||||||
@@ -16,8 +16,10 @@ import { useCallback, useEffect, useMemo, useState } from "react";
|
|||||||
import { toast } from "sonner";
|
import { toast } from "sonner";
|
||||||
import { updateCatalogPage } from "@/actions/catalog";
|
import { updateCatalogPage } from "@/actions/catalog";
|
||||||
import { updateBcPage } from "@/actions/catalog-bc";
|
import { updateBcPage } from "@/actions/catalog-bc";
|
||||||
import type { CatalogItemData } from "@/app/admin/catalog/[id]/catalog-items-table";
|
import {
|
||||||
import { CatalogItemsTable } from "@/app/admin/catalog/[id]/catalog-items-table";
|
type CatalogItemData,
|
||||||
|
CatalogItemsTable,
|
||||||
|
} from "@/app/admin/catalog/[id]/catalog-items-table";
|
||||||
import { CatalogTranslateTab } from "@/app/admin/catalog/[id]/catalog-translate-tab";
|
import { CatalogTranslateTab } from "@/app/admin/catalog/[id]/catalog-translate-tab";
|
||||||
import { BulkImportItems } from "@/components/admin/catalog/bulk-import-items";
|
import { BulkImportItems } from "@/components/admin/catalog/bulk-import-items";
|
||||||
import { CatalogImagePicker } from "@/components/admin/catalog/catalog-image-picker";
|
import { CatalogImagePicker } from "@/components/admin/catalog/catalog-image-picker";
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { Crown, Image as ImageIcon, Package, Sparkles } from "lucide-react";
|
import { Crown, Image as ImageIcon, Package, Sparkles } from "lucide-react";
|
||||||
import type { CatalogItemData } from "@/app/admin/catalog/[id]/catalog-items-table/types";
|
import {
|
||||||
import { getPointsLabel } from "@/app/admin/catalog/[id]/catalog-items-table/types";
|
type CatalogItemData,
|
||||||
|
getPointsLabel,
|
||||||
|
} from "@/app/admin/catalog/[id]/catalog-items-table/types";
|
||||||
import {
|
import {
|
||||||
CurrencyIcon,
|
CurrencyIcon,
|
||||||
currencyKindFromPointsType,
|
currencyKindFromPointsType,
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import type { LucideIcon } from "lucide-react";
|
|
||||||
import {
|
import {
|
||||||
Activity,
|
Activity,
|
||||||
AlertTriangle,
|
AlertTriangle,
|
||||||
@@ -19,6 +18,7 @@ import {
|
|||||||
Languages,
|
Languages,
|
||||||
LayoutDashboard,
|
LayoutDashboard,
|
||||||
ListOrdered,
|
ListOrdered,
|
||||||
|
type LucideIcon,
|
||||||
Megaphone,
|
Megaphone,
|
||||||
Monitor,
|
Monitor,
|
||||||
Newspaper,
|
Newspaper,
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import type { NextRequest } from "next/server";
|
import { type NextRequest, NextResponse } from "next/server";
|
||||||
import { NextResponse } from "next/server";
|
|
||||||
import { logAuthorizationEvent } from "@/lib/admin/authorization-events";
|
import { logAuthorizationEvent } from "@/lib/admin/authorization-events";
|
||||||
import { validateCsrfToken } from "@/lib/foundation/security";
|
import { validateCsrfToken } from "@/lib/foundation/security";
|
||||||
import { canAccess, getApiAdminContext } from "@/lib/permissions";
|
import { canAccess, getApiAdminContext } from "@/lib/permissions";
|
||||||
|
|||||||
@@ -45,9 +45,6 @@ describe("admin import backend contract", () => {
|
|||||||
expect(service).toContain("ExternalTexts.json");
|
expect(service).toContain("ExternalTexts.json");
|
||||||
expect(service).toContain("WebsiteBadges");
|
expect(service).toContain("WebsiteBadges");
|
||||||
expect(service).toContain("importBadgeSynced");
|
expect(service).toContain("importBadgeSynced");
|
||||||
expect(readFileSync("src/actions/import-badges.ts", "utf8")).toContain(
|
|
||||||
"importBadgeSynced",
|
|
||||||
);
|
|
||||||
expect(
|
expect(
|
||||||
readFileSync("src/app/api/admin/import/badges/route.ts", "utf8"),
|
readFileSync("src/app/api/admin/import/badges/route.ts", "utf8"),
|
||||||
).toContain("importBadgeSynced");
|
).toContain("importBadgeSynced");
|
||||||
|
|||||||
@@ -4,23 +4,6 @@ import { and, eq, type SQL, sql } from "drizzle-orm";
|
|||||||
import { CatalogPages, db, ItemsBase } from "@/lib/db";
|
import { CatalogPages, db, ItemsBase } from "@/lib/db";
|
||||||
import { officialHabboEnrichmentWarning } from "@/lib/habbo-gamedata-hotel";
|
import { officialHabboEnrichmentWarning } from "@/lib/habbo-gamedata-hotel";
|
||||||
import { logger } from "@/lib/logger";
|
import { logger } from "@/lib/logger";
|
||||||
import {
|
|
||||||
appendFurniEntry,
|
|
||||||
buildFurniEntry,
|
|
||||||
removeFurniEntry,
|
|
||||||
} from "@/lib/services/furni-data";
|
|
||||||
import type { OfficialHabboFurniEntry } from "@/lib/services/habbo-furnidata-cache";
|
|
||||||
import { lookupOfficialHabboFurni } from "@/lib/services/habbo-furnidata-cache";
|
|
||||||
import { getHabboGamedataHotel } from "@/lib/services/habbo-gamedata-hotel";
|
|
||||||
|
|
||||||
// Re-export the download helpers now owned by the shared import core.
|
|
||||||
// Existing furni callers keep importing them from here.
|
|
||||||
export {
|
|
||||||
downloadFile,
|
|
||||||
validatePngBytes,
|
|
||||||
validateSwfBytes,
|
|
||||||
} from "@/lib/services/import/core/download";
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
DEFAULT_FURNI_ICON_DIR,
|
DEFAULT_FURNI_ICON_DIR,
|
||||||
DEFAULT_FURNI_NITRO_DIR,
|
DEFAULT_FURNI_NITRO_DIR,
|
||||||
@@ -28,14 +11,32 @@ import {
|
|||||||
getFurniAssetDirs,
|
getFurniAssetDirs,
|
||||||
getFurniAssetWriteTargets,
|
getFurniAssetWriteTargets,
|
||||||
} from "@/lib/services/furni-asset-dirs";
|
} from "@/lib/services/furni-asset-dirs";
|
||||||
import { downloadFile } from "@/lib/services/import/core/download";
|
|
||||||
import type { ConversionResult } from "@/lib/services/swf-to-nitro";
|
|
||||||
import {
|
import {
|
||||||
|
appendFurniEntry,
|
||||||
|
buildFurniEntry,
|
||||||
|
removeFurniEntry,
|
||||||
|
} from "@/lib/services/furni-data";
|
||||||
|
import {
|
||||||
|
lookupOfficialHabboFurni,
|
||||||
|
type OfficialHabboFurniEntry,
|
||||||
|
} from "@/lib/services/habbo-furnidata-cache";
|
||||||
|
import { getHabboGamedataHotel } from "@/lib/services/habbo-gamedata-hotel";
|
||||||
|
import {
|
||||||
|
downloadFile,
|
||||||
|
validatePngBytes,
|
||||||
|
validateSwfBytes,
|
||||||
|
} from "@/lib/services/import/core/download";
|
||||||
|
import {
|
||||||
|
type ConversionResult,
|
||||||
convertSwfToNitro,
|
convertSwfToNitro,
|
||||||
extractIconFromSwf,
|
extractIconFromSwf,
|
||||||
} from "@/lib/services/swf-to-nitro";
|
} from "@/lib/services/swf-to-nitro";
|
||||||
import type { ImportSingleResult } from "@/types/furni";
|
import type { ImportSingleResult } from "@/types/furni";
|
||||||
|
|
||||||
|
// Re-export the download helpers now owned by the shared import core.
|
||||||
|
// Existing furni callers keep importing them from here.
|
||||||
|
export { downloadFile, validatePngBytes, validateSwfBytes };
|
||||||
|
|
||||||
// ── Constants ────────────────────────────────────────────────────────
|
// ── Constants ────────────────────────────────────────────────────────
|
||||||
|
|
||||||
// turbopackIgnore hints: this module is reached by App Router routes; without
|
// turbopackIgnore hints: this module is reached by App Router routes; without
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { describe, expect, it, vi } from "vitest";
|
import { describe, expect, it, vi } from "vitest";
|
||||||
import type { CurrencyDb } from "./send-currency";
|
import { type CurrencyDb, sendCurrency } from "./send-currency";
|
||||||
|
|
||||||
vi.mock("@/lib/db", () => ({
|
vi.mock("@/lib/db", () => ({
|
||||||
db: {},
|
db: {},
|
||||||
@@ -9,8 +9,6 @@ vi.mock("@/lib/db", () => ({
|
|||||||
|
|
||||||
vi.mock("@/lib/services/rcon", () => ({}));
|
vi.mock("@/lib/services/rcon", () => ({}));
|
||||||
|
|
||||||
import { sendCurrency } from "./send-currency";
|
|
||||||
|
|
||||||
const mockDb = {} as CurrencyDb;
|
const mockDb = {} as CurrencyDb;
|
||||||
|
|
||||||
describe("sendCurrency", () => {
|
describe("sendCurrency", () => {
|
||||||
|
|||||||
Reference in new issue
Block a user