diff --git a/app/entry.client.tsx b/app/entry.client.tsx index d3675108..ef339830 100644 --- a/app/entry.client.tsx +++ b/app/entry.client.tsx @@ -4,15 +4,15 @@ * For more information, see https://remix.run/file-conventions/entry.client */ -import { RemixBrowser } from "@remix-run/react"; -import { startTransition, StrictMode } from "react"; -import { hydrateRoot } from "react-dom/client"; +import { RemixBrowser } from '@remix-run/react' +import { startTransition, StrictMode } from 'react' +import { hydrateRoot } from 'react-dom/client' startTransition(() => { hydrateRoot( - document, - - - - ); -}); + document, + + + , + ) +}) diff --git a/app/entry.server.tsx b/app/entry.server.tsx index b90e1dea..6343086a 100644 --- a/app/entry.server.tsx +++ b/app/entry.server.tsx @@ -6,7 +6,7 @@ import { PassThrough } from 'node:stream' import type { EntryContext } from '@remix-run/node' -import { createReadableStreamFromReadable } from "@remix-run/node"; +import { createReadableStreamFromReadable } from '@remix-run/node' import { RemixServer } from '@remix-run/react' import { renderToPipeableStream } from 'react-dom/server' import { getSharedEnvs } from './utils/envs' diff --git a/app/routes/_layout+/_index.tsx b/app/routes/_layout+/_index.tsx index 64c92086..de13ea2f 100644 --- a/app/routes/_layout+/_index.tsx +++ b/app/routes/_layout+/_index.tsx @@ -1,24 +1,39 @@ -import type { MetaFunction } from "@remix-run/node"; +import type { MetaFunction } from '@remix-run/node' import { Link } from '@remix-run/react' export const meta: MetaFunction = () => [ { title: 'Stripe Stack - Remix' }, - { description: `A Stripe focused Remix Stack that integrates User Subscriptions, Authentication and Testing. Driven by Prisma ORM. Deploys to Fly.io` }, - { keywords: 'remix, stripe, remix-stack, typescript, sqlite, postgresql, prisma, tailwindcss, fly.io' }, + { + description: `A Stripe focused Remix Stack that integrates User Subscriptions, Authentication and Testing. Driven by Prisma ORM. Deploys to Fly.io`, + }, + { + keywords: + 'remix, stripe, remix-stack, typescript, sqlite, postgresql, prisma, tailwindcss, fly.io', + }, { 'og:title': 'Stripe Stack - Remix' }, { 'og:type': 'website' }, { 'og:url': 'https://stripe-stack.fly.dev' }, - { 'og:image': 'https://raw.githubusercontent.com/dev-xo/dev-xo/main/stripe-stack/assets/images/Stripe-Thumbnail.png' }, + { + 'og:image': + 'https://raw.githubusercontent.com/dev-xo/dev-xo/main/stripe-stack/assets/images/Stripe-Thumbnail.png', + }, { 'og:card': 'summary_large_image' }, { 'og:creator': '@DanielKanem' }, { 'og:site': 'https://stripe-stack.fly.dev' }, - { 'og:description': `A Stripe focused Remix Stack that integrates User Subscriptions, Authentication and Testing. Driven by Prisma ORM. Deploys to Fly.io` }, - { 'twitter:image': 'https://raw.githubusercontent.com/dev-xo/dev-xo/main/stripe-stack/assets/images/Stripe-Thumbnail.png' }, + { + 'og:description': `A Stripe focused Remix Stack that integrates User Subscriptions, Authentication and Testing. Driven by Prisma ORM. Deploys to Fly.io`, + }, + { + 'twitter:image': + 'https://raw.githubusercontent.com/dev-xo/dev-xo/main/stripe-stack/assets/images/Stripe-Thumbnail.png', + }, { 'twitter:card': 'summary_large_image' }, { 'twitter:creator': '@DanielKanem' }, { 'twitter:title': 'Stripe Stack - Remix' }, - { 'twitter:description': `A Stripe focused Remix Stack that integrates User Subscriptions, Authentication and Testing. Driven by Prisma ORM. Deploys to Fly.io` }, -]; + { + 'twitter:description': `A Stripe focused Remix Stack that integrates User Subscriptions, Authentication and Testing. Driven by Prisma ORM. Deploys to Fly.io`, + }, +] export default function Index() { return ( diff --git a/app/routes/api+/webhook.ts b/app/routes/api+/webhook.ts index bcf74d0a..445e3943 100644 --- a/app/routes/api+/webhook.ts +++ b/app/routes/api+/webhook.ts @@ -83,7 +83,9 @@ export async function action({ request }: ActionFunctionArgs) { if (!user) throw new Error('User not found.') // Cancel free subscription if user has a paid one. - const subscriptionsList = await stripe.subscriptions.list({ customer: customerId }) + const subscriptionsList = await stripe.subscriptions.list({ + customer: customerId, + }) const freeSubscriptions = subscriptionsList.data .map((subscription) => { return subscription.items.data.find( diff --git a/app/utils/db.server.ts b/app/utils/db.server.ts index baaa56e7..4c7ed3c2 100644 --- a/app/utils/db.server.ts +++ b/app/utils/db.server.ts @@ -1,8 +1,8 @@ -import { PrismaClient } from "@prisma/client"; +import { PrismaClient } from '@prisma/client' -import { singleton } from "./singleton.server"; +import { singleton } from './singleton.server' // Hard-code a unique key, so we can look up the client when this module gets re-imported -const db = singleton("prisma", () => new PrismaClient()); +const db = singleton('prisma', () => new PrismaClient()) -export { db }; +export { db } diff --git a/app/utils/singleton.server.ts b/app/utils/singleton.server.ts index faffa4fd..1c68c474 100644 --- a/app/utils/singleton.server.ts +++ b/app/utils/singleton.server.ts @@ -1,12 +1,9 @@ // Borrowed & modified from https://github.com/jenseng/abuse-the-platform/blob/main/app/utils/singleton.ts // Thanks @jenseng! -export const singleton = ( - name: string, - valueFactory: () => Value -): Value => { - const g = global as any; - g.__singletons ??= {}; - g.__singletons[name] ??= valueFactory(); - return g.__singletons[name]; -}; +export const singleton = (name: string, valueFactory: () => Value): Value => { + const g = global as any + g.__singletons ??= {} + g.__singletons[name] ??= valueFactory() + return g.__singletons[name] +} diff --git a/tailwind.config.ts b/tailwind.config.ts index 64a5243e..e8f72817 100644 --- a/tailwind.config.ts +++ b/tailwind.config.ts @@ -1,9 +1,9 @@ -import type { Config } from "tailwindcss"; +import type { Config } from 'tailwindcss' export default { - content: ["./app/**/*.{js,jsx,ts,tsx}"], + content: ['./app/**/*.{js,jsx,ts,tsx}'], theme: { extend: {}, }, plugins: [], -} satisfies Config; +} satisfies Config