create-kofi-stack 1.2.6 → 1.2.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +104 -15
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -3996,20 +3996,84 @@ export default function RootLayout({
3996
3996
  import config from '@/payload.config'
3997
3997
 
3998
3998
  export default async function HomePage() {
3999
- const payload = await getPayload({ config })
3999
+ // Check if DATABASE_URL is configured
4000
+ if (!process.env.DATABASE_URL || process.env.DATABASE_URL.includes('[PASSWORD]')) {
4001
+ return (
4002
+ <main className="min-h-screen bg-gradient-to-b from-gray-50 to-white">
4003
+ <div className="container mx-auto px-4 py-16">
4004
+ <div className="max-w-2xl mx-auto text-center">
4005
+ <h1 className="text-4xl font-bold text-gray-900 mb-4">
4006
+ Welcome to Your Marketing Site
4007
+ </h1>
4008
+ <p className="text-lg text-gray-600 mb-8">
4009
+ Built with Payload CMS and Next.js
4010
+ </p>
4011
+ <div className="bg-amber-50 border border-amber-200 rounded-lg p-6 text-left">
4012
+ <h2 className="text-lg font-semibold text-amber-800 mb-2">
4013
+ Database Setup Required
4014
+ </h2>
4015
+ <p className="text-amber-700 mb-4">
4016
+ To get started, configure your PostgreSQL database:
4017
+ </p>
4018
+ <ol className="list-decimal list-inside text-amber-700 space-y-2">
4019
+ <li>Create a Supabase project at <a href="https://supabase.com" className="underline" target="_blank" rel="noopener noreferrer">supabase.com</a></li>
4020
+ <li>Copy your database connection string</li>
4021
+ <li>Update <code className="bg-amber-100 px-1 rounded">DATABASE_URL</code> in <code className="bg-amber-100 px-1 rounded">apps/marketing/.env.local</code></li>
4022
+ <li>Restart the development server</li>
4023
+ </ol>
4024
+ </div>
4025
+ <div className="mt-8">
4026
+ <a
4027
+ href="/admin"
4028
+ className="inline-flex items-center px-6 py-3 bg-gray-900 text-white rounded-lg hover:bg-gray-800 transition-colors"
4029
+ >
4030
+ Go to Admin Panel \u2192
4031
+ </a>
4032
+ </div>
4033
+ </div>
4034
+ </div>
4035
+ </main>
4036
+ )
4037
+ }
4000
4038
 
4001
- const settings = await payload.findGlobal({
4002
- slug: 'site-settings',
4003
- })
4039
+ try {
4040
+ const payload = await getPayload({ config })
4004
4041
 
4005
- return (
4006
- <main className="min-h-screen">
4007
- <div className="container mx-auto px-4 py-16">
4008
- <h1 className="text-4xl font-bold">{settings.siteName}</h1>
4009
- <p className="mt-4 text-lg text-gray-600">{settings.siteDescription}</p>
4010
- </div>
4011
- </main>
4012
- )
4042
+ const settings = await payload.findGlobal({
4043
+ slug: 'site-settings',
4044
+ })
4045
+
4046
+ return (
4047
+ <main className="min-h-screen">
4048
+ <div className="container mx-auto px-4 py-16">
4049
+ <h1 className="text-4xl font-bold">{settings.siteName || 'Marketing Site'}</h1>
4050
+ <p className="mt-4 text-lg text-gray-600">{settings.siteDescription || 'Built with Payload CMS'}</p>
4051
+ </div>
4052
+ </main>
4053
+ )
4054
+ } catch (error) {
4055
+ return (
4056
+ <main className="min-h-screen bg-gradient-to-b from-red-50 to-white">
4057
+ <div className="container mx-auto px-4 py-16">
4058
+ <div className="max-w-2xl mx-auto text-center">
4059
+ <h1 className="text-4xl font-bold text-gray-900 mb-4">
4060
+ Database Connection Error
4061
+ </h1>
4062
+ <div className="bg-red-50 border border-red-200 rounded-lg p-6 text-left">
4063
+ <p className="text-red-700 mb-4">
4064
+ Could not connect to the database. Please check your configuration:
4065
+ </p>
4066
+ <ul className="list-disc list-inside text-red-700 space-y-2">
4067
+ <li>Verify <code className="bg-red-100 px-1 rounded">DATABASE_URL</code> is correct</li>
4068
+ <li>Ensure your database is running and accessible</li>
4069
+ <li>Check that the database credentials are valid</li>
4070
+ </ul>
4071
+ </div>
4072
+ </div>
4073
+ </div>
4074
+ </main>
4075
+ )
4076
+ }
4013
4077
  }
4014
4078
  `;
4015
4079
  await writeFile(
@@ -6370,8 +6434,33 @@ ${pc2.dim("Note: Make sure you have a Convex account at https://convex.dev")}
6370
6434
  `);
6371
6435
  try {
6372
6436
  const convexDir = config.structure === "monorepo" ? path18.join(config.targetDir, "packages/backend") : config.targetDir;
6373
- p6.log.info(`Running ${pc2.cyan("npx convex dev --once")} in ${pc2.dim(convexDir)}...`);
6374
6437
  const { spawn } = await import("child_process");
6438
+ p6.log.info(`Installing dependencies in ${pc2.dim(convexDir)}...`);
6439
+ const installSuccess = await new Promise((resolve) => {
6440
+ const installChild = spawn("pnpm", ["install"], {
6441
+ cwd: convexDir,
6442
+ stdio: "inherit",
6443
+ shell: true
6444
+ });
6445
+ installChild.on("close", (code) => {
6446
+ if (code === 0) {
6447
+ p6.log.success("Dependencies installed");
6448
+ resolve(true);
6449
+ } else {
6450
+ p6.log.warn("Failed to install dependencies");
6451
+ resolve(false);
6452
+ }
6453
+ });
6454
+ installChild.on("error", () => {
6455
+ resolve(false);
6456
+ });
6457
+ });
6458
+ if (!installSuccess) {
6459
+ p6.log.warn("Could not install dependencies. Skipping Convex setup.");
6460
+ p6.log.info(`Run ${pc2.cyan("pnpm install")} then ${pc2.cyan("pnpm convex dev")} manually.`);
6461
+ return;
6462
+ }
6463
+ p6.log.info(`Running ${pc2.cyan("npx convex dev --once")} in ${pc2.dim(convexDir)}...`);
6375
6464
  await new Promise((resolve) => {
6376
6465
  const child = spawn("npx", ["convex", "dev", "--once"], {
6377
6466
  cwd: convexDir,
@@ -6380,7 +6469,7 @@ ${pc2.dim("Note: Make sure you have a Convex account at https://convex.dev")}
6380
6469
  });
6381
6470
  child.on("close", (code) => {
6382
6471
  if (code === 0) {
6383
- p6.log.success("Convex project created successfully!");
6472
+ p6.log.success("Convex project created and deployed successfully!");
6384
6473
  resolve();
6385
6474
  } else {
6386
6475
  p6.log.warn(`Convex setup exited with code ${code}. You can run 'pnpm convex dev' manually later.`);
@@ -6395,7 +6484,7 @@ ${pc2.dim("Note: Make sure you have a Convex account at https://convex.dev")}
6395
6484
  });
6396
6485
  } catch (error) {
6397
6486
  p6.log.warn("Could not run Convex setup automatically.");
6398
- p6.log.info(`Run ${pc2.cyan("pnpm convex dev")} manually in your project directory.`);
6487
+ p6.log.info(`Run ${pc2.cyan("pnpm install")} then ${pc2.cyan("pnpm convex dev")} manually in your project directory.`);
6399
6488
  }
6400
6489
  } else if (convexChoice === "existing") {
6401
6490
  const deploymentName = await p6.text({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-kofi-stack",
3
- "version": "1.2.6",
3
+ "version": "1.2.8",
4
4
  "description": "Scaffold opinionated full-stack projects with Next.js, Convex, Better-Auth, and more",
5
5
  "type": "module",
6
6
  "bin": {