diff --git a/.gitignore b/.gitignore index 96fab4f..3f4c2a4 100644 --- a/.gitignore +++ b/.gitignore @@ -15,14 +15,7 @@ node_modules # Testing coverage -# Turbo -.turbo - -# Vercel -.vercel - # Build Outputs -.next/ out/ build dist @@ -36,3 +29,9 @@ yarn-error.log* # Misc .DS_Store *.pem + +# NX +.nx/cache +.nx/workspace-data +.cursor/rules/nx-rules.mdc +.github/instructions/nx.instructions.md \ No newline at end of file diff --git a/README.md b/README.md index ff4d80e..70666ea 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # ✨ Lumify Sanity Template -Official CLI and starter template for building modern web apps with Next.js, Sanity, Bun, and Shadcn UI — bundled into a single monorepo. +Official CLI and starter template for building modern web apps with Sveltekit, Sanity, Bun, and Shadcn UI — bundled into a single monorepo. --- @@ -8,9 +8,9 @@ Official CLI and starter template for building modern web apps with Next.js, San The `@lumify-systems/template-sanity` CLI sets up a fully functional monorepo with: -* ⚡ **Next.js App Router** for the frontend +* ⚡ **Sveltekit** for the frontend * 📝 **Sanity Studio** CMS with custom schemas -* 🏗️ **TurboRepo** structure (client, studio, shared packages) +* 🏗️ **NX Monorepo** structure (client, studio, shared packages) * 🎨 **Shadcn UI** components and theming pre-installed * 🧪 Preconfigured dev tools (Tailwind, TypeScript, ESLint, Prettier) @@ -51,7 +51,7 @@ After that: ``` apps/ - client/ # Next.js frontend + client/ # Svelte frontend studio/ # Sanity Studio CMS packages/ ui/ # Shadcn components & design system @@ -59,7 +59,7 @@ packages/ typescript-config/ # Shared TypeScript presets ``` -All apps and packages are connected with TurboRepo workspaces. +All apps and packages are connected with NX workspaces. You can run commands from the root: diff --git a/debug.js b/debug.js deleted file mode 100755 index 4023bdc..0000000 --- a/debug.js +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env node - -import * as p from '@clack/prompts'; - -async function demoSpinner() { - await p.tasks([ - { - title: 'Running demo task', - task: async () => { - await new Promise((r) => setTimeout(r, 1500)); - return 'Demo completed!'; - }, - }, - ]); -} - -demoSpinner().catch(console.error); diff --git a/index.js b/index.js index 93ec66f..7927def 100755 --- a/index.js +++ b/index.js @@ -201,6 +201,14 @@ async function main() { connFile = connFile.replace(/projectId: "[^"]+"/, `projectId: "${sanityJson.projectId}"`); await fs.writeFile(connPath, connFile); + // Update wrangler.jsonc with project name + const wranglerPath = path.join(rootDir, "apps/client/wrangler.jsonc"); + if (await fs.pathExists(wranglerPath)) { + let wranglerFile = await fs.readFile(wranglerPath, "utf8"); + wranglerFile = wranglerFile.replace(/"name": "[^"]+"/, `"name": "${kebabName}"`); + await fs.writeFile(wranglerPath, wranglerFile); + } + return `Sanity project created with ID: ${sanityJson.projectId}`; }, }, @@ -246,7 +254,7 @@ async function main() { } const corsOrigins = [ - 'http://localhost:3000', + 'http://localhost:5173', 'https://*.api.sanity.io', 'wss://*.api.sanity.io', `https://${kebabName}.sanity.studio`, @@ -321,7 +329,7 @@ async function main() { ` ${color.bold(color.green(pmRun))} ${color.dim('# Start your local dev server')} ${color.yellow('🖥️')}\n` + ` ${color.bold(color.green(pmDeploy))} ${color.dim('# Deploy your Sanity Studio')} ${color.yellow('🚀')}\n\n` + color.dim('Local development:\n') + - ` • App: ${color.cyan('http://localhost:3000')} ${color.yellow('🌐')}\n` + + ` • App: ${color.cyan('http://localhost:5173')} ${color.yellow('🌐')}\n` + ` • Studio: ${color.cyan('http://localhost:3333')} ${color.yellow('🛠️')}\n\n` + color.dim('After deploying:\n') + ` • Studio: ${color.cyan(`https://${kebabName}.sanity.studio`)} ${color.yellow('✨')}` diff --git a/package.json b/package.json index 67cd546..5d027bc 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "access": "restricted", "registry": "https://npm.pkg.github.com" }, - "description": "Template for Lumify Sanity and Next.js monorepo setup.", + "description": "Template for Lumify Sanity and Svelte monorepo setup.", "bin": { "template-sanity": "./index.js" }, diff --git a/template/.gitignore b/template/.gitignore index 96fab4f..25ab1fc 100644 --- a/template/.gitignore +++ b/template/.gitignore @@ -15,19 +15,11 @@ node_modules # Testing coverage -# Turbo -.turbo - -# Vercel -.vercel - # Build Outputs -.next/ out/ build dist - # Debug npm-debug.log* yarn-debug.log* @@ -36,3 +28,9 @@ yarn-error.log* # Misc .DS_Store *.pem + +# NX +.nx/cache +.nx/workspace-data +.cursor/rules/nx-rules.mdc +.github/instructions/nx.instructions.md \ No newline at end of file diff --git a/template/apps/client/.gitignore b/template/apps/client/.gitignore index 5ef6a52..f358612 100644 --- a/template/apps/client/.gitignore +++ b/template/apps/client/.gitignore @@ -1,41 +1,22 @@ -# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. +node_modules -# dependencies -/node_modules -/.pnp -.pnp.* -.yarn/* -!.yarn/patches -!.yarn/plugins -!.yarn/releases -!.yarn/versions - -# testing -/coverage - -# next.js -/.next/ -/out/ - -# production +# Output +.output +.netlify +.wrangler +/.svelte-kit /build -# misc +# OS .DS_Store -*.pem +Thumbs.db -# debug -npm-debug.log* -yarn-debug.log* -yarn-error.log* -.pnpm-debug.log* +# Env +.env +.env.* +!.env.example +!.env.test -# env files (can opt-in for committing if needed) -.env* - -# vercel -.vercel - -# typescript -*.tsbuildinfo -next-env.d.ts +# Vite +vite.config.js.timestamp-* +vite.config.ts.timestamp-* diff --git a/template/apps/client/.npmrc b/template/apps/client/.npmrc new file mode 100644 index 0000000..b6f27f1 --- /dev/null +++ b/template/apps/client/.npmrc @@ -0,0 +1 @@ +engine-strict=true diff --git a/template/apps/client/.prettierignore b/template/apps/client/.prettierignore new file mode 100644 index 0000000..7d74fe2 --- /dev/null +++ b/template/apps/client/.prettierignore @@ -0,0 +1,9 @@ +# Package Managers +package-lock.json +pnpm-lock.yaml +yarn.lock +bun.lock +bun.lockb + +# Miscellaneous +/static/ diff --git a/template/apps/client/.prettierrc b/template/apps/client/.prettierrc new file mode 100644 index 0000000..8103a0b --- /dev/null +++ b/template/apps/client/.prettierrc @@ -0,0 +1,16 @@ +{ + "useTabs": true, + "singleQuote": true, + "trailingComma": "none", + "printWidth": 100, + "plugins": ["prettier-plugin-svelte", "prettier-plugin-tailwindcss"], + "overrides": [ + { + "files": "*.svelte", + "options": { + "parser": "svelte" + } + } + ], + "tailwindStylesheet": "./src/app.css" +} diff --git a/template/apps/client/README.md b/template/apps/client/README.md index e215bc4..75842c4 100644 --- a/template/apps/client/README.md +++ b/template/apps/client/README.md @@ -1,36 +1,38 @@ -This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app). +# sv -## Getting Started +Everything you need to build a Svelte project, powered by [`sv`](https://github.com/sveltejs/cli). -First, run the development server: +## Creating a project -```bash -npm run dev -# or -yarn dev -# or -pnpm dev -# or -bun dev +If you're seeing this, you've probably already done this step. Congrats! + +```sh +# create a new project in the current directory +npx sv create + +# create a new project in my-app +npx sv create my-app ``` -Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. +## Developing -You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file. +Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server: -This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load [Geist](https://vercel.com/font), a new font family for Vercel. +```sh +npm run dev -## Learn More +# or start the server and open the app in a new browser tab +npm run dev -- --open +``` -To learn more about Next.js, take a look at the following resources: +## Building -- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API. -- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial. +To create a production version of your app: -You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome! +```sh +npm run build +``` -## Deploy on Vercel +You can preview the production build with `npm run preview`. -The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js. - -Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details. +> To deploy your app, you may need to install an [adapter](https://svelte.dev/docs/kit/adapters) for your target environment. diff --git a/template/apps/client/components.json b/template/apps/client/components.json index 0e8b633..737ca29 100644 --- a/template/apps/client/components.json +++ b/template/apps/client/components.json @@ -1,21 +1,16 @@ { - "$schema": "https://ui.shadcn.com/schema.json", - "style": "new-york", - "rsc": true, - "tsx": true, - "tailwind": { - "config": "tailwind.config.ts", - "css": "src/app/globals.css", - "baseColor": "neutral", - "cssVariables": true, - "prefix": "" - }, - "aliases": { - "components": "@/components", - "utils": "@/lib/utils", - "ui": "@/components/ui", - "lib": "@/lib", - "hooks": "@/hooks" - }, - "iconLibrary": "lucide" -} \ No newline at end of file + "$schema": "https://shadcn-svelte.com/schema.json", + "tailwind": { + "css": "src/app.css", + "baseColor": "neutral" + }, + "aliases": { + "components": "$lib/components", + "utils": "$lib/utils", + "ui": "$lib/components/ui", + "hooks": "$lib/hooks", + "lib": "$lib" + }, + "typescript": true, + "registry": "https://shadcn-svelte.com/registry" +} diff --git a/template/apps/client/next.config.ts b/template/apps/client/next.config.ts deleted file mode 100644 index c35e632..0000000 --- a/template/apps/client/next.config.ts +++ /dev/null @@ -1,34 +0,0 @@ -import type { NextConfig } from "next"; - -const nextConfig: NextConfig = { - eslint: { ignoreDuringBuilds: true }, - images: { - remotePatterns: [ - { - hostname: "cdn.sanity.io", - pathname: "/images/**", - protocol: "https", - }, - { - hostname: "lh3.googleusercontent.com", - pathname: "**", - protocol: "https", - }, - ], - }, - headers: async () => { - return [ - { - source: "/:path*", - headers: [ - { - key: "X-Frame-Options", - value: "ALLOWALL", - }, - ], - }, - ]; - }, -}; - -export default nextConfig; diff --git a/template/apps/client/package.json b/template/apps/client/package.json index 6386eb8..6e382af 100644 --- a/template/apps/client/package.json +++ b/template/apps/client/package.json @@ -1,45 +1,47 @@ { - "name": "client", - "version": "0.1.0", - "private": true, - "engines": { - "bun": ">=1.2.12" - }, - "type": "module", - "packageManager": "bun@1.2.12", - "scripts": { - "dev": "next dev --turbopack", - "build": "next build", - "start": "next start", - "lint": "next lint" - }, - "dependencies": { - "@radix-ui/react-accordion": "^1.2.11", - "@radix-ui/react-slot": "^1.2.3", - "@sanity/client": "^7.8.1", - "@repo/sanity-connection": "*", - "@repo/typescript-config": "*", - "@repo/ui": "*", - "class-variance-authority": "^0.7.1", - "clsx": "^2.1.1", - "framer-motion": "^12.23.9", - "lucide-react": "^0.525.0", - "next": "15.4.3", - "next-sanity": "^10.0.4", - "react": "^19.1.0", - "react-dom": "^19.1.0", - "tailwind-merge": "^3.3.1" - }, - "devDependencies": { - "@eslint/eslintrc": "^3.3.1", - "@tailwindcss/postcss": "^4.1.11", - "@types/node": "^24.1.0", - "@types/react": "^19.1.8", - "@types/react-dom": "^19.1.6", - "eslint": "^9.31.0", - "eslint-config-next": "15.4.3", - "tailwindcss": "^4.1.11", - "tw-animate-css": "^1.3.5", - "typescript": "^5.8.3" - } + "name": "client", + "private": true, + "version": "0.0.1", + "type": "module", + "scripts": { + "dev": "vite dev", + "build": "vite build", + "preview": "vite preview", + "prepare": "svelte-kit sync || echo ''", + "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", + "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch", + "format": "prettier --write .", + "lint": "prettier --check ." + }, + "dependencies": { + "@portabletext/svelte": "^3.0.0", + "@repo/sanity-connection": "*", + "@repo/typescript-config": "*", + "@repo/ui": "*", + "@sanity/asset-utils": "^2.2.1", + "@sanity/client": "^7.8.1", + "@sanity/svelte-loader": "^1.13.47", + "@sanity/visual-editing": "^3.0.1", + "@sveltejs/adapter-cloudflare-workers": "^2.9.0" + }, + "devDependencies": { + "@lucide/svelte": "^0.536.0", + "@sveltejs/kit": "^2.22.0", + "@sveltejs/vite-plugin-svelte": "^6.0.0", + "@tailwindcss/forms": "^0.5.9", + "@tailwindcss/typography": "^0.5.15", + "@tailwindcss/vite": "^4.0.0", + "clsx": "^2.1.1", + "prettier": "^3.4.2", + "prettier-plugin-svelte": "^3.3.3", + "prettier-plugin-tailwindcss": "^0.6.11", + "svelte": "^5.0.0", + "svelte-check": "^4.0.0", + "tailwind-merge": "^3.3.1", + "tailwind-variants": "^1.0.0", + "tailwindcss": "^4.0.0", + "tw-animate-css": "^1.3.6", + "typescript": "^5.0.0", + "vite": "^7.0.4" + } } diff --git a/template/apps/client/postcss.config.mjs b/template/apps/client/postcss.config.mjs deleted file mode 100644 index c7bcb4b..0000000 --- a/template/apps/client/postcss.config.mjs +++ /dev/null @@ -1,5 +0,0 @@ -const config = { - plugins: ["@tailwindcss/postcss"], -}; - -export default config; diff --git a/template/apps/client/public/manifest.webmanifest b/template/apps/client/public/manifest.webmanifest deleted file mode 100644 index edcd510..0000000 --- a/template/apps/client/public/manifest.webmanifest +++ /dev/null @@ -1,14 +0,0 @@ -{ - "icons": [ - { - "src": "/favicon-192.png", - "type": "image/png", - "sizes": "192x192" - }, - { - "src": "/favicon-512.png", - "type": "image/png", - "sizes": "512x512" - } - ] -} \ No newline at end of file diff --git a/template/apps/client/src/app/globals.css b/template/apps/client/src/app.css similarity index 64% rename from template/apps/client/src/app/globals.css rename to template/apps/client/src/app.css index 04093d4..aaa54c4 100644 --- a/template/apps/client/src/app/globals.css +++ b/template/apps/client/src/app.css @@ -1,16 +1,94 @@ @import "tailwindcss"; + @import "tw-animate-css"; @custom-variant dark (&:is(.dark *)); -@config "../../tailwind.config.ts"; +@layer base { + :root { + --font-sans: 'Geist', ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; + } + + body { + font-family: var(--font-sans); + } +} + +:root { + --radius: 0.625rem; + --background: oklch(1 0 0); + --foreground: oklch(0.145 0 0); + --card: oklch(1 0 0); + --card-foreground: oklch(0.145 0 0); + --popover: oklch(1 0 0); + --popover-foreground: oklch(0.145 0 0); + --primary: oklch(0.205 0 0); + --primary-foreground: oklch(0.985 0 0); + --secondary: oklch(0.97 0 0); + --secondary-foreground: oklch(0.205 0 0); + --muted: oklch(0.97 0 0); + --muted-foreground: oklch(0.556 0 0); + --accent: oklch(0.97 0 0); + --accent-foreground: oklch(0.205 0 0); + --destructive: oklch(0.577 0.245 27.325); + --border: oklch(0.922 0 0); + --input: oklch(0.922 0 0); + --ring: oklch(0.708 0 0); + --chart-1: oklch(0.646 0.222 41.116); + --chart-2: oklch(0.6 0.118 184.704); + --chart-3: oklch(0.398 0.07 227.392); + --chart-4: oklch(0.828 0.189 84.429); + --chart-5: oklch(0.769 0.188 70.08); + --sidebar: oklch(0.985 0 0); + --sidebar-foreground: oklch(0.145 0 0); + --sidebar-primary: oklch(0.205 0 0); + --sidebar-primary-foreground: oklch(0.985 0 0); + --sidebar-accent: oklch(0.97 0 0); + --sidebar-accent-foreground: oklch(0.205 0 0); + --sidebar-border: oklch(0.922 0 0); + --sidebar-ring: oklch(0.708 0 0); +} + +.dark { + --background: oklch(0.145 0 0); + --foreground: oklch(0.985 0 0); + --card: oklch(0.205 0 0); + --card-foreground: oklch(0.985 0 0); + --popover: oklch(0.205 0 0); + --popover-foreground: oklch(0.985 0 0); + --primary: oklch(0.922 0 0); + --primary-foreground: oklch(0.205 0 0); + --secondary: oklch(0.269 0 0); + --secondary-foreground: oklch(0.985 0 0); + --muted: oklch(0.269 0 0); + --muted-foreground: oklch(0.708 0 0); + --accent: oklch(0.269 0 0); + --accent-foreground: oklch(0.985 0 0); + --destructive: oklch(0.704 0.191 22.216); + --border: oklch(1 0 0 / 10%); + --input: oklch(1 0 0 / 15%); + --ring: oklch(0.556 0 0); + --chart-1: oklch(0.488 0.243 264.376); + --chart-2: oklch(0.696 0.17 162.48); + --chart-3: oklch(0.769 0.188 70.08); + --chart-4: oklch(0.627 0.265 303.9); + --chart-5: oklch(0.645 0.246 16.439); + --sidebar: oklch(0.205 0 0); + --sidebar-foreground: oklch(0.985 0 0); + --sidebar-primary: oklch(0.488 0.243 264.376); + --sidebar-primary-foreground: oklch(0.985 0 0); + --sidebar-accent: oklch(0.269 0 0); + --sidebar-accent-foreground: oklch(0.985 0 0); + --sidebar-border: oklch(1 0 0 / 10%); + --sidebar-ring: oklch(0.556 0 0); +} @theme inline { --radius-sm: calc(var(--radius) - 4px); --radius-md: calc(var(--radius) - 2px); --radius-lg: var(--radius); --radius-xl: calc(var(--radius) + 4px); - --color-background: var(--bg-primary); + --color-background: var(--background); --color-foreground: var(--foreground); --color-card: var(--card); --color-card-foreground: var(--card-foreground); @@ -43,62 +121,11 @@ --color-sidebar-ring: var(--sidebar-ring); } -:root { - --radius: 0.625rem; - --card: oklch(1 0 0); - --card-foreground: oklch(0.145 0 0); - --popover: oklch(1 0 0); - --popover-foreground: oklch(0.145 0 0); - --primary: oklch(0.205 0 0); - --primary-foreground: oklch(0.985 0 0); - --secondary: oklch(0.97 0 0); - --secondary-foreground: oklch(0.205 0 0); - --muted: oklch(0.97 0 0); - --muted-foreground: oklch(0.556 0 0); - --accent: oklch(0.97 0 0); - --accent-foreground: oklch(0.205 0 0); - --destructive: oklch(0.577 0.245 27.325); - --border: oklch(0.922 0 0); - --input: oklch(0.922 0 0); - --ring: oklch(0.708 0 0); - --chart-1: oklch(0.646 0.222 41.116); - --chart-2: oklch(0.6 0.118 184.704); - --chart-3: oklch(0.398 0.07 227.392); - --chart-4: oklch(0.828 0.189 84.429); - --chart-5: oklch(0.769 0.188 70.08); - --sidebar: oklch(0.985 0 0); - --sidebar-foreground: oklch(0.145 0 0); - --sidebar-primary: oklch(0.205 0 0); - --sidebar-primary-foreground: oklch(0.985 0 0); - --sidebar-accent: oklch(0.97 0 0); - --sidebar-accent-foreground: oklch(0.205 0 0); - --sidebar-border: oklch(0.922 0 0); - --sidebar-ring: oklch(0.708 0 0); -} - @layer base { * { @apply border-border outline-ring/50; } body { - @apply font-sans bg-background text-foreground text-lg; + @apply bg-background text-foreground; } - h1, h2, h3, h4, h5, h6 { - @apply font-serif; - } - - h1 { - @apply text-4xl md:text-6xl uppercase font-bold; - } - - h2 { - @apply text-3xl font-bold; - } - - h3 { - @apply text-xl; - } - h4 { - @apply text-lg; - } -} +} \ No newline at end of file diff --git a/template/apps/client/src/app.d.ts b/template/apps/client/src/app.d.ts new file mode 100644 index 0000000..b3836b5 --- /dev/null +++ b/template/apps/client/src/app.d.ts @@ -0,0 +1,9 @@ +import type {LoaderLocals} from '@sanity/svelte-loader' + +declare global { + namespace App { + interface Locals extends LoaderLocals {} + } +} + +export {} \ No newline at end of file diff --git a/template/apps/client/src/app.html b/template/apps/client/src/app.html new file mode 100644 index 0000000..f273cc5 --- /dev/null +++ b/template/apps/client/src/app.html @@ -0,0 +1,11 @@ + + + + + + %sveltekit.head% + + +
%sveltekit.body%
+ + diff --git a/template/apps/client/src/app/[slug]/page.tsx b/template/apps/client/src/app/[slug]/page.tsx deleted file mode 100644 index f3a73e5..0000000 --- a/template/apps/client/src/app/[slug]/page.tsx +++ /dev/null @@ -1,92 +0,0 @@ -import { defineQuery } from "next-sanity"; -import { sanityFetch } from "@/sanity/live"; -import type { Custom } from "@/sanity/sanity.types"; -import type { Metadata } from "next"; -import SanityBlock from "@/components/sanity-block"; -import { notFound } from "next/navigation"; -import { fetchSettings } from "@/sanity/settings"; - -const CUSTOMS_QUERY = defineQuery(`*[_type == "custom"]{ slug }`); -const CUSTOM_QUERY = defineQuery( - `*[_type == "custom" && slug.current == $slug][0]`, -); - -type PageParams = Promise<{ - slug: string; -}>; - -export async function generateStaticParams() { - const customs: Custom[] = ( - await sanityFetch({ - query: CUSTOMS_QUERY, - stega: false, - perspective: "published", - }) - ).data; - return customs.map((custom) => ({ - slug: custom.slug?.current ?? "", - })); -} - -export async function generateMetadata(props: { - params: Promise; -}): Promise { - const params = await props.params; - if (!params.slug) { - return notFound(); - } - const settings: { title: string } = await fetchSettings("title"); - const custom: Custom = ( - await sanityFetch({ - query: CUSTOM_QUERY, - params, - stega: false, - perspective: "published", - }) - ).data; - const firstBlock = custom?.body ? custom.body[0] : undefined; - let description: string | undefined = undefined; - if (firstBlock && firstBlock._type === "block" && firstBlock.children) { - description = firstBlock.children.map((child) => child.text).join(" "); - } - - const firstWord = custom.title ? custom.title.split(" ")[0] : ""; - return { - title: `${firstWord} | ${settings.title}`, - description, - openGraph: { - title: `${firstWord} | ${settings.title}`, - description, - type: "article", - url: `/${custom.slug}`, - }, - twitter: { - card: "summary_large_image", - title: `${firstWord} | ${settings.title}`, - description, - }, - }; -} - -export default async function CustomPage(props: { - params: Promise; -}) { - const params = await props.params; - const custom: Custom = (await sanityFetch({ query: CUSTOM_QUERY, params })) - .data; - if (!custom) { - return notFound(); - } - - return ( -
-

{custom.title}

-
- {custom.body && } -
-
- ); -} diff --git a/template/apps/client/src/app/actions.ts b/template/apps/client/src/app/actions.ts deleted file mode 100644 index f6b2d31..0000000 --- a/template/apps/client/src/app/actions.ts +++ /dev/null @@ -1,10 +0,0 @@ -'use server' - -import {draftMode} from 'next/headers' - -export async function disableDraftMode() { - const disable = (await draftMode()).disable() - const delay = new Promise((resolve) => setTimeout(resolve, 1000)) - - await Promise.allSettled([disable, delay]); -} \ No newline at end of file diff --git a/template/apps/client/src/app/api/draft-mode/enable/route.ts b/template/apps/client/src/app/api/draft-mode/enable/route.ts deleted file mode 100644 index cce77de..0000000 --- a/template/apps/client/src/app/api/draft-mode/enable/route.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { client } from "@/sanity/client"; -import { sanityConnection } from "@repo/sanity-connection"; -import { defineEnableDraftMode } from "next-sanity/draft-mode"; - -export const { GET } = defineEnableDraftMode({ - client: client.withConfig({ - token: sanityConnection.publicViewerToken, - }), -}); \ No newline at end of file diff --git a/template/apps/client/src/app/layout.tsx b/template/apps/client/src/app/layout.tsx deleted file mode 100644 index a25ba8e..0000000 --- a/template/apps/client/src/app/layout.tsx +++ /dev/null @@ -1,61 +0,0 @@ -import type { Metadata } from "next"; -import { Geist, Noto_Sans } from "next/font/google"; -import "./globals.css"; -import { VisualEditing } from "next-sanity"; -import { draftMode } from "next/headers"; -import { SanityLive } from "@/sanity/live"; -import { fetchSettings } from "@/sanity/settings"; -import { getImage } from "@/lib/asset-to-url"; -import Footer from "@/components/footer"; - -const sans = Geist({ - variable: "--font-sans", - subsets: ["latin"], -}); - -export async function generateMetadata(): Promise { - const settings = await fetchSettings(); - const logo = await getImage(settings?.logo?.asset?._ref); - - return { - title: settings.title, - description: settings.description, - openGraph: { - title: settings.longTitle, - description: settings.description - }, - twitter: { - title: settings.longTitle, - description: settings.description, - }, - robots: { - index: true, - follow: true, - }, - icons: { - icon: logo.url, - apple: logo.url, - }, - manifest: "/manifest.webmanifest", - }; -} - -export default async function RootLayout({ - children, -}: Readonly<{ - children: React.ReactNode; -}>) { - const settings = await fetchSettings(); - return ( - - - {children} -