fix shit
Some checks failed
Deployment / Install (push) Failing after 55s

This commit is contained in:
Benjamin Palko 2025-04-30 16:59:55 -04:00
parent cee5001890
commit 9dfbdcc554
7 changed files with 48 additions and 44 deletions

View file

@ -2,3 +2,9 @@
package-lock.json package-lock.json
pnpm-lock.yaml pnpm-lock.yaml
yarn.lock yarn.lock
# Dont even try lol
.svelte-kit
build
node_modules

View file

@ -1,10 +1,10 @@
services: services:
postgres: postgres:
container_name: postgres container_name: postgres:alpine
image: postgres image: postgres
ports:
- 5432:5432
environment: environment:
POSTGRES_DB: ${DATABASE_NAME} POSTGRES_DB: ${DATABASE_NAME}
POSTGRES_USER: ${DATABASE_USERNAME} POSTGRES_USER: ${DATABASE_USERNAME}
POSTGRES_PASSWORD: ${DATABASE_PASSWORD} POSTGRES_PASSWORD: ${DATABASE_PASSWORD}
volumes:
- ./data:/var/lib/postgresql/data

View file

@ -1,5 +1,5 @@
export default { export default {
plugins: { plugins: {
autoprefixer: {}, autoprefixer: {}
}, }
}; };

View file

@ -1,4 +1,4 @@
@import "tailwindcss"; @import 'tailwindcss';
@plugin "daisyui"; @plugin "daisyui";
:root { :root {

View file

@ -2,86 +2,84 @@ import {
MAIL_TRANSPORT_HOST, MAIL_TRANSPORT_HOST,
MAIL_TRANSPORT_PASS, MAIL_TRANSPORT_PASS,
MAIL_TRANSPORT_PORT, MAIL_TRANSPORT_PORT,
MAIL_TRANSPORT_USER, MAIL_TRANSPORT_USER
} from "$env/static/private"; } from '$env/static/private';
import { fail } from "@sveltejs/kit"; import { fail } from '@sveltejs/kit';
import { createTransport } from "nodemailer"; import { createTransport } from 'nodemailer';
import type { Actions } from "./$types"; import type { Actions } from './$types';
export const actions = { export const actions = {
default: async ({ request }) => { default: async ({ request }) => {
const form = await request.formData(); const form = await request.formData();
if (!form.has("name")) { if (!form.has('name')) {
return fail(400, { name: null, missing: true }); return fail(400, { name: null, missing: true });
} }
if (!form.has("email")) { if (!form.has('email')) {
return fail(400, { email: null, missing: true }); return fail(400, { email: null, missing: true });
} }
if (!form.has("subject")) { if (!form.has('subject')) {
return fail(400, { subject: null, missing: true }); return fail(400, { subject: null, missing: true });
} }
if (!form.has("message")) { if (!form.has('message')) {
return fail(400, { message: null, missing: true }); return fail(400, { message: null, missing: true });
} }
const name = form.get("name"); const name = form.get('name');
if (typeof name !== "string") { if (typeof name !== 'string') {
return fail(400, { name, incorrect: true }); return fail(400, { name, incorrect: true });
} }
const email = form.get("email"); const email = form.get('email');
if (typeof email !== "string") { if (typeof email !== 'string') {
return fail(400, { email, incorrect: true }); return fail(400, { email, incorrect: true });
} }
const subject = form.get("subject"); const subject = form.get('subject');
if (typeof subject !== "string") { if (typeof subject !== 'string') {
return fail(400, { subject, incorrect: true }); return fail(400, { subject, incorrect: true });
} }
const message = form.get("message"); const message = form.get('message');
if (typeof message !== "string") { if (typeof message !== 'string') {
return fail(400, { message, incorrect: true }); return fail(400, { message, incorrect: true });
} }
const transport = createTransport({ const transport = createTransport({
host: MAIL_TRANSPORT_HOST, host: MAIL_TRANSPORT_HOST,
port: isNaN(Number(MAIL_TRANSPORT_PORT)) port: isNaN(Number(MAIL_TRANSPORT_PORT)) ? 587 : Number(MAIL_TRANSPORT_PORT),
? 587
: Number(MAIL_TRANSPORT_PORT),
auth: { auth: {
user: MAIL_TRANSPORT_USER, user: MAIL_TRANSPORT_USER,
pass: MAIL_TRANSPORT_PASS, pass: MAIL_TRANSPORT_PASS
}, }
}); });
try { try {
const info1 = await transport.sendMail({ const info1 = await transport.sendMail({
from: "no-reply@benjaminpalko.ca", from: 'no-reply@benjaminpalko.ca',
to: email, to: email,
subject: `Thank you for reaching out`, subject: `Thank you for reaching out`,
text: `Hello ${name}!\n\nThank you for reaching out! I will be sure to get back to you ASAP.\n\nCheers,\nBenjamin`, text: `Hello ${name}!\n\nThank you for reaching out! I will be sure to get back to you ASAP.\n\nCheers,\nBenjamin`
}); });
const info2 = await transport.sendMail({ const info2 = await transport.sendMail({
from: email, from: email,
to: "contact@benjaminpalko.ca", to: 'contact@benjaminpalko.ca',
subject: subject, subject: subject,
text: message, text: message
}); });
return { return {
response: { response: {
accepted: [...info1.accepted, ...info2.accepted], accepted: [...info1.accepted, ...info2.accepted],
rejected: [...info1.rejected, ...info2.rejected], rejected: [...info1.rejected, ...info2.rejected]
}, }
}; };
} catch (error) { } catch (error) {
console.error(error); console.error(error);
} }
}, }
} satisfies Actions; } satisfies Actions;

View file

@ -1,9 +1,9 @@
import type { Config } from "tailwindcss"; import type { Config } from 'tailwindcss';
export default { export default {
content: ["./src/**/*.{html,js,svelte,ts}"], content: ['./src/**/*.{html,js,svelte,ts}'],
theme: { theme: {
extend: {}, extend: {}
}, }
} satisfies Config; } satisfies Config;

View file

@ -1,11 +1,11 @@
import { sveltekit } from "@sveltejs/kit/vite"; import { sveltekit } from '@sveltejs/kit/vite';
import tailwindcss from "@tailwindcss/vite"; import tailwindcss from '@tailwindcss/vite';
import { defineConfig } from "vitest/config"; import { defineConfig } from 'vitest/config';
export default defineConfig({ export default defineConfig({
plugins: [tailwindcss(), sveltekit()], plugins: [tailwindcss(), sveltekit()],
test: { test: {
include: ["src/**/*.{test,spec}.{js,ts}"], include: ['src/**/*.{test,spec}.{js,ts}']
}, }
}); });