diff --git a/.env b/.env index 40c3228..617c806 100644 --- a/.env +++ b/.env @@ -1,4 +1,11 @@ -VITE_APP_VERSION=1.0.0-alpha +# TWILIO +TWILIO_ACCOUNT_SID= +TWILIO_AUTH_TOKEN= +TWILIO_PHONE_NUMBER= + +# PRISMA DATABASE_URL="postgres://hestia:test123@localhost:5432/hestia" + +# CLERK PUBLIC_CLERK_PUBLISHABLE_KEY=secret_do_not_commit_or_change_this_create_.env.local_instead CLERK_SECRET_KEY=secret_do_not_commit_or_change_this_create_.env.local_instead diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100644 index 0000000..4e90cbe --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,2 @@ +bunx prettier . --write +bunx eslint_d $(git diff --name-only HEAD | grep -E '\.(*)$' | xargs) diff --git a/bun.lockb b/bun.lockb index 8d79727..4d06590 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/messages/en.json b/messages/en.json index b3c3fd1..0deea6c 100644 --- a/messages/en.json +++ b/messages/en.json @@ -1,11 +1,21 @@ { "$schema": "https://inlang.com/schema/inlang-message-format", - "greeting": "Hello {name}!", - "email_required": "Email is required", - "password_required": "Password is required", - "name_required": "Name is required", - "email_incorrect": "Email is incorrect", - "password_incorrect": "Password is incorrect", - "email_inuse": "Email is already in use", - "user_not_found": "The user could not be found" + "nav_greeting": "Hello {name}!", + "login_tab_login": "Login", + "login_tab_register": "Register", + "login_label_email": "Email", + "login_label_password": "Password", + "login_label_name": "Name", + "login_button_submit": "Submit", + "login_error_email_required": "Email is required", + "login_error_password_required": "Password is required", + "login_error_name_required": "Name is required", + "login_error_email_incorrect": "Email is incorrect", + "login_error_password_incorrect": "Password is incorrect", + "login_error_email_inuse": "Email is already in use", + "login_error_user_not_found": "The user could not be found", + "sms_prompt": "Send a Message", + "sms_label_phone": "Phone Number", + "sms_label_message": "Message", + "sms_button_submit": "Send Message" } diff --git a/package.json b/package.json index 29c7074..0f47b3c 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "version": "0.0.1", "type": "module", "scripts": { - "dev": "bun database:up && bun prisma:generate && bun prisma:push && vite dev", + "dev": "bun validate-env && bun database:up && bun prisma:generate && bun prisma:push && vite dev", "build": "vite build", "build-storybook": "storybook build", "database:up": "docker compose -p hestia -f devops/docker-compose.dev.yml up -d && docker compose -p hestia -f devops/docker-compose.dev.yml -f devops/docker-compose.wait.yml run --rm wait -c hestia-database:5432", @@ -23,7 +23,9 @@ "prisma:push": "prisma db push", "prisma:reset": "prisma migrate reset --force", "prisma:studio": "prisma studio", - "prisma:validate": "prisma validate" + "prisma:validate": "prisma validate", + "prepare": "husky", + "validate-env": "bun ./scripts/validate-env.ts" }, "devDependencies": { "@chromatic-com/storybook": "^3.2.2", @@ -48,6 +50,7 @@ "eslint-config-prettier": "^9.1.0", "eslint-plugin-svelte": "^2.36.0", "globals": "^15.0.0", + "husky": "^9.1.7", "prettier": "^3.3.2", "prettier-plugin-svelte": "^3.2.6", "prettier-plugin-tailwindcss": "^0.6.5", @@ -73,12 +76,13 @@ "@tailwindcss/typography": "^0.5.15", "clerk-sveltekit": "https://pkg.pr.new/wobsoriano/clerk-sveltekit@ca15d4e", "dayjs": "^1.11.13", + "eslint_d": "^14.3.0", "graphql": "^16.9.0", "graphql-yoga": "^5.10.4", - "oslo": "^1.2.1", "pino": "^9.5.0", "pino-pretty": "^13.0.0", "tailwind-merge": "^2.5.5", + "twilio": "^5.4.0", "zod": "^3.24.0" } } diff --git a/scripts/validate-env.ts b/scripts/validate-env.ts new file mode 100644 index 0000000..da28326 --- /dev/null +++ b/scripts/validate-env.ts @@ -0,0 +1,19 @@ +import { PhoneRegex } from '../src/lib/regex/phone'; +import { z } from 'zod'; + +const ValidateEnvironment = () => { + const { success, error } = z + .object({ + TWILIO_ACCOUNT_SID: z.string().min(1), + TWILIO_AUTH_TOKEN: z.string().min(1), + TWILIO_PHONE_NUMBER: z.string().regex(PhoneRegex), + }) + .safeParse(process.env); + + if (!success) { + console.error(error.message); + process.exit(1); + } +}; + +ValidateEnvironment(); diff --git a/src/app.d.ts b/src/app.d.ts index 335032f..086138d 100644 --- a/src/app.d.ts +++ b/src/app.d.ts @@ -1,4 +1,5 @@ // See https://svelte.dev/docs/kit/types#app.d.ts + // for information about these interfaces declare global { namespace App { diff --git a/src/lib/components/common/Button/Button.stories.svelte b/src/lib/components/Actions/Button.stories.svelte similarity index 65% rename from src/lib/components/common/Button/Button.stories.svelte rename to src/lib/components/Actions/Button.stories.svelte index d182565..abd7504 100644 --- a/src/lib/components/common/Button/Button.stories.svelte +++ b/src/lib/components/Actions/Button.stories.svelte @@ -1,7 +1,8 @@ - +{#snippet template({ children: _, ...props }: Partial>)} + +{/snippet} + + diff --git a/src/lib/components/common/Button/Button.svelte b/src/lib/components/Actions/Button.svelte similarity index 89% rename from src/lib/components/common/Button/Button.svelte rename to src/lib/components/Actions/Button.svelte index e7c4391..f550841 100644 --- a/src/lib/components/common/Button/Button.svelte +++ b/src/lib/components/Actions/Button.svelte @@ -1,12 +1,14 @@ + + + + diff --git a/src/lib/components/DataInput/Textarea.stories.svelte b/src/lib/components/DataInput/Textarea.stories.svelte new file mode 100644 index 0000000..8aa4d9b --- /dev/null +++ b/src/lib/components/DataInput/Textarea.stories.svelte @@ -0,0 +1,51 @@ + + +{#snippet template(props: ComponentProps)} + + diff --git a/src/lib/components/DataInput/index.ts b/src/lib/components/DataInput/index.ts new file mode 100644 index 0000000..e678a3a --- /dev/null +++ b/src/lib/components/DataInput/index.ts @@ -0,0 +1,2 @@ +export { default as Textarea } from './Textarea.svelte'; +export { default as TextInput } from './TextInput.svelte'; diff --git a/src/lib/components/Navigation/Navbar/Navbar.svelte b/src/lib/components/Navigation/Navbar/Navbar.svelte index cdd5b65..ce41227 100644 --- a/src/lib/components/Navigation/Navbar/Navbar.svelte +++ b/src/lib/components/Navigation/Navbar/Navbar.svelte @@ -4,7 +4,7 @@ let { title, username }: { title: string; username: string } = $props(); - let message = $derived(messages.greeting({ name: username })); + let message = $derived(messages.nav_greeting({ name: username }));