File tree Expand file tree Collapse file tree 12 files changed +52
-27
lines changed
Expand file tree Collapse file tree 12 files changed +52
-27
lines changed Original file line number Diff line number Diff line change 1+ import fs from "fs-extra" ;
2+ import path from "path" ;
13import { stealthInit } from "~/helpers/stealth-init.js" ;
4+ import { state } from "~/state.js" ;
25
36export async function preflightAddCommand ( ) {
7+ const cwd = state . projectDir ?? process . cwd ( ) ;
48 // make sure shadcn is installed, throw if not
9+ const shadcnInstalled = await fs . pathExists ( path . join ( cwd , "components.json" ) ) ;
10+ if ( ! shadcnInstalled ) {
11+ throw new Error ( "Shadcn is not installed. Please run `pnpm dlx shadcn@latest init` to install it." ) ;
12+ }
513
614 // if proofkit is not inited, try to stealth init
715 await stealthInit ( ) ;
Original file line number Diff line number Diff line change @@ -19,7 +19,5 @@ export async function stealthInit() {
1919 }
2020
2121 // create proofkit.json
22- await fs . writeJson ( "proofkit.json" , defaultSettings
23-
24- ) ;
22+ await fs . writeJson ( "proofkit.json" , defaultSettings ) ;
2523}
Original file line number Diff line number Diff line change @@ -68,7 +68,7 @@ const settingsSchema = z.object({
6868 registryTemplates : z . array ( z . string ( ) ) . default ( [ ] ) ,
6969} ) ;
7070
71- export const defaultSettings = settingsSchema . parse ( { auth : { type : "none" } } ) ;
71+ export const defaultSettings = settingsSchema . parse ( { auth : { type : "none" } , ui : "shadcn" } ) ;
7272
7373let settings : Settings | undefined ;
7474export const getSettings = ( ) => {
Original file line number Diff line number Diff line change @@ -191,7 +191,7 @@ export async function getStaticComponent(
191191 path : file . sourceFileName ,
192192 type : file . type ,
193193 content,
194- target : file . destinationPath ?? file . sourceFileName ,
194+ target : file . destinationPath !
195195 } ;
196196
197197 return shadcnFile ;
Original file line number Diff line number Diff line change 11"use client" ;
22
33import { AuthUIProvider as BetterAuthUIProvider } from "@daveyplate/better-auth-ui" ;
4- import { authClient } from "@/auth-client" ;
4+ import { authClient } from "@/registry/lib/ auth-client" ;
55import { useRouter } from "next/navigation" ;
66import Link from "next/link" ;
77
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ export const meta: TemplateMetadata = {
1212 "@proofkit/better-auth" ,
1313 ] ,
1414 registryDependencies : [
15+ "{proofkit}/r/utils/t3-env" ,
1516 "{proofkit}/r/react-email" ,
1617 "{proofkit}/r/email/generic" ,
1718 ] ,
@@ -34,22 +35,15 @@ export const meta: TemplateMetadata = {
3435 } ,
3536 {
3637 sourceFileName : "auth.ts" ,
37- destinationPath : "src/auth.ts" ,
38- type : "registry:file" ,
38+ type : "registry:lib" ,
3939 } ,
4040 {
4141 sourceFileName : "auth-client.ts" ,
42- destinationPath : "src/auth-client.ts" ,
43- type : "registry:file" ,
44- } ,
45- {
46- sourceFileName : "auth/[pathname]/page.tsx" ,
47- // destinationPath: "src/app/auth/[pathname]/page.tsx",
48- type : "registry:page" ,
42+ type : "registry:lib" ,
4943 } ,
5044 {
51- sourceFileName : "view .tsx" ,
52- destinationPath : "src/app/auth/[pathname]/view .tsx" ,
45+ sourceFileName : "page .tsx" ,
46+ destinationPath : "src/app/auth/[pathname]/page .tsx" ,
5347 type : "registry:file" ,
5448 } ,
5549 {
Original file line number Diff line number Diff line change 1- import { auth } from "@/auth" ;
1+ import { auth } from "@/registry/lib/ auth" ;
22import { toNextJsHandler } from "better-auth/next-js" ;
33
44export const { GET , POST } = toNextJsHandler ( auth . handler ) ;
Original file line number Diff line number Diff line change 11import { FileMakerAdapter } from "@proofkit/better-auth" ;
22import { betterAuth } from "better-auth" ;
33import { nextCookies } from "better-auth/next-js" ;
4- import { env } from "@/config /env" ;
4+ import { env } from "@/registry/lib /env" ;
55import { render } from "@react-email/components" ;
66import { GenericEmail } from "@/emails/generic" ;
77
Original file line number Diff line number Diff line change 1+ import { AuthView } from "@daveyplate/better-auth-ui" ;
12import { authViewPaths } from "@daveyplate/better-auth-ui/server" ;
2- import { AuthView } from "../../view" ;
33
44export function generateStaticParams ( ) {
55 return Object . values ( authViewPaths ) . map ( ( pathname ) => ( { pathname } ) ) ;
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments