create-kofi-stack 1.2.21 → 1.2.23

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 +99 -23
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -901,14 +901,14 @@ async function generateTsConfig(appDir) {
901
901
  moduleResolution: "bundler",
902
902
  resolveJsonModule: true,
903
903
  isolatedModules: true,
904
- jsx: "preserve",
904
+ jsx: "react-jsx",
905
905
  incremental: true,
906
906
  plugins: [{ name: "next" }],
907
907
  paths: {
908
908
  "@/*": ["./src/*"]
909
909
  }
910
910
  },
911
- include: ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
911
+ include: ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts", ".next/dev/types/**/*.ts"],
912
912
  exclude: ["node_modules"]
913
913
  };
914
914
  await writeJSON(path3.join(appDir, "tsconfig.json"), tsConfig);
@@ -949,15 +949,20 @@ export default function RootLayout({
949
949
  }
950
950
  `;
951
951
  await writeFile(path3.join(appDir, "src/app/layout.tsx"), layoutContent);
952
- const pageContent = `export default function HomePage() {
953
- return (
954
- <main className="flex min-h-screen flex-col items-center justify-center p-24">
955
- <h1 className="text-4xl font-bold">Welcome to ${config.name}</h1>
956
- <p className="mt-4 text-lg text-muted-foreground">
957
- Built with create-kofi-stack
958
- </p>
959
- </main>
960
- )
952
+ const pageContent = `import { redirect } from 'next/navigation'
953
+ import { headers } from 'next/headers'
954
+ import { auth } from '@/lib/auth-server'
955
+
956
+ export default async function HomePage() {
957
+ const session = await auth.api.getSession({
958
+ headers: await headers(),
959
+ })
960
+
961
+ if (session) {
962
+ redirect('/dashboard')
963
+ } else {
964
+ redirect('/sign-in')
965
+ }
961
966
  }
962
967
  `;
963
968
  await writeFile(path3.join(appDir, "src/app/page.tsx"), pageContent);
@@ -989,11 +994,39 @@ export default function SignUpPage() {
989
994
  path3.join(appDir, "src/app/(auth)/sign-up/page.tsx"),
990
995
  signUpContent
991
996
  );
992
- const dashboardContent = `export default function DashboardPage() {
997
+ const dashboardContent = `import { redirect } from 'next/navigation'
998
+ import { headers } from 'next/headers'
999
+ import { auth } from '@/lib/auth-server'
1000
+ import { SignOutButton } from '@/components/auth/sign-out-button'
1001
+
1002
+ export default async function DashboardPage() {
1003
+ const session = await auth.api.getSession({
1004
+ headers: await headers(),
1005
+ })
1006
+
1007
+ if (!session) {
1008
+ redirect('/sign-in')
1009
+ }
1010
+
993
1011
  return (
994
1012
  <div className="container mx-auto p-8">
995
- <h1 className="text-3xl font-bold">Dashboard</h1>
996
- <p className="mt-4 text-muted-foreground">Welcome to your dashboard</p>
1013
+ <div className="flex items-center justify-between">
1014
+ <div>
1015
+ <h1 className="text-3xl font-bold">Dashboard</h1>
1016
+ <p className="mt-2 text-muted-foreground">
1017
+ Welcome back, {session.user.name || session.user.email}!
1018
+ </p>
1019
+ </div>
1020
+ <SignOutButton />
1021
+ </div>
1022
+ <div className="mt-8 grid gap-4 md:grid-cols-2 lg:grid-cols-3">
1023
+ <div className="rounded-lg border p-6">
1024
+ <h3 className="font-semibold">Get Started</h3>
1025
+ <p className="mt-2 text-sm text-muted-foreground">
1026
+ Start building your application with Convex and Better-Auth.
1027
+ </p>
1028
+ </div>
1029
+ </div>
997
1030
  </div>
998
1031
  )
999
1032
  }
@@ -1002,6 +1035,33 @@ export default function SignUpPage() {
1002
1035
  path3.join(appDir, "src/app/(dashboard)/page.tsx"),
1003
1036
  dashboardContent
1004
1037
  );
1038
+ const signOutButtonContent = `'use client'
1039
+
1040
+ import { useRouter } from 'next/navigation'
1041
+ import { signOut } from '@/lib/auth'
1042
+
1043
+ export function SignOutButton() {
1044
+ const router = useRouter()
1045
+
1046
+ const handleSignOut = async () => {
1047
+ await signOut()
1048
+ router.push('/sign-in')
1049
+ }
1050
+
1051
+ return (
1052
+ <button
1053
+ onClick={handleSignOut}
1054
+ className="rounded-md border px-4 py-2 text-sm hover:bg-accent"
1055
+ >
1056
+ Sign out
1057
+ </button>
1058
+ )
1059
+ }
1060
+ `;
1061
+ await writeFile(
1062
+ path3.join(appDir, "src/components/auth/sign-out-button.tsx"),
1063
+ signOutButtonContent
1064
+ );
1005
1065
  const authRouteContent = `import { auth } from '@/lib/auth-server'
1006
1066
  import { toNextJsHandler } from 'better-auth/next-js'
1007
1067
 
@@ -1235,6 +1295,7 @@ export function Providers({ children }: { children: React.ReactNode }) {
1235
1295
 
1236
1296
  import { useState } from 'react'
1237
1297
  import { useRouter } from 'next/navigation'
1298
+ import Link from 'next/link'
1238
1299
  import { signIn } from '@/lib/auth'
1239
1300
 
1240
1301
  export function SignInForm() {
@@ -1330,6 +1391,13 @@ export function SignInForm() {
1330
1391
  >
1331
1392
  Continue with Google
1332
1393
  </button>
1394
+
1395
+ <p className="text-center text-sm text-muted-foreground">
1396
+ Don&apos;t have an account?{' '}
1397
+ <Link href="/sign-up" className="font-medium text-primary hover:underline">
1398
+ Sign up
1399
+ </Link>
1400
+ </p>
1333
1401
  </div>
1334
1402
  )
1335
1403
  }
@@ -1342,6 +1410,7 @@ export function SignInForm() {
1342
1410
 
1343
1411
  import { useState } from 'react'
1344
1412
  import { useRouter } from 'next/navigation'
1413
+ import Link from 'next/link'
1345
1414
  import { signUp } from '@/lib/auth'
1346
1415
 
1347
1416
  export function SignUpForm() {
@@ -1434,6 +1503,13 @@ export function SignUpForm() {
1434
1503
  {loading ? 'Creating account...' : 'Create account'}
1435
1504
  </button>
1436
1505
  </form>
1506
+
1507
+ <p className="text-center text-sm text-muted-foreground">
1508
+ Already have an account?{' '}
1509
+ <Link href="/sign-in" className="font-medium text-primary hover:underline">
1510
+ Sign in
1511
+ </Link>
1512
+ </p>
1437
1513
  </div>
1438
1514
  )
1439
1515
  }
@@ -3122,7 +3198,7 @@ async function generateSharedConfigs(targetDir) {
3122
3198
  const nextTs = {
3123
3199
  extends: "./base.json",
3124
3200
  compilerOptions: {
3125
- jsx: "preserve",
3201
+ jsx: "react-jsx",
3126
3202
  plugins: [{ name: "next" }]
3127
3203
  }
3128
3204
  };
@@ -4232,14 +4308,14 @@ async function generatePayloadTsConfig(marketingDir) {
4232
4308
  moduleResolution: "bundler",
4233
4309
  resolveJsonModule: true,
4234
4310
  isolatedModules: true,
4235
- jsx: "preserve",
4311
+ jsx: "react-jsx",
4236
4312
  incremental: true,
4237
4313
  plugins: [{ name: "next" }],
4238
4314
  paths: {
4239
4315
  "@/*": ["./src/*"]
4240
4316
  }
4241
4317
  },
4242
- include: ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
4318
+ include: ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts", ".next/dev/types/**/*.ts"],
4243
4319
  exclude: ["node_modules"]
4244
4320
  };
4245
4321
  await writeJSON(path15.join(marketingDir, "tsconfig.json"), tsConfig);
@@ -4416,7 +4492,7 @@ async function generateTsConfig2(appDir) {
4416
4492
  moduleResolution: "bundler",
4417
4493
  resolveJsonModule: true,
4418
4494
  isolatedModules: true,
4419
- jsx: "preserve",
4495
+ jsx: "react-jsx",
4420
4496
  incremental: true,
4421
4497
  plugins: [{ name: "next" }],
4422
4498
  paths: {
@@ -4425,7 +4501,7 @@ async function generateTsConfig2(appDir) {
4425
4501
  "@repo/ui/*": ["../../packages/ui/src/*"]
4426
4502
  }
4427
4503
  },
4428
- include: ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
4504
+ include: ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts", ".next/dev/types/**/*.ts"],
4429
4505
  exclude: ["node_modules"]
4430
4506
  };
4431
4507
  await writeJSON(path16.join(appDir, "tsconfig.json"), tsConfig);
@@ -6608,14 +6684,14 @@ async function updateWebTsConfig(webDir) {
6608
6684
  moduleResolution: "bundler",
6609
6685
  resolveJsonModule: true,
6610
6686
  isolatedModules: true,
6611
- jsx: "preserve",
6687
+ jsx: "react-jsx",
6612
6688
  incremental: true,
6613
6689
  plugins: [{ name: "next" }],
6614
6690
  paths: {
6615
6691
  "@/*": ["./src/*"]
6616
6692
  }
6617
6693
  },
6618
- include: ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
6694
+ include: ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts", ".next/dev/types/**/*.ts"],
6619
6695
  exclude: ["node_modules"]
6620
6696
  };
6621
6697
  await writeFile(
@@ -6732,14 +6808,14 @@ export default function RootLayout({
6732
6808
  moduleResolution: "bundler",
6733
6809
  resolveJsonModule: true,
6734
6810
  isolatedModules: true,
6735
- jsx: "preserve",
6811
+ jsx: "react-jsx",
6736
6812
  incremental: true,
6737
6813
  plugins: [{ name: "next" }],
6738
6814
  paths: {
6739
6815
  "@/*": ["./src/*"]
6740
6816
  }
6741
6817
  },
6742
- include: ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
6818
+ include: ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts", ".next/dev/types/**/*.ts"],
6743
6819
  exclude: ["node_modules"]
6744
6820
  };
6745
6821
  await writeFile(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-kofi-stack",
3
- "version": "1.2.21",
3
+ "version": "1.2.23",
4
4
  "description": "Scaffold opinionated full-stack projects with Next.js, Convex, Better-Auth, and more",
5
5
  "type": "module",
6
6
  "bin": {