style: Better organization in /src/lib/

This commit is contained in:
April Hall 2025-02-06 23:40:51 -05:00
parent 30c0cae551
commit 63690dcd2a
Signed by: arithefirst
GPG Key ID: 4508A15C4DB91C5B
8 changed files with 8 additions and 10 deletions

View File

@ -1,5 +1,5 @@
<script lang="ts"> <script lang="ts">
import { type TypeMessage } from '$lib'; import { type TypeMessage } from '$lib/types';
const { message, imageSrc, user }: TypeMessage = $props(); const { message, imageSrc, user }: TypeMessage = $props();
</script> </script>

View File

@ -1,4 +1,4 @@
import type { TypeMessage, TypeFullMessage } from '$lib'; import type { TypeMessage, TypeFullMessage } from '$lib/types';
import type { Socket } from 'socket.io-client'; import type { Socket } from 'socket.io-client';
class Websocket { class Websocket {

View File

@ -2,7 +2,7 @@ import { Server as SocketIOServer } from 'socket.io';
import type { HttpServer } from 'vite'; import type { HttpServer } from 'vite';
// Don't try to replace with $lib alias. Since this // Don't try to replace with $lib alias. Since this
// file gets loaded as a vite plugin, it will crash // file gets loaded as a vite plugin, it will crash
import { db } from './server/db/'; import { db } from '$lib/server/db';
import { v4 as uuidv4 } from 'uuid'; import { v4 as uuidv4 } from 'uuid';
let io: SocketIOServer | undefined; let io: SocketIOServer | undefined;

View File

@ -1,7 +1,7 @@
import { building } from '$app/environment'; import { building } from '$app/environment';
import type { Handle } from '@sveltejs/kit'; import type { Handle } from '@sveltejs/kit';
import { Server as SocketIOServer } from 'socket.io'; import { Server as SocketIOServer } from 'socket.io';
import { startupSocketIOServer } from '$lib/websocketConfig'; import { startupSocketIOServer } from '$lib/functions/websocketConfig';
let io: SocketIOServer | undefined; let io: SocketIOServer | undefined;
export const handle = (async ({ event, resolve }) => { export const handle = (async ({ event, resolve }) => {

View File

@ -1,5 +1,3 @@
// place files you want to import through the `$lib` alias in this folder.
export interface TypeMessage { export interface TypeMessage {
message: string; message: string;
imageSrc: string; imageSrc: string;

View File

@ -1,4 +1,4 @@
import type { TypeMessage } from '$lib'; import type { TypeMessage } from '$lib/types';
import { error } from '@sveltejs/kit'; import { error } from '@sveltejs/kit';
import { db } from '$lib/server/db'; import { db } from '$lib/server/db';

View File

@ -2,14 +2,14 @@
import { io } from 'socket.io-client'; import { io } from 'socket.io-client';
import { onMount } from 'svelte'; import { onMount } from 'svelte';
import { v4 as uuidv4 } from 'uuid'; import { v4 as uuidv4 } from 'uuid';
import type { TypeMessage, TypeFullMessage } from '$lib'; import type { TypeMessage } from '$lib/types';
import type { PageData } from './$types'; import type { PageData } from './$types';
import { Input } from '$lib/components/ui/input/index'; import { Input } from '$lib/components/ui/input/index';
import { Button } from '$lib/components/ui/button/index'; import { Button } from '$lib/components/ui/button/index';
import Send from 'lucide-svelte/icons/send'; import Send from 'lucide-svelte/icons/send';
import Message from '$lib/components/message.svelte'; import Message from '$lib/components/message.svelte';
import { page } from '$app/state'; import { page } from '$app/state';
import Websocket from '$lib/clientWebsocket.svelte'; import Websocket from '$lib/functions/clientWebsocket.svelte';
const { data }: { data: PageData } = $props(); const { data }: { data: PageData } = $props();

View File

@ -1,6 +1,6 @@
import { sveltekit } from '@sveltejs/kit/vite'; import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig } from 'vite'; import { defineConfig } from 'vite';
import { startupSocketIOServer } from './src/lib/websocketConfig'; import { startupSocketIOServer } from './src/lib/functions/websocketConfig';
export default defineConfig({ export default defineConfig({
plugins: [ plugins: [