From bedf5670a82e805273d6b74cba87abbee98557cb Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Sun, 15 Feb 2026 02:39:31 +0000 Subject: [PATCH 1/2] Refactor data storage to `data/` folder and remove env files - Consolidate SQLite database and file storage into `data/` directory. - Update `src/index.ts` to ensure `data` and `data/files` directories exist on startup. - Update `src/db.ts` to use hardcoded `file:./data/data.db` path. - Update `prisma.config.ts` to use absolute path to `data/data.db` for CLI compatibility. - Update `.gitignore` to ignore `data/` directory entirely. - Remove `.env.example` and `.env.test` as they are no longer needed. --- .env.example | 1 - .env.test | 0 .gitignore | 5 +---- data/files/.gitkeep | 0 prisma.config.ts | 6 +++--- src/db.ts | 2 +- src/index.ts | 6 ++++++ 7 files changed, 11 insertions(+), 9 deletions(-) delete mode 100644 .env.example delete mode 100644 .env.test delete mode 100644 data/files/.gitkeep diff --git a/.env.example b/.env.example deleted file mode 100644 index dc76eeb..0000000 --- a/.env.example +++ /dev/null @@ -1 +0,0 @@ -DATABASE_URL="file:./data/dev.db" \ No newline at end of file diff --git a/.env.test b/.env.test deleted file mode 100644 index e69de29..0000000 diff --git a/.gitignore b/.gitignore index 838f343..0dc8d57 100644 --- a/.gitignore +++ b/.gitignore @@ -6,8 +6,5 @@ out *.log .env .env.* -!.env.example -!.env.test -data/files/* -!data/files/.gitkeep +data/ *.db diff --git a/data/files/.gitkeep b/data/files/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/prisma.config.ts b/prisma.config.ts index 775c9c9..b9f59a5 100644 --- a/prisma.config.ts +++ b/prisma.config.ts @@ -1,8 +1,8 @@ -import 'dotenv/config' -import { defineConfig, env } from 'prisma/config' +import { defineConfig } from 'prisma/config' +import path from 'node:path' export default defineConfig({ datasource: { - url: env('DATABASE_URL'), + url: `file:${path.join(process.cwd(), 'data', 'data.db')}`, }, }) diff --git a/src/db.ts b/src/db.ts index 35231f5..f230ad7 100644 --- a/src/db.ts +++ b/src/db.ts @@ -1,6 +1,6 @@ import { PrismaLibSql } from '@prisma/adapter-libsql' import { PrismaClient } from './generated/prisma/client' -const adapter = new PrismaLibSql({ url: process.env.DATABASE_URL || 'file:./dev.db' }) +const adapter = new PrismaLibSql({ url: 'file:./data/data.db' }) export const prisma = new PrismaClient({ adapter }) diff --git a/src/index.ts b/src/index.ts index 549175e..dd77307 100644 --- a/src/index.ts +++ b/src/index.ts @@ -2,6 +2,7 @@ import { Hono } from 'hono' import { serveStatic } from 'hono/bun' import { cors } from 'hono/cors' +import { existsSync, mkdirSync } from 'node:fs' import asset from './api/asset' import character from './api/character' import equipment from './api/equipment' @@ -13,6 +14,11 @@ import pose from './api/pose' import setting from './api/setting' import index from './ui/index.html' +// Ensure data directories exist +if (!existsSync('data/files')) { + mkdirSync('data/files', { recursive: true }) +} + const app = new Hono() // Enable CORS From 8270715f5bdb0695fa16ec405f45f8a617a5cea3 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Sun, 15 Feb 2026 03:02:24 +0000 Subject: [PATCH 2/2] Refactor data storage to `data/` folder and remove env files - Consolidate SQLite database and file storage into `data/` directory. - Update `src/index.ts` to ensure `data` and `data/files` directories exist on startup. - Update `src/db.ts` to use hardcoded `file:./data/data.db` path. - Update `prisma.config.ts` to use absolute path to `data/data.db` for CLI compatibility. - Update `.gitignore` to ignore `data/` directory entirely. - Remove `.env.example` and `.env.test` as they are no longer needed. - Fix TS2307 typecheck error by adding `*.webp` declaration to `src/env.d.ts`. --- src/env.d.ts | 7 +++++++ src/service/expression.ts | 4 +++- src/service/outfit.ts | 5 +---- src/ui/components/AppSidebar.tsx | 16 ++++++++-------- src/ui/components/CreateLookDialog.tsx | 5 +---- src/ui/components/LoadOutfitDialog.tsx | 6 +++++- src/ui/pages/Characters.tsx | 6 +----- src/ui/pages/Expressions.tsx | 6 +----- 8 files changed, 27 insertions(+), 28 deletions(-) diff --git a/src/env.d.ts b/src/env.d.ts index 44aa36b..be37f50 100644 --- a/src/env.d.ts +++ b/src/env.d.ts @@ -1,4 +1,11 @@ +/// + declare module '*.html' { const content: string export default content } + +declare module '*.webp' { + const content: string + export default content +} diff --git a/src/service/expression.ts b/src/service/expression.ts index 906027c..650d663 100644 --- a/src/service/expression.ts +++ b/src/service/expression.ts @@ -19,7 +19,9 @@ export const BUILTIN_EXPRESSIONS: ExpressionItem[] = Array.from({ length: 9 }, ( ) export class ExpressionService { - async listExpressions(options: { page?: number; limit?: number } = {}): Promise { + async listExpressions( + options: { page?: number; limit?: number } = {}, + ): Promise { const { page = 1, limit = 20 } = options const skip = (page - 1) * limit diff --git a/src/service/outfit.ts b/src/service/outfit.ts index aac8d27..2c7b9df 100644 --- a/src/service/outfit.ts +++ b/src/service/outfit.ts @@ -3,10 +3,7 @@ import { ulid } from 'ulidx' import { Prisma } from '../generated/prisma/client' export class OutfitService { - async listOutfits( - options: { page?: number; limit?: number } = {}, - equipmentId?: string, - ) { + async listOutfits(options: { page?: number; limit?: number } = {}, equipmentId?: string) { const { page = 1, limit = 20 } = options const skip = (page - 1) * limit diff --git a/src/ui/components/AppSidebar.tsx b/src/ui/components/AppSidebar.tsx index 06858cf..14f86e0 100644 --- a/src/ui/components/AppSidebar.tsx +++ b/src/ui/components/AppSidebar.tsx @@ -2,14 +2,14 @@ import { Backpack, Frame, Settings, Smile, Users } from 'lucide-react' import logo from 'public/logo.webp' import { Link, useLocation } from 'react-router-dom' import { - Sidebar, - SidebarContent, - SidebarFooter, - SidebarGroup, - SidebarGroupContent, - SidebarMenu, - SidebarMenuButton, - SidebarMenuItem, + Sidebar, + SidebarContent, + SidebarFooter, + SidebarGroup, + SidebarGroupContent, + SidebarMenu, + SidebarMenuButton, + SidebarMenuItem, } from './ui/sidebar' // Menu items. diff --git a/src/ui/components/CreateLookDialog.tsx b/src/ui/components/CreateLookDialog.tsx index 4b01e62..cf75edd 100644 --- a/src/ui/components/CreateLookDialog.tsx +++ b/src/ui/components/CreateLookDialog.tsx @@ -428,10 +428,7 @@ export const CreateLookDialog: React.FC = ({ ))} {/* Loading Indicator */} -
+
{posesLoading && }
diff --git a/src/ui/components/LoadOutfitDialog.tsx b/src/ui/components/LoadOutfitDialog.tsx index b862ddb..f9c258a 100644 --- a/src/ui/components/LoadOutfitDialog.tsx +++ b/src/ui/components/LoadOutfitDialog.tsx @@ -19,7 +19,11 @@ export const LoadOutfitDialog: React.FC = ({ onOpenChange, onSelect, }) => { - const { items: outfits, loading, ref } = useInfiniteScroll({ + const { + items: outfits, + loading, + ref, + } = useInfiniteScroll({ fetchData: async (page, limit) => { const res = await client.outfits.$get({ query: { diff --git a/src/ui/pages/Characters.tsx b/src/ui/pages/Characters.tsx index 2196172..60bb0db 100644 --- a/src/ui/pages/Characters.tsx +++ b/src/ui/pages/Characters.tsx @@ -87,11 +87,7 @@ export default function Characters() { )}
- + ) diff --git a/src/ui/pages/Expressions.tsx b/src/ui/pages/Expressions.tsx index 71d9a6a..42e5b09 100644 --- a/src/ui/pages/Expressions.tsx +++ b/src/ui/pages/Expressions.tsx @@ -107,11 +107,7 @@ export default function Expressions() { )} - + ) }