style: Update .prettierrc
This commit is contained in:
parent
bc1094d70c
commit
158f9e097d
11
.prettierrc
11
.prettierrc
@ -1,9 +1,12 @@
|
|||||||
{
|
{
|
||||||
"useTabs": true,
|
"tabWidth": 2,
|
||||||
|
"printWidth": 150,
|
||||||
|
"useTabs": false,
|
||||||
|
"semi": true,
|
||||||
"singleQuote": true,
|
"singleQuote": true,
|
||||||
"trailingComma": "none",
|
"trailingComma": "all",
|
||||||
"printWidth": 100,
|
"bracketSameLine": true,
|
||||||
"plugins": ["prettier-plugin-svelte", "prettier-plugin-tailwindcss"],
|
"plugins": ["prettier-plugin-svelte"],
|
||||||
"overrides": [
|
"overrides": [
|
||||||
{
|
{
|
||||||
"files": "*.svelte",
|
"files": "*.svelte",
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
# SVChat
|
# SVChat
|
||||||
|
|
||||||
A is a simple chat app built with SvelteKit, Drizzle ORM, and PostgreSQL
|
A is a simple chat app built with SvelteKit, Drizzle ORM, and PostgreSQL
|
||||||
|
|
||||||
## Techstack
|
## Techstack
|
||||||
|
|
||||||

|

|
||||||
|
@ -5,10 +5,10 @@ export default defineConfig({
|
|||||||
schema: './src/lib/server/db/schema.ts',
|
schema: './src/lib/server/db/schema.ts',
|
||||||
|
|
||||||
dbCredentials: {
|
dbCredentials: {
|
||||||
url: process.env.DATABASE_URL
|
url: process.env.DATABASE_URL,
|
||||||
},
|
},
|
||||||
|
|
||||||
verbose: true,
|
verbose: true,
|
||||||
strict: true,
|
strict: true,
|
||||||
dialect: 'postgresql'
|
dialect: 'postgresql',
|
||||||
});
|
});
|
||||||
|
@ -18,17 +18,17 @@ export default ts.config(
|
|||||||
languageOptions: {
|
languageOptions: {
|
||||||
globals: {
|
globals: {
|
||||||
...globals.browser,
|
...globals.browser,
|
||||||
...globals.node
|
...globals.node,
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
files: ['**/*.svelte'],
|
files: ['**/*.svelte'],
|
||||||
|
|
||||||
languageOptions: {
|
languageOptions: {
|
||||||
parserOptions: {
|
parserOptions: {
|
||||||
parser: ts.parser
|
parser: ts.parser,
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
export default {
|
export default {
|
||||||
plugins: {
|
plugins: {
|
||||||
tailwindcss: {},
|
tailwindcss: {},
|
||||||
autoprefixer: {}
|
autoprefixer: {},
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
@ -12,7 +12,7 @@ io.on('connection', (socket) => {
|
|||||||
io!.emit('message', `Hello from SvelteKit ${new Date().toLocaleString()} (${socket.id})`);
|
io!.emit('message', `Hello from SvelteKit ${new Date().toLocaleString()} (${socket.id})`);
|
||||||
|
|
||||||
socket.on('disconnect', () => {
|
socket.on('disconnect', () => {
|
||||||
io!.emit('message', `client disconnected (${socket.id})`)
|
io!.emit('message', `client disconnected (${socket.id})`);
|
||||||
console.log(`[ws:kit] client disconnected (${socket.id})`);
|
console.log(`[ws:kit] client disconnected (${socket.id})`);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -10,6 +10,6 @@ export const handle = (async ({ event, resolve }) => {
|
|||||||
event.locals.io = io;
|
event.locals.io = io;
|
||||||
}
|
}
|
||||||
return resolve(event, {
|
return resolve(event, {
|
||||||
filterSerializedResponseHeaders: (name) => name === 'content-type'
|
filterSerializedResponseHeaders: (name) => name === 'content-type',
|
||||||
});
|
});
|
||||||
}) satisfies Handle;
|
}) satisfies Handle;
|
@ -5,5 +5,5 @@ export const users = pgTable('users', {
|
|||||||
username: text('username'),
|
username: text('username'),
|
||||||
displayname: text('display_name'),
|
displayname: text('display_name'),
|
||||||
salt: text('salt'),
|
salt: text('salt'),
|
||||||
hash: text('hash')
|
hash: text('hash'),
|
||||||
});
|
});
|
||||||
|
@ -10,7 +10,7 @@ export const GlobalThisWSS = Symbol.for('sveltekit.wss');
|
|||||||
export interface ExtendedWebSocket extends WebSocketBase {
|
export interface ExtendedWebSocket extends WebSocketBase {
|
||||||
socketId: string;
|
socketId: string;
|
||||||
// userId: string;
|
// userId: string;
|
||||||
};
|
}
|
||||||
|
|
||||||
// You can define server-wide functions or class instances here
|
// You can define server-wide functions or class instances here
|
||||||
// export interface ExtendedServer extends Server<ExtendedWebSocket> {};
|
// export interface ExtendedServer extends Server<ExtendedWebSocket> {};
|
||||||
|
@ -3,7 +3,6 @@ import type { HttpServer } from 'vite';
|
|||||||
|
|
||||||
let io: SocketIOServer | undefined;
|
let io: SocketIOServer | undefined;
|
||||||
|
|
||||||
|
|
||||||
export function startupSocketIOServer(httpServer: HttpServer | null) {
|
export function startupSocketIOServer(httpServer: HttpServer | null) {
|
||||||
if (io) return;
|
if (io) return;
|
||||||
console.log('[ws:kit] setup');
|
console.log('[ws:kit] setup');
|
||||||
@ -13,7 +12,7 @@ export function startupSocketIOServer(httpServer: HttpServer | null) {
|
|||||||
io!.emit('message', `Hello from SvelteKit ${new Date().toLocaleString()} (${socket.id})`);
|
io!.emit('message', `Hello from SvelteKit ${new Date().toLocaleString()} (${socket.id})`);
|
||||||
|
|
||||||
socket.on('disconnect', () => {
|
socket.on('disconnect', () => {
|
||||||
io!.emit('message', `client disconnected (${socket.id})`)
|
io!.emit('message', `client disconnected (${socket.id})`);
|
||||||
console.log(`[ws:kit] client disconnected (${socket.id})`);
|
console.log(`[ws:kit] client disconnected (${socket.id})`);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -32,9 +32,7 @@
|
|||||||
<main>
|
<main>
|
||||||
<h1 class="text-lg"># SvelteKit with Socket.IO Integration</h1>
|
<h1 class="text-lg"># SvelteKit with Socket.IO Integration</h1>
|
||||||
|
|
||||||
<button class="btn btn-primary" on:click={() => establishSocketIOConnection()}>
|
<button class="btn btn-primary" on:click={() => establishSocketIOConnection()}> Establish Socket.IO connection </button>
|
||||||
Establish Socket.IO connection
|
|
||||||
</button>
|
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
{#each log as event}
|
{#each log as event}
|
||||||
|
@ -11,8 +11,8 @@ const config = {
|
|||||||
// adapter-auto only supports some environments, see https://svelte.dev/docs/kit/adapter-auto for a list.
|
// adapter-auto only supports some environments, see https://svelte.dev/docs/kit/adapter-auto for a list.
|
||||||
// If your environment is not supported, or you settled on a specific environment, switch out the adapter.
|
// If your environment is not supported, or you settled on a specific environment, switch out the adapter.
|
||||||
// See https://svelte.dev/docs/kit/adapters for more information about adapters.
|
// See https://svelte.dev/docs/kit/adapters for more information about adapters.
|
||||||
adapter: adapter()
|
adapter: adapter(),
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export default config;
|
export default config;
|
||||||
|
@ -3,5 +3,5 @@ import daisyui from 'daisyui';
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
content: ['./src/**/*.{html,js,svelte,ts}'],
|
content: ['./src/**/*.{html,js,svelte,ts}'],
|
||||||
plugins: [daisyui]
|
plugins: [daisyui],
|
||||||
} satisfies Config;
|
} satisfies Config;
|
||||||
|
@ -12,7 +12,7 @@ export default defineConfig({
|
|||||||
},
|
},
|
||||||
configurePreviewServer(server) {
|
configurePreviewServer(server) {
|
||||||
startupSocketIOServer(server.httpServer);
|
startupSocketIOServer(server.httpServer);
|
||||||
}
|
|
||||||
},
|
},
|
||||||
]
|
},
|
||||||
|
],
|
||||||
});
|
});
|
Loading…
Reference in New Issue
Block a user