Skip to content

Commit

Permalink
kinde updated
Browse files Browse the repository at this point in the history
  • Loading branch information
nicoalbanese committed Feb 7, 2024
1 parent 2e98090 commit 7c03402
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 18 deletions.
31 changes: 27 additions & 4 deletions src/commands/add/auth/kinde/generators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,37 @@ export default async function SignIn() {
);
} else {
return (
<div>
<LoginLink className="hover:underline">Sign in</LoginLink>
<br />
<RegisterLink className="hover:underline">Sign up</RegisterLink>
<div className="w-full space-y-2 pt-4">
<LoginLink className="text-center block hover:bg-neutral-900 bg-neutral-800 text-neutral-50 px-4 py-2 rounded-lg">
Sign in
</LoginLink>
<RegisterLink className="text-center block hover:bg-neutral-200 bg-neutral-100 text-neutral-800 px-4 py-2 rounded-lg">
Sign up
</RegisterLink>
</div>
);
}
};
`;
};

export const generateSignInPage = () => {
return `import SignIn from "${formatFilePath("components/auth/SignIn", { prefix: "alias", removeExtension: false })}";
const Page = async () => {
return (
<main className="bg-popover max-w-lg mx-auto my-4 rounded-lg p-10">
<h1 className="text-2xl font-bold text-center">
Sign in to your account
</h1>
<div className="">
<SignIn />
</div>
</main>
);
};
export default Page;
`;
};
10 changes: 10 additions & 0 deletions src/commands/add/auth/kinde/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
generateAuthUtils,
generateKindeRouteHandler,
generateSignInComponent,
generateSignInPage,
} from "./generators.js";
import { updateTrpcWithSessionIfInstalled } from "../shared/index.js";
import { addToInstallList } from "../../utils.js";
Expand Down Expand Up @@ -53,6 +54,15 @@ export const addKinde = async () => {
generateUpdatedRootRoute()
);

// generate sign in page
createFile(
formatFilePath(kinde.signInPage, {
prefix: "rootPath",
removeExtension: false,
}),
generateSignInPage()
);

// If trpc installed, add protectedProcedure
updateTrpcWithSessionIfInstalled();

Expand Down
30 changes: 16 additions & 14 deletions src/commands/filePaths/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ export const paths: { t3: Paths; normal: Paths } = {
},
kinde: {
routeHandler: "app/api/auth/[kindeAuth]/route.ts",
signInPage: "app/(auth)/sign-in/page.tsx",
},
resend: {
emailUtils: "lib/email/utils.ts",
Expand Down Expand Up @@ -111,14 +112,14 @@ export const paths: { t3: Paths; normal: Paths } = {
},
auth: {
authUtils: "lib/auth/utils.ts",
accountPage: "app/account/page.tsx",
accountPage: "app/(app)/account/page.tsx",
authSchema: "server/db/schema/auth.ts",
accountApiRoute: "app/api/account/route.ts",
signInComponent: "components/auth/SignIn.tsx",
accountCardComponent: "app/account/AccountCard.tsx",
userSettingsComponent: "app/account/UserSettings.tsx",
updateNameCardComponent: "app/account/UpdateNameCard.tsx",
updateEmailCardComponent: "app/account/UpdateEmailCard.tsx",
accountCardComponent: "app/(app)/account/AccountCard.tsx",
userSettingsComponent: "app/(app)/account/UserSettings.tsx",
updateNameCardComponent: "app/(app)/account/UpdateNameCard.tsx",
updateEmailCardComponent: "app/(app)/account/UpdateEmailCard.tsx",
layoutPage: "app/(auth)/layout.tsx",
},
init: {
Expand Down Expand Up @@ -146,44 +147,45 @@ export const paths: { t3: Paths; normal: Paths } = {
},
clerk: {
middleware: "middleware.ts",
signInPage: "app/sign-in/[[...sign-in]]/page.tsx",
signUpPage: "app/sign-up/[[...sign-in]]/page.tsx",
signInPage: "app/(auth)/sign-in/[[...sign-in]]/page.tsx",
signUpPage: "app/(auth)/sign-up/[[...sign-in]]/page.tsx",
},
lucia: {
signUpApiRoute: "app/api/sign-up/route.ts",
signInApiRoute: "app/api/sign-in/route.ts",
signOutApiRoute: "app/api/sign-out/route.ts",
appDTs: "app.d.ts",
signInPage: "app/sign-in/page.tsx",
signUpPage: "app/sign-up/page.tsx",
signInPage: "app/(auth)/sign-in/page.tsx",
signUpPage: "app/(auth)/sign-up/page.tsx",
libAuthLucia: "lib/auth/lucia.ts",
authFormComponent: "components/auth/Form.tsx",
signOutButtonComponent: "components/auth/SignOutBtn.tsx",
},
kinde: {
routeHandler: "app/api/auth/[kindeAuth]/route.ts",
signInPage: "app/(auth)/sign-in/page.tsx",
},
resend: {
emailUtils: "lib/email/utils.ts",
resendPage: "app/resend/page.tsx",
resendPage: "app/(app)/resend/page.tsx",
emailApiRoute: "app/api/email/route.ts",
libEmailIndex: "lib/email/index.ts",
firstEmailComponent: "components/emails/FirstEmail.tsx",
},
stripe: {
stripeIndex: "lib/stripe/index.ts",
accountBillingPage: "app/account/billing/page.tsx",
accountBillingPage: "app/(app)/account/billing/page.tsx",
configSubscription: "config/subscriptions.ts",
stripeSubscription: "lib/stripe/subscription.ts",
accountRouterTrpc: "server/api/routers/account.ts",
billingSuccessToast: "app/account/billing/SuccessToast.tsx",
billingSuccessToast: "app/(app)/account/billing/SuccessToast.tsx",
subscriptionSchema: "server/db/schema/subscriptions.ts",
stripeWebhooksApiRoute: "app/api/webhooks/stripe/route.ts",
manageSubscriptionApiRoute:
"app/api/billing/manage-subscription/route.ts",
accountPlanSettingsComponent: "app/account/PlanSettings.tsx",
accountPlanSettingsComponent: "app/(app)/account/PlanSettings.tsx",
billingManageSubscriptionComponent:
"app/account/billing/ManageSubscription.tsx",
"app/(app)/account/billing/ManageSubscription.tsx",
},
"next-auth": {
signOutButtonComponent: "components/auth/SignOutBtn.tsx",
Expand Down
1 change: 1 addition & 0 deletions src/commands/filePaths/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export type Paths = {
};
kinde: {
routeHandler: string;
signInPage: string;
};
trpc: {
rootRouter: string;
Expand Down

0 comments on commit 7c03402

Please sign in to comment.