authverse 1.1.8-beta.1 → 1.1.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 (3) hide show
  1. package/dist/index.cjs +112 -47
  2. package/dist/index.js +112 -47
  3. package/package.json +8 -6
package/dist/index.cjs CHANGED
@@ -115,7 +115,7 @@ var authUiRun = async ({
115
115
  if (!import_fs.default.existsSync(shadcnPath) || !import_fs.default.existsSync(shadcnConfigPath)) {
116
116
  console.log(import_chalk.default.yellow("\n Installing shadcn ui Components\n"));
117
117
  if (cmd == true) {
118
- runCommand("shadcn@latest init --base-color zinc --yes");
118
+ runCommand("shadcn@latest init");
119
119
  runCommand("shadcn@latest add button sonner card field input");
120
120
  } else {
121
121
  runCommand("shadcn@latest add button sonner card field input");
@@ -402,7 +402,7 @@ BETTER_AUTH_URL=http://localhost:3000
402
402
  __dirname,
403
403
  "./template/proxy/proxy.ts"
404
404
  );
405
- const proxyDestinationDir = import_path2.default.join(projectDir);
405
+ const proxyDestinationDir = import_path2.default.join(projectDir, srcFolder);
406
406
  const proxyDestinationPath = import_path2.default.join(proxyDestinationDir, "proxy.ts");
407
407
  import_fs2.default.copyFileSync(proxyTemplatePath, proxyDestinationPath);
408
408
  const gitignorePath = import_path2.default.join(projectDir, ".gitignore");
@@ -597,7 +597,7 @@ BETTER_AUTH_URL=http://localhost:3000
597
597
  __dirname,
598
598
  "./template/proxy/proxy.ts"
599
599
  );
600
- const proxyDestinationDir = import_path3.default.join(projectDir);
600
+ const proxyDestinationDir = import_path3.default.join(projectDir, srcFolder);
601
601
  const proxyDestinationPath = import_path3.default.join(proxyDestinationDir, "proxy.ts");
602
602
  import_fs3.default.copyFileSync(proxyTemplatePath, proxyDestinationPath);
603
603
  if (authUi) {
@@ -661,7 +661,7 @@ var authUiTanstackState = async ({
661
661
  if (!import_fs4.default.existsSync(shadcnPath) || !import_fs4.default.existsSync(shadcnConfigPath)) {
662
662
  console.log(import_chalk4.default.yellow("\n Installing shadcn ui Components\n"));
663
663
  if (cmd == true) {
664
- runCommand("shadcn@latest init --base-color zinc --yes");
664
+ runCommand("shadcn@latest init");
665
665
  runCommand("shadcn@latest add button sonner card field input");
666
666
  } else {
667
667
  runCommand("shadcn@latest add button sonner card field input");
@@ -1146,7 +1146,8 @@ var googleNext = async () => {
1146
1146
  const folder = import_fs8.default.existsSync(srcPath) ? "src" : "";
1147
1147
  const authFilePath = import_path8.default.join(projectDir, folder, "lib", "auth.ts");
1148
1148
  if (!import_fs8.default.existsSync(authFilePath)) {
1149
- console.log(import_chalk8.default.red("\u274C auth.ts file not found"));
1149
+ console.log(import_chalk8.default.red("No Configured Better Auth file found"));
1150
+ console.log(import_chalk8.default.cyan("Run authverse init to initialize better auth"));
1150
1151
  return;
1151
1152
  }
1152
1153
  let content = import_fs8.default.readFileSync(authFilePath, "utf8");
@@ -1262,7 +1263,8 @@ var githubNext = async () => {
1262
1263
  const folder = import_fs9.default.existsSync(srcPath) ? "src" : "";
1263
1264
  const authFilePath = import_path9.default.join(projectDir, folder, "lib", "auth.ts");
1264
1265
  if (!import_fs9.default.existsSync(authFilePath)) {
1265
- console.log(import_chalk9.default.red("auth.ts file not found"));
1266
+ console.log(import_chalk9.default.red("No Configured Better Auth file found"));
1267
+ console.log(import_chalk9.default.cyan("Run authverse init to initialize better auth"));
1266
1268
  return;
1267
1269
  }
1268
1270
  let content = import_fs9.default.readFileSync(authFilePath, "utf8");
@@ -1377,7 +1379,8 @@ var googleTanstackStart = async () => {
1377
1379
  const srcPath = import_path10.default.join(projectDir, "src");
1378
1380
  const authFilePath = import_path10.default.join(srcPath, "lib", "auth.ts");
1379
1381
  if (!import_fs10.default.existsSync(authFilePath)) {
1380
- console.log(import_chalk10.default.red("auth.ts file not found"));
1382
+ console.log(import_chalk10.default.red("No Configured Better Auth file found"));
1383
+ console.log(import_chalk10.default.cyan("Run authverse init to initialize better auth"));
1381
1384
  return;
1382
1385
  }
1383
1386
  let content = import_fs10.default.readFileSync(authFilePath, "utf8");
@@ -1484,7 +1487,8 @@ var githubTanstackStart = async () => {
1484
1487
  const srcPath = import_path11.default.join(projectDir, "src");
1485
1488
  const authFilePath = import_path11.default.join(srcPath, "lib", "auth.ts");
1486
1489
  if (!import_fs11.default.existsSync(authFilePath)) {
1487
- console.log(import_chalk11.default.red("auth.ts file not found"));
1490
+ console.log(import_chalk11.default.red("No Configured Better Auth file found"));
1491
+ console.log(import_chalk11.default.cyan("Run authverse init to initialize better auth"));
1488
1492
  return;
1489
1493
  }
1490
1494
  let content = import_fs11.default.readFileSync(authFilePath, "utf8");
@@ -1592,7 +1596,8 @@ var facebookNext = async () => {
1592
1596
  const folder = import_fs12.default.existsSync(srcPath) ? "src" : "";
1593
1597
  const authFilePath = import_path12.default.join(projectDir, folder, "lib", "auth.ts");
1594
1598
  if (!import_fs12.default.existsSync(authFilePath)) {
1595
- console.log(import_chalk12.default.red("auth.ts file not found"));
1599
+ console.log(import_chalk12.default.red("No Configured Better Auth file found"));
1600
+ console.log(import_chalk12.default.cyan("Run authverse init to initialize better auth"));
1596
1601
  return;
1597
1602
  }
1598
1603
  let content = import_fs12.default.readFileSync(authFilePath, "utf8");
@@ -1707,7 +1712,8 @@ var facebookTanstackStart = async () => {
1707
1712
  const srcPath = import_path13.default.join(projectDir, "src");
1708
1713
  const authFilePath = import_path13.default.join(srcPath, "lib", "auth.ts");
1709
1714
  if (!import_fs13.default.existsSync(authFilePath)) {
1710
- console.log(import_chalk13.default.red("auth.ts file not found"));
1715
+ console.log(import_chalk13.default.red("No Configured Better Auth file found"));
1716
+ console.log(import_chalk13.default.cyan("Run authverse init to initialize better auth"));
1711
1717
  return;
1712
1718
  }
1713
1719
  let content = import_fs13.default.readFileSync(authFilePath, "utf8");
@@ -1815,7 +1821,8 @@ var LinkedInNext = async () => {
1815
1821
  const folder = import_fs14.default.existsSync(srcPath) ? "src" : "";
1816
1822
  const authFilePath = import_path14.default.join(projectDir, folder, "lib", "auth.ts");
1817
1823
  if (!import_fs14.default.existsSync(authFilePath)) {
1818
- console.log(import_chalk14.default.red("auth.ts file not found"));
1824
+ console.log(import_chalk14.default.red("No Configured Better Auth file found"));
1825
+ console.log(import_chalk14.default.cyan("Run authverse init to initialize better auth"));
1819
1826
  return;
1820
1827
  }
1821
1828
  let content = import_fs14.default.readFileSync(authFilePath, "utf8");
@@ -1930,7 +1937,8 @@ var LinkedInTanstackStart = async () => {
1930
1937
  const srcPath = import_path15.default.join(projectDir, "src");
1931
1938
  const authFilePath = import_path15.default.join(srcPath, "lib", "auth.ts");
1932
1939
  if (!import_fs15.default.existsSync(authFilePath)) {
1933
- console.log(import_chalk15.default.red("auth.ts file not found"));
1940
+ console.log(import_chalk15.default.red("No Configured Better Auth file found"));
1941
+ console.log(import_chalk15.default.cyan("Run authverse init to initialize better auth"));
1934
1942
  return;
1935
1943
  }
1936
1944
  let content = import_fs15.default.readFileSync(authFilePath, "utf8");
@@ -2038,7 +2046,8 @@ var twitterNext = async () => {
2038
2046
  const folder = import_fs16.default.existsSync(srcPath) ? "src" : "";
2039
2047
  const authFilePath = import_path16.default.join(projectDir, folder, "lib", "auth.ts");
2040
2048
  if (!import_fs16.default.existsSync(authFilePath)) {
2041
- console.log(import_chalk16.default.red("auth.ts file not found"));
2049
+ console.log(import_chalk16.default.red("No Configured Better Auth file found"));
2050
+ console.log(import_chalk16.default.cyan("Run authverse init to initialize better auth"));
2042
2051
  return;
2043
2052
  }
2044
2053
  let content = import_fs16.default.readFileSync(authFilePath, "utf8");
@@ -2153,7 +2162,8 @@ var twitterTanstackStart = async () => {
2153
2162
  const srcPath = import_path17.default.join(projectDir, "src");
2154
2163
  const authFilePath = import_path17.default.join(srcPath, "lib", "auth.ts");
2155
2164
  if (!import_fs17.default.existsSync(authFilePath)) {
2156
- console.log(import_chalk17.default.red("auth.ts file not found"));
2165
+ console.log(import_chalk17.default.red("No Configured Better Auth file found"));
2166
+ console.log(import_chalk17.default.cyan("Run authverse init to initialize better auth"));
2157
2167
  return;
2158
2168
  }
2159
2169
  let content = import_fs17.default.readFileSync(authFilePath, "utf8");
@@ -2261,12 +2271,14 @@ var AppleNext = async () => {
2261
2271
  const folder = import_fs18.default.existsSync(srcPath) ? "src" : "";
2262
2272
  const authFilePath = import_path18.default.join(projectDir, folder, "lib", "auth.ts");
2263
2273
  if (!import_fs18.default.existsSync(authFilePath)) {
2264
- console.log(import_chalk18.default.red("auth.ts file not found"));
2274
+ console.log(import_chalk18.default.red("No Configured Better Auth file found"));
2275
+ console.log(import_chalk18.default.cyan("Run authverse init to initialize better auth"));
2265
2276
  return;
2266
2277
  }
2267
2278
  let content = import_fs18.default.readFileSync(authFilePath, "utf8");
2268
2279
  if (!content.includes("betterAuth({")) {
2269
2280
  console.log(import_chalk18.default.red("betterAuth({}) block not found"));
2281
+ console.log(import_chalk18.default.cyan("Run authverse init to initialize better auth"));
2270
2282
  return;
2271
2283
  }
2272
2284
  if (content.includes("socialProviders") && content.includes("apple:")) {
@@ -2393,7 +2405,8 @@ var AppleTanstackStart = async () => {
2393
2405
  const srcPath = import_path19.default.join(projectDir, "src");
2394
2406
  const authFilePath = import_path19.default.join(srcPath, "lib", "auth.ts");
2395
2407
  if (!import_fs19.default.existsSync(authFilePath)) {
2396
- console.log(import_chalk19.default.red("auth.ts file not found"));
2408
+ console.log(import_chalk19.default.red("No Configured Better Auth file found"));
2409
+ console.log(import_chalk19.default.cyan("Run authverse init to initialize better auth"));
2397
2410
  return;
2398
2411
  }
2399
2412
  let content = import_fs19.default.readFileSync(authFilePath, "utf8");
@@ -2582,6 +2595,10 @@ var gmailRun = async () => {
2582
2595
  console.log(import_chalk21.default.cyan("\n\u2699\uFE0F Installing @react-email/components...\n"));
2583
2596
  packageManager("@react-email/components");
2584
2597
  }
2598
+ if (!packageJson2.dependencies?.["@react-email/render"]) {
2599
+ console.log(import_chalk21.default.cyan("\n\u2699\uFE0F Installing @react-email/render...\n"));
2600
+ packageManager("@react-email/render");
2601
+ }
2585
2602
  const envPath = import_path20.default.join(projectDir, ".env");
2586
2603
  const envContent = import_fs20.default.readFileSync(envPath, "utf8");
2587
2604
  if (!envContent.includes("GMAIL_HOST") && !envContent.includes("GMAIL_PORT") && !envContent.includes("GMAIL_SERVICE") && !envContent.includes("GMAIL_MAIL") && !envContent.includes("GMAIL_NAME") && !envContent.includes("GMAIL_PASSWORD")) {
@@ -2613,8 +2630,13 @@ GMAIL_PASSWORD=`);
2613
2630
  import_fs20.default.copyFileSync(templatePath, libDestinationPath);
2614
2631
  console.log(import_chalk21.default.green("\nCompleted installation successfully"));
2615
2632
  console.log(import_chalk21.default.cyan("\nInstall Package:"));
2616
- console.log(import_chalk21.default.white(`\u2022 nodemailer
2617
- \u2022 @react-email/components`));
2633
+ console.log(
2634
+ import_chalk21.default.white(
2635
+ `\u2022 nodemailer
2636
+ \u2022 @react-email/components
2637
+ \u2022 @react-email/render`
2638
+ )
2639
+ );
2618
2640
  console.log(import_chalk21.default.cyan("\nFiles created:"));
2619
2641
  console.log(
2620
2642
  import_chalk21.default.white(
@@ -2649,6 +2671,10 @@ var gmailRunTanstackStart = async () => {
2649
2671
  console.log(import_chalk22.default.cyan("\n\u2699\uFE0F Installing @react-email/components...\n"));
2650
2672
  packageManager("@react-email/components");
2651
2673
  }
2674
+ if (!packageJson2.dependencies?.["@react-email/render"]) {
2675
+ console.log(import_chalk22.default.cyan("\n\u2699\uFE0F Installing @react-email/render...\n"));
2676
+ packageManager("@react-email/render");
2677
+ }
2652
2678
  const envPath = import_path21.default.join(projectDir, ".env");
2653
2679
  const envContent = import_fs21.default.readFileSync(envPath, "utf8");
2654
2680
  if (!envContent.includes("GMAIL_HOST") && !envContent.includes("GMAIL_PORT") && !envContent.includes("GMAIL_SERVICE") && !envContent.includes("GMAIL_MAIL") && !envContent.includes("GMAIL_NAME") && !envContent.includes("GMAIL_PASSWORD")) {
@@ -2680,8 +2706,13 @@ GMAIL_PASSWORD=`);
2680
2706
  import_fs21.default.copyFileSync(templatePath, libDestinationPath);
2681
2707
  console.log(import_chalk22.default.green("\nCompleted installation successfully"));
2682
2708
  console.log(import_chalk22.default.cyan("\nInstall Package:"));
2683
- console.log(import_chalk22.default.white(`\u2022 nodemailer
2684
- \u2022 @react-email/components`));
2709
+ console.log(
2710
+ import_chalk22.default.white(
2711
+ `\u2022 nodemailer
2712
+ \u2022 @react-email/components
2713
+ \u2022 @react-email/render`
2714
+ )
2715
+ );
2685
2716
  console.log(import_chalk22.default.cyan("\nFiles created:"));
2686
2717
  console.log(import_chalk22.default.white("\u2022 src/lib/email.ts\n"));
2687
2718
  } catch (error) {
@@ -2712,6 +2743,10 @@ var awsSesRun = async () => {
2712
2743
  console.log(import_chalk23.default.cyan("\n\u2699\uFE0F Installing @react-email/components...\n"));
2713
2744
  packageManager("@react-email/components");
2714
2745
  }
2746
+ if (!packageJson2.dependencies?.["@react-email/render"]) {
2747
+ console.log(import_chalk23.default.cyan("\n\u2699\uFE0F Installing @react-email/render...\n"));
2748
+ packageManager("@react-email/render");
2749
+ }
2715
2750
  const envPath = import_path22.default.join(projectDir, ".env");
2716
2751
  const envContent = import_fs22.default.readFileSync(envPath, "utf8");
2717
2752
  if (!envContent.includes("AWS_SES_HOST") && !envContent.includes("AWS_SES_PORT") && !envContent.includes("AWS_SES_SERVICE") && !envContent.includes("AWS_SES_USER") && !envContent.includes("AWS_SES_PASS") && !envContent.includes("AWS_SES_FROM")) {
@@ -2743,8 +2778,13 @@ AWS_SES_FROM=`);
2743
2778
  import_fs22.default.copyFileSync(templatePath, libDestinationPath);
2744
2779
  console.log(import_chalk23.default.green("\nCompleted installation successfully"));
2745
2780
  console.log(import_chalk23.default.cyan("\nInstall Package:"));
2746
- console.log(import_chalk23.default.white(`\u2022 nodemailer
2747
- \u2022 @react-email/components`));
2781
+ console.log(
2782
+ import_chalk23.default.white(
2783
+ `\u2022 nodemailer
2784
+ \u2022 @react-email/components
2785
+ \u2022 @react-email/render`
2786
+ )
2787
+ );
2748
2788
  console.log(import_chalk23.default.cyan("\nFiles created:"));
2749
2789
  console.log(
2750
2790
  import_chalk23.default.white(
@@ -2779,6 +2819,10 @@ var awsSesRunTanstackStart = async () => {
2779
2819
  console.log(import_chalk24.default.cyan("\n\u2699\uFE0F Installing @react-email/components...\n"));
2780
2820
  packageManager("@react-email/components");
2781
2821
  }
2822
+ if (!packageJson2.dependencies?.["@react-email/render"]) {
2823
+ console.log(import_chalk24.default.cyan("\n\u2699\uFE0F Installing @react-email/render...\n"));
2824
+ packageManager("@react-email/render");
2825
+ }
2782
2826
  const envPath = import_path23.default.join(projectDir, ".env");
2783
2827
  const envContent = import_fs23.default.readFileSync(envPath, "utf8");
2784
2828
  if (!envContent.includes("AWS_SES_HOST") && !envContent.includes("AWS_SES_PORT") && !envContent.includes("AWS_SES_SERVICE") && !envContent.includes("AWS_SES_USER") && !envContent.includes("AWS_SES_PASS") && !envContent.includes("AWS_SES_FROM")) {
@@ -2810,8 +2854,13 @@ AWS_SES_FROM=`);
2810
2854
  import_fs23.default.copyFileSync(templatePath, libDestinationPath);
2811
2855
  console.log(import_chalk24.default.green("\nCompleted installation successfully"));
2812
2856
  console.log(import_chalk24.default.cyan("\nInstall Package:"));
2813
- console.log(import_chalk24.default.white(`\u2022 nodemailer
2814
- \u2022 @react-email/components`));
2857
+ console.log(
2858
+ import_chalk24.default.white(
2859
+ `\u2022 nodemailer
2860
+ \u2022 @react-email/components
2861
+ \u2022 @react-email/render`
2862
+ )
2863
+ );
2815
2864
  console.log(import_chalk24.default.cyan("\nFiles created:"));
2816
2865
  console.log(import_chalk24.default.white("\u2022 src/lib/email.ts\n"));
2817
2866
  } catch (error) {
@@ -2841,6 +2890,10 @@ var resendRun = async () => {
2841
2890
  console.log(import_chalk25.default.cyan("\n\u2699\uFE0F Installing @react-email/components...\n"));
2842
2891
  packageManager("@react-email/components");
2843
2892
  }
2893
+ if (!packageJson2.dependencies?.["@react-email/render"]) {
2894
+ console.log(import_chalk25.default.cyan("\n\u2699\uFE0F Installing @react-email/render...\n"));
2895
+ packageManager("@react-email/render");
2896
+ }
2844
2897
  const envPath = import_path24.default.join(projectDir, ".env");
2845
2898
  const envContent = import_fs24.default.readFileSync(envPath, "utf8");
2846
2899
  if (!envContent.includes("RESEND_API_KEY") && !envContent.includes("EMAIL_SENDER_NAME") && !envContent.includes("EMAIL_SENDER_ADDRESS")) {
@@ -2866,8 +2919,11 @@ EMAIL_SENDER_ADDRESS=`);
2866
2919
  import_fs24.default.copyFileSync(templatePath, libDestinationPath);
2867
2920
  console.log(import_chalk25.default.green("\nCompleted installation successfully"));
2868
2921
  console.log(import_chalk25.default.cyan("\nInstall Package:"));
2869
- console.log(import_chalk25.default.white(`\u2022 resend
2870
- \u2022 @react-email/components`));
2922
+ console.log(
2923
+ import_chalk25.default.white(`\u2022 resend
2924
+ \u2022 @react-email/components
2925
+ \u2022 @react-email/render`)
2926
+ );
2871
2927
  console.log(import_chalk25.default.cyan("\nFiles created:"));
2872
2928
  console.log(
2873
2929
  import_chalk25.default.white(
@@ -2926,8 +2982,11 @@ EMAIL_SENDER_ADDRESS=`);
2926
2982
  import_fs25.default.copyFileSync(templatePath, libDestinationPath);
2927
2983
  console.log(import_chalk26.default.green("\nCompleted installation successfully"));
2928
2984
  console.log(import_chalk26.default.cyan("\nInstall Package:"));
2929
- console.log(import_chalk26.default.white(`\u2022 resend
2930
- \u2022 @react-email/components`));
2985
+ console.log(
2986
+ import_chalk26.default.white(`\u2022 resend
2987
+ \u2022 @react-email/components
2988
+ \u2022 @react-email/render`)
2989
+ );
2931
2990
  console.log(import_chalk26.default.cyan("\nFiles created:"));
2932
2991
  console.log(import_chalk26.default.white("\u2022 src/lib/email.ts\n"));
2933
2992
  } catch (error) {
@@ -3028,7 +3087,7 @@ var forgetNext = async () => {
3028
3087
  return;
3029
3088
  }
3030
3089
  let content = import_fs27.default.readFileSync(authFilePath, "utf8");
3031
- const codeAdded = ` sendResetPassword: async ({ user, url, token }) => {
3090
+ const codeAdded = `sendResetPassword: async ({ user, url, token }) => {
3032
3091
  await sendEmail({
3033
3092
  email: user.email!,
3034
3093
  subject: "Reset your password",
@@ -3060,25 +3119,28 @@ var forgetNext = async () => {
3060
3119
  emailAndPasswordStart,
3061
3120
  emailAndPasswordEnd
3062
3121
  );
3063
- if (emailAndPasswordContent.includes("sendResetPassword:")) {
3064
- content = content.replace(
3065
- /sendResetPassword:\s*async\s*\([^)]*\)[^{]*\{[^}]*\}[^,]*/,
3066
- codeAdded
3067
- );
3068
- } else {
3122
+ if (!emailAndPasswordContent.includes("sendResetPassword:")) {
3069
3123
  const before = content.substring(0, emailAndPasswordEnd);
3070
3124
  const after = content.substring(emailAndPasswordEnd);
3071
- content = before + `
3072
- ${codeAdded}` + after;
3125
+ content = before + `${codeAdded}` + after;
3073
3126
  }
3074
3127
  import_fs27.default.writeFileSync(authFilePath, content, "utf8");
3075
3128
  if (!content.includes("import { sendEmail }")) {
3129
+ const lastImportIndex = content.lastIndexOf("import");
3130
+ const nextLineAfterLastImport = content.indexOf("\n", lastImportIndex) + 1;
3131
+ const beforeImports = content.substring(0, nextLineAfterLastImport);
3132
+ const afterImports = content.substring(nextLineAfterLastImport);
3133
+ const newImports = `import { sendEmail } from "./email";
3134
+ `;
3135
+ content = beforeImports + newImports + afterImports;
3136
+ import_fs27.default.writeFileSync(authFilePath, content, "utf8");
3137
+ }
3138
+ if (!content.includes("import ForgotPasswordEmail from")) {
3076
3139
  const lastImportIndex = content.lastIndexOf("import");
3077
3140
  const nextLineAfterLastImport = content.indexOf("\n", lastImportIndex) + 1;
3078
3141
  const beforeImports = content.substring(0, nextLineAfterLastImport);
3079
3142
  const afterImports = content.substring(nextLineAfterLastImport);
3080
3143
  const newImports = `import ForgotPasswordEmail from "@/components/email/reset-password";
3081
- import { sendEmail } from "./email";
3082
3144
  `;
3083
3145
  content = beforeImports + newImports + afterImports;
3084
3146
  import_fs27.default.writeFileSync(authFilePath, content, "utf8");
@@ -3244,25 +3306,28 @@ var forgetTanstack = async () => {
3244
3306
  emailAndPasswordStart,
3245
3307
  emailAndPasswordEnd
3246
3308
  );
3247
- if (emailAndPasswordContent.includes("sendResetPassword:")) {
3248
- content = content.replace(
3249
- /sendResetPassword:\s*async\s*\([^)]*\)[^{]*\{[^}]*\}[^,]*/,
3250
- codeAdded
3251
- );
3252
- } else {
3309
+ if (!emailAndPasswordContent.includes("sendResetPassword:")) {
3253
3310
  const before = content.substring(0, emailAndPasswordEnd);
3254
3311
  const after = content.substring(emailAndPasswordEnd);
3255
- content = before + `
3256
- ${codeAdded}` + after;
3312
+ content = before + `${codeAdded}` + after;
3257
3313
  }
3258
3314
  import_fs28.default.writeFileSync(authFilePath, content, "utf8");
3259
3315
  if (!content.includes("import { sendEmail }")) {
3316
+ const lastImportIndex = content.lastIndexOf("import");
3317
+ const nextLineAfterLastImport = content.indexOf("\n", lastImportIndex) + 1;
3318
+ const beforeImports = content.substring(0, nextLineAfterLastImport);
3319
+ const afterImports = content.substring(nextLineAfterLastImport);
3320
+ const newImports = `import { sendEmail } from "./email";
3321
+ `;
3322
+ content = beforeImports + newImports + afterImports;
3323
+ import_fs28.default.writeFileSync(authFilePath, content, "utf8");
3324
+ }
3325
+ if (!content.includes("import ForgotPasswordEmail from")) {
3260
3326
  const lastImportIndex = content.lastIndexOf("import");
3261
3327
  const nextLineAfterLastImport = content.indexOf("\n", lastImportIndex) + 1;
3262
3328
  const beforeImports = content.substring(0, nextLineAfterLastImport);
3263
3329
  const afterImports = content.substring(nextLineAfterLastImport);
3264
3330
  const newImports = `import ForgotPasswordEmail from "@/components/email/reset-password";
3265
- import { sendEmail } from "./email";
3266
3331
  `;
3267
3332
  content = beforeImports + newImports + afterImports;
3268
3333
  import_fs28.default.writeFileSync(authFilePath, content, "utf8");
package/dist/index.js CHANGED
@@ -92,7 +92,7 @@ var authUiRun = async ({
92
92
  if (!fs.existsSync(shadcnPath) || !fs.existsSync(shadcnConfigPath)) {
93
93
  console.log(chalk.yellow("\n Installing shadcn ui Components\n"));
94
94
  if (cmd == true) {
95
- runCommand("shadcn@latest init --base-color zinc --yes");
95
+ runCommand("shadcn@latest init");
96
96
  runCommand("shadcn@latest add button sonner card field input");
97
97
  } else {
98
98
  runCommand("shadcn@latest add button sonner card field input");
@@ -378,7 +378,7 @@ BETTER_AUTH_URL=http://localhost:3000
378
378
  __dirname,
379
379
  "./template/proxy/proxy.ts"
380
380
  );
381
- const proxyDestinationDir = path2.join(projectDir);
381
+ const proxyDestinationDir = path2.join(projectDir, srcFolder);
382
382
  const proxyDestinationPath = path2.join(proxyDestinationDir, "proxy.ts");
383
383
  fs2.copyFileSync(proxyTemplatePath, proxyDestinationPath);
384
384
  const gitignorePath = path2.join(projectDir, ".gitignore");
@@ -572,7 +572,7 @@ BETTER_AUTH_URL=http://localhost:3000
572
572
  __dirname,
573
573
  "./template/proxy/proxy.ts"
574
574
  );
575
- const proxyDestinationDir = path3.join(projectDir);
575
+ const proxyDestinationDir = path3.join(projectDir, srcFolder);
576
576
  const proxyDestinationPath = path3.join(proxyDestinationDir, "proxy.ts");
577
577
  fs3.copyFileSync(proxyTemplatePath, proxyDestinationPath);
578
578
  if (authUi) {
@@ -635,7 +635,7 @@ var authUiTanstackState = async ({
635
635
  if (!fs4.existsSync(shadcnPath) || !fs4.existsSync(shadcnConfigPath)) {
636
636
  console.log(chalk4.yellow("\n Installing shadcn ui Components\n"));
637
637
  if (cmd == true) {
638
- runCommand("shadcn@latest init --base-color zinc --yes");
638
+ runCommand("shadcn@latest init");
639
639
  runCommand("shadcn@latest add button sonner card field input");
640
640
  } else {
641
641
  runCommand("shadcn@latest add button sonner card field input");
@@ -1117,7 +1117,8 @@ var googleNext = async () => {
1117
1117
  const folder = fs8.existsSync(srcPath) ? "src" : "";
1118
1118
  const authFilePath = path8.join(projectDir, folder, "lib", "auth.ts");
1119
1119
  if (!fs8.existsSync(authFilePath)) {
1120
- console.log(chalk8.red("\u274C auth.ts file not found"));
1120
+ console.log(chalk8.red("No Configured Better Auth file found"));
1121
+ console.log(chalk8.cyan("Run authverse init to initialize better auth"));
1121
1122
  return;
1122
1123
  }
1123
1124
  let content = fs8.readFileSync(authFilePath, "utf8");
@@ -1232,7 +1233,8 @@ var githubNext = async () => {
1232
1233
  const folder = fs9.existsSync(srcPath) ? "src" : "";
1233
1234
  const authFilePath = path9.join(projectDir, folder, "lib", "auth.ts");
1234
1235
  if (!fs9.existsSync(authFilePath)) {
1235
- console.log(chalk9.red("auth.ts file not found"));
1236
+ console.log(chalk9.red("No Configured Better Auth file found"));
1237
+ console.log(chalk9.cyan("Run authverse init to initialize better auth"));
1236
1238
  return;
1237
1239
  }
1238
1240
  let content = fs9.readFileSync(authFilePath, "utf8");
@@ -1346,7 +1348,8 @@ var googleTanstackStart = async () => {
1346
1348
  const srcPath = path10.join(projectDir, "src");
1347
1349
  const authFilePath = path10.join(srcPath, "lib", "auth.ts");
1348
1350
  if (!fs10.existsSync(authFilePath)) {
1349
- console.log(chalk10.red("auth.ts file not found"));
1351
+ console.log(chalk10.red("No Configured Better Auth file found"));
1352
+ console.log(chalk10.cyan("Run authverse init to initialize better auth"));
1350
1353
  return;
1351
1354
  }
1352
1355
  let content = fs10.readFileSync(authFilePath, "utf8");
@@ -1452,7 +1455,8 @@ var githubTanstackStart = async () => {
1452
1455
  const srcPath = path11.join(projectDir, "src");
1453
1456
  const authFilePath = path11.join(srcPath, "lib", "auth.ts");
1454
1457
  if (!fs11.existsSync(authFilePath)) {
1455
- console.log(chalk11.red("auth.ts file not found"));
1458
+ console.log(chalk11.red("No Configured Better Auth file found"));
1459
+ console.log(chalk11.cyan("Run authverse init to initialize better auth"));
1456
1460
  return;
1457
1461
  }
1458
1462
  let content = fs11.readFileSync(authFilePath, "utf8");
@@ -1559,7 +1563,8 @@ var facebookNext = async () => {
1559
1563
  const folder = fs12.existsSync(srcPath) ? "src" : "";
1560
1564
  const authFilePath = path12.join(projectDir, folder, "lib", "auth.ts");
1561
1565
  if (!fs12.existsSync(authFilePath)) {
1562
- console.log(chalk12.red("auth.ts file not found"));
1566
+ console.log(chalk12.red("No Configured Better Auth file found"));
1567
+ console.log(chalk12.cyan("Run authverse init to initialize better auth"));
1563
1568
  return;
1564
1569
  }
1565
1570
  let content = fs12.readFileSync(authFilePath, "utf8");
@@ -1673,7 +1678,8 @@ var facebookTanstackStart = async () => {
1673
1678
  const srcPath = path13.join(projectDir, "src");
1674
1679
  const authFilePath = path13.join(srcPath, "lib", "auth.ts");
1675
1680
  if (!fs13.existsSync(authFilePath)) {
1676
- console.log(chalk13.red("auth.ts file not found"));
1681
+ console.log(chalk13.red("No Configured Better Auth file found"));
1682
+ console.log(chalk13.cyan("Run authverse init to initialize better auth"));
1677
1683
  return;
1678
1684
  }
1679
1685
  let content = fs13.readFileSync(authFilePath, "utf8");
@@ -1780,7 +1786,8 @@ var LinkedInNext = async () => {
1780
1786
  const folder = fs14.existsSync(srcPath) ? "src" : "";
1781
1787
  const authFilePath = path14.join(projectDir, folder, "lib", "auth.ts");
1782
1788
  if (!fs14.existsSync(authFilePath)) {
1783
- console.log(chalk14.red("auth.ts file not found"));
1789
+ console.log(chalk14.red("No Configured Better Auth file found"));
1790
+ console.log(chalk14.cyan("Run authverse init to initialize better auth"));
1784
1791
  return;
1785
1792
  }
1786
1793
  let content = fs14.readFileSync(authFilePath, "utf8");
@@ -1894,7 +1901,8 @@ var LinkedInTanstackStart = async () => {
1894
1901
  const srcPath = path15.join(projectDir, "src");
1895
1902
  const authFilePath = path15.join(srcPath, "lib", "auth.ts");
1896
1903
  if (!fs15.existsSync(authFilePath)) {
1897
- console.log(chalk15.red("auth.ts file not found"));
1904
+ console.log(chalk15.red("No Configured Better Auth file found"));
1905
+ console.log(chalk15.cyan("Run authverse init to initialize better auth"));
1898
1906
  return;
1899
1907
  }
1900
1908
  let content = fs15.readFileSync(authFilePath, "utf8");
@@ -2001,7 +2009,8 @@ var twitterNext = async () => {
2001
2009
  const folder = fs16.existsSync(srcPath) ? "src" : "";
2002
2010
  const authFilePath = path16.join(projectDir, folder, "lib", "auth.ts");
2003
2011
  if (!fs16.existsSync(authFilePath)) {
2004
- console.log(chalk16.red("auth.ts file not found"));
2012
+ console.log(chalk16.red("No Configured Better Auth file found"));
2013
+ console.log(chalk16.cyan("Run authverse init to initialize better auth"));
2005
2014
  return;
2006
2015
  }
2007
2016
  let content = fs16.readFileSync(authFilePath, "utf8");
@@ -2115,7 +2124,8 @@ var twitterTanstackStart = async () => {
2115
2124
  const srcPath = path17.join(projectDir, "src");
2116
2125
  const authFilePath = path17.join(srcPath, "lib", "auth.ts");
2117
2126
  if (!fs17.existsSync(authFilePath)) {
2118
- console.log(chalk17.red("auth.ts file not found"));
2127
+ console.log(chalk17.red("No Configured Better Auth file found"));
2128
+ console.log(chalk17.cyan("Run authverse init to initialize better auth"));
2119
2129
  return;
2120
2130
  }
2121
2131
  let content = fs17.readFileSync(authFilePath, "utf8");
@@ -2222,12 +2232,14 @@ var AppleNext = async () => {
2222
2232
  const folder = fs18.existsSync(srcPath) ? "src" : "";
2223
2233
  const authFilePath = path18.join(projectDir, folder, "lib", "auth.ts");
2224
2234
  if (!fs18.existsSync(authFilePath)) {
2225
- console.log(chalk18.red("auth.ts file not found"));
2235
+ console.log(chalk18.red("No Configured Better Auth file found"));
2236
+ console.log(chalk18.cyan("Run authverse init to initialize better auth"));
2226
2237
  return;
2227
2238
  }
2228
2239
  let content = fs18.readFileSync(authFilePath, "utf8");
2229
2240
  if (!content.includes("betterAuth({")) {
2230
2241
  console.log(chalk18.red("betterAuth({}) block not found"));
2242
+ console.log(chalk18.cyan("Run authverse init to initialize better auth"));
2231
2243
  return;
2232
2244
  }
2233
2245
  if (content.includes("socialProviders") && content.includes("apple:")) {
@@ -2353,7 +2365,8 @@ var AppleTanstackStart = async () => {
2353
2365
  const srcPath = path19.join(projectDir, "src");
2354
2366
  const authFilePath = path19.join(srcPath, "lib", "auth.ts");
2355
2367
  if (!fs19.existsSync(authFilePath)) {
2356
- console.log(chalk19.red("auth.ts file not found"));
2368
+ console.log(chalk19.red("No Configured Better Auth file found"));
2369
+ console.log(chalk19.cyan("Run authverse init to initialize better auth"));
2357
2370
  return;
2358
2371
  }
2359
2372
  let content = fs19.readFileSync(authFilePath, "utf8");
@@ -2541,6 +2554,10 @@ var gmailRun = async () => {
2541
2554
  console.log(chalk21.cyan("\n\u2699\uFE0F Installing @react-email/components...\n"));
2542
2555
  packageManager("@react-email/components");
2543
2556
  }
2557
+ if (!packageJson2.dependencies?.["@react-email/render"]) {
2558
+ console.log(chalk21.cyan("\n\u2699\uFE0F Installing @react-email/render...\n"));
2559
+ packageManager("@react-email/render");
2560
+ }
2544
2561
  const envPath = path20.join(projectDir, ".env");
2545
2562
  const envContent = fs20.readFileSync(envPath, "utf8");
2546
2563
  if (!envContent.includes("GMAIL_HOST") && !envContent.includes("GMAIL_PORT") && !envContent.includes("GMAIL_SERVICE") && !envContent.includes("GMAIL_MAIL") && !envContent.includes("GMAIL_NAME") && !envContent.includes("GMAIL_PASSWORD")) {
@@ -2572,8 +2589,13 @@ GMAIL_PASSWORD=`);
2572
2589
  fs20.copyFileSync(templatePath, libDestinationPath);
2573
2590
  console.log(chalk21.green("\nCompleted installation successfully"));
2574
2591
  console.log(chalk21.cyan("\nInstall Package:"));
2575
- console.log(chalk21.white(`\u2022 nodemailer
2576
- \u2022 @react-email/components`));
2592
+ console.log(
2593
+ chalk21.white(
2594
+ `\u2022 nodemailer
2595
+ \u2022 @react-email/components
2596
+ \u2022 @react-email/render`
2597
+ )
2598
+ );
2577
2599
  console.log(chalk21.cyan("\nFiles created:"));
2578
2600
  console.log(
2579
2601
  chalk21.white(
@@ -2607,6 +2629,10 @@ var gmailRunTanstackStart = async () => {
2607
2629
  console.log(chalk22.cyan("\n\u2699\uFE0F Installing @react-email/components...\n"));
2608
2630
  packageManager("@react-email/components");
2609
2631
  }
2632
+ if (!packageJson2.dependencies?.["@react-email/render"]) {
2633
+ console.log(chalk22.cyan("\n\u2699\uFE0F Installing @react-email/render...\n"));
2634
+ packageManager("@react-email/render");
2635
+ }
2610
2636
  const envPath = path21.join(projectDir, ".env");
2611
2637
  const envContent = fs21.readFileSync(envPath, "utf8");
2612
2638
  if (!envContent.includes("GMAIL_HOST") && !envContent.includes("GMAIL_PORT") && !envContent.includes("GMAIL_SERVICE") && !envContent.includes("GMAIL_MAIL") && !envContent.includes("GMAIL_NAME") && !envContent.includes("GMAIL_PASSWORD")) {
@@ -2638,8 +2664,13 @@ GMAIL_PASSWORD=`);
2638
2664
  fs21.copyFileSync(templatePath, libDestinationPath);
2639
2665
  console.log(chalk22.green("\nCompleted installation successfully"));
2640
2666
  console.log(chalk22.cyan("\nInstall Package:"));
2641
- console.log(chalk22.white(`\u2022 nodemailer
2642
- \u2022 @react-email/components`));
2667
+ console.log(
2668
+ chalk22.white(
2669
+ `\u2022 nodemailer
2670
+ \u2022 @react-email/components
2671
+ \u2022 @react-email/render`
2672
+ )
2673
+ );
2643
2674
  console.log(chalk22.cyan("\nFiles created:"));
2644
2675
  console.log(chalk22.white("\u2022 src/lib/email.ts\n"));
2645
2676
  } catch (error) {
@@ -2669,6 +2700,10 @@ var awsSesRun = async () => {
2669
2700
  console.log(chalk23.cyan("\n\u2699\uFE0F Installing @react-email/components...\n"));
2670
2701
  packageManager("@react-email/components");
2671
2702
  }
2703
+ if (!packageJson2.dependencies?.["@react-email/render"]) {
2704
+ console.log(chalk23.cyan("\n\u2699\uFE0F Installing @react-email/render...\n"));
2705
+ packageManager("@react-email/render");
2706
+ }
2672
2707
  const envPath = path22.join(projectDir, ".env");
2673
2708
  const envContent = fs22.readFileSync(envPath, "utf8");
2674
2709
  if (!envContent.includes("AWS_SES_HOST") && !envContent.includes("AWS_SES_PORT") && !envContent.includes("AWS_SES_SERVICE") && !envContent.includes("AWS_SES_USER") && !envContent.includes("AWS_SES_PASS") && !envContent.includes("AWS_SES_FROM")) {
@@ -2700,8 +2735,13 @@ AWS_SES_FROM=`);
2700
2735
  fs22.copyFileSync(templatePath, libDestinationPath);
2701
2736
  console.log(chalk23.green("\nCompleted installation successfully"));
2702
2737
  console.log(chalk23.cyan("\nInstall Package:"));
2703
- console.log(chalk23.white(`\u2022 nodemailer
2704
- \u2022 @react-email/components`));
2738
+ console.log(
2739
+ chalk23.white(
2740
+ `\u2022 nodemailer
2741
+ \u2022 @react-email/components
2742
+ \u2022 @react-email/render`
2743
+ )
2744
+ );
2705
2745
  console.log(chalk23.cyan("\nFiles created:"));
2706
2746
  console.log(
2707
2747
  chalk23.white(
@@ -2735,6 +2775,10 @@ var awsSesRunTanstackStart = async () => {
2735
2775
  console.log(chalk24.cyan("\n\u2699\uFE0F Installing @react-email/components...\n"));
2736
2776
  packageManager("@react-email/components");
2737
2777
  }
2778
+ if (!packageJson2.dependencies?.["@react-email/render"]) {
2779
+ console.log(chalk24.cyan("\n\u2699\uFE0F Installing @react-email/render...\n"));
2780
+ packageManager("@react-email/render");
2781
+ }
2738
2782
  const envPath = path23.join(projectDir, ".env");
2739
2783
  const envContent = fs23.readFileSync(envPath, "utf8");
2740
2784
  if (!envContent.includes("AWS_SES_HOST") && !envContent.includes("AWS_SES_PORT") && !envContent.includes("AWS_SES_SERVICE") && !envContent.includes("AWS_SES_USER") && !envContent.includes("AWS_SES_PASS") && !envContent.includes("AWS_SES_FROM")) {
@@ -2766,8 +2810,13 @@ AWS_SES_FROM=`);
2766
2810
  fs23.copyFileSync(templatePath, libDestinationPath);
2767
2811
  console.log(chalk24.green("\nCompleted installation successfully"));
2768
2812
  console.log(chalk24.cyan("\nInstall Package:"));
2769
- console.log(chalk24.white(`\u2022 nodemailer
2770
- \u2022 @react-email/components`));
2813
+ console.log(
2814
+ chalk24.white(
2815
+ `\u2022 nodemailer
2816
+ \u2022 @react-email/components
2817
+ \u2022 @react-email/render`
2818
+ )
2819
+ );
2771
2820
  console.log(chalk24.cyan("\nFiles created:"));
2772
2821
  console.log(chalk24.white("\u2022 src/lib/email.ts\n"));
2773
2822
  } catch (error) {
@@ -2796,6 +2845,10 @@ var resendRun = async () => {
2796
2845
  console.log(chalk25.cyan("\n\u2699\uFE0F Installing @react-email/components...\n"));
2797
2846
  packageManager("@react-email/components");
2798
2847
  }
2848
+ if (!packageJson2.dependencies?.["@react-email/render"]) {
2849
+ console.log(chalk25.cyan("\n\u2699\uFE0F Installing @react-email/render...\n"));
2850
+ packageManager("@react-email/render");
2851
+ }
2799
2852
  const envPath = path24.join(projectDir, ".env");
2800
2853
  const envContent = fs24.readFileSync(envPath, "utf8");
2801
2854
  if (!envContent.includes("RESEND_API_KEY") && !envContent.includes("EMAIL_SENDER_NAME") && !envContent.includes("EMAIL_SENDER_ADDRESS")) {
@@ -2821,8 +2874,11 @@ EMAIL_SENDER_ADDRESS=`);
2821
2874
  fs24.copyFileSync(templatePath, libDestinationPath);
2822
2875
  console.log(chalk25.green("\nCompleted installation successfully"));
2823
2876
  console.log(chalk25.cyan("\nInstall Package:"));
2824
- console.log(chalk25.white(`\u2022 resend
2825
- \u2022 @react-email/components`));
2877
+ console.log(
2878
+ chalk25.white(`\u2022 resend
2879
+ \u2022 @react-email/components
2880
+ \u2022 @react-email/render`)
2881
+ );
2826
2882
  console.log(chalk25.cyan("\nFiles created:"));
2827
2883
  console.log(
2828
2884
  chalk25.white(
@@ -2880,8 +2936,11 @@ EMAIL_SENDER_ADDRESS=`);
2880
2936
  fs25.copyFileSync(templatePath, libDestinationPath);
2881
2937
  console.log(chalk26.green("\nCompleted installation successfully"));
2882
2938
  console.log(chalk26.cyan("\nInstall Package:"));
2883
- console.log(chalk26.white(`\u2022 resend
2884
- \u2022 @react-email/components`));
2939
+ console.log(
2940
+ chalk26.white(`\u2022 resend
2941
+ \u2022 @react-email/components
2942
+ \u2022 @react-email/render`)
2943
+ );
2885
2944
  console.log(chalk26.cyan("\nFiles created:"));
2886
2945
  console.log(chalk26.white("\u2022 src/lib/email.ts\n"));
2887
2946
  } catch (error) {
@@ -2981,7 +3040,7 @@ var forgetNext = async () => {
2981
3040
  return;
2982
3041
  }
2983
3042
  let content = fs27.readFileSync(authFilePath, "utf8");
2984
- const codeAdded = ` sendResetPassword: async ({ user, url, token }) => {
3043
+ const codeAdded = `sendResetPassword: async ({ user, url, token }) => {
2985
3044
  await sendEmail({
2986
3045
  email: user.email!,
2987
3046
  subject: "Reset your password",
@@ -3013,25 +3072,28 @@ var forgetNext = async () => {
3013
3072
  emailAndPasswordStart,
3014
3073
  emailAndPasswordEnd
3015
3074
  );
3016
- if (emailAndPasswordContent.includes("sendResetPassword:")) {
3017
- content = content.replace(
3018
- /sendResetPassword:\s*async\s*\([^)]*\)[^{]*\{[^}]*\}[^,]*/,
3019
- codeAdded
3020
- );
3021
- } else {
3075
+ if (!emailAndPasswordContent.includes("sendResetPassword:")) {
3022
3076
  const before = content.substring(0, emailAndPasswordEnd);
3023
3077
  const after = content.substring(emailAndPasswordEnd);
3024
- content = before + `
3025
- ${codeAdded}` + after;
3078
+ content = before + `${codeAdded}` + after;
3026
3079
  }
3027
3080
  fs27.writeFileSync(authFilePath, content, "utf8");
3028
3081
  if (!content.includes("import { sendEmail }")) {
3082
+ const lastImportIndex = content.lastIndexOf("import");
3083
+ const nextLineAfterLastImport = content.indexOf("\n", lastImportIndex) + 1;
3084
+ const beforeImports = content.substring(0, nextLineAfterLastImport);
3085
+ const afterImports = content.substring(nextLineAfterLastImport);
3086
+ const newImports = `import { sendEmail } from "./email";
3087
+ `;
3088
+ content = beforeImports + newImports + afterImports;
3089
+ fs27.writeFileSync(authFilePath, content, "utf8");
3090
+ }
3091
+ if (!content.includes("import ForgotPasswordEmail from")) {
3029
3092
  const lastImportIndex = content.lastIndexOf("import");
3030
3093
  const nextLineAfterLastImport = content.indexOf("\n", lastImportIndex) + 1;
3031
3094
  const beforeImports = content.substring(0, nextLineAfterLastImport);
3032
3095
  const afterImports = content.substring(nextLineAfterLastImport);
3033
3096
  const newImports = `import ForgotPasswordEmail from "@/components/email/reset-password";
3034
- import { sendEmail } from "./email";
3035
3097
  `;
3036
3098
  content = beforeImports + newImports + afterImports;
3037
3099
  fs27.writeFileSync(authFilePath, content, "utf8");
@@ -3196,25 +3258,28 @@ var forgetTanstack = async () => {
3196
3258
  emailAndPasswordStart,
3197
3259
  emailAndPasswordEnd
3198
3260
  );
3199
- if (emailAndPasswordContent.includes("sendResetPassword:")) {
3200
- content = content.replace(
3201
- /sendResetPassword:\s*async\s*\([^)]*\)[^{]*\{[^}]*\}[^,]*/,
3202
- codeAdded
3203
- );
3204
- } else {
3261
+ if (!emailAndPasswordContent.includes("sendResetPassword:")) {
3205
3262
  const before = content.substring(0, emailAndPasswordEnd);
3206
3263
  const after = content.substring(emailAndPasswordEnd);
3207
- content = before + `
3208
- ${codeAdded}` + after;
3264
+ content = before + `${codeAdded}` + after;
3209
3265
  }
3210
3266
  fs28.writeFileSync(authFilePath, content, "utf8");
3211
3267
  if (!content.includes("import { sendEmail }")) {
3268
+ const lastImportIndex = content.lastIndexOf("import");
3269
+ const nextLineAfterLastImport = content.indexOf("\n", lastImportIndex) + 1;
3270
+ const beforeImports = content.substring(0, nextLineAfterLastImport);
3271
+ const afterImports = content.substring(nextLineAfterLastImport);
3272
+ const newImports = `import { sendEmail } from "./email";
3273
+ `;
3274
+ content = beforeImports + newImports + afterImports;
3275
+ fs28.writeFileSync(authFilePath, content, "utf8");
3276
+ }
3277
+ if (!content.includes("import ForgotPasswordEmail from")) {
3212
3278
  const lastImportIndex = content.lastIndexOf("import");
3213
3279
  const nextLineAfterLastImport = content.indexOf("\n", lastImportIndex) + 1;
3214
3280
  const beforeImports = content.substring(0, nextLineAfterLastImport);
3215
3281
  const afterImports = content.substring(nextLineAfterLastImport);
3216
3282
  const newImports = `import ForgotPasswordEmail from "@/components/email/reset-password";
3217
- import { sendEmail } from "./email";
3218
3283
  `;
3219
3284
  content = beforeImports + newImports + afterImports;
3220
3285
  fs28.writeFileSync(authFilePath, content, "utf8");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "authverse",
3
- "version": "1.1.8-beta.1",
3
+ "version": "1.1.8",
4
4
  "description": "Authverse Fast modern CLI to generate full auth systems with OAuth Prisma Drizzle better auth and ready-to-use ShadCN UI screens",
5
5
  "repository": {
6
6
  "url": "git+https://github.com/abdirahmanmahamoud/authverse.git",
@@ -21,7 +21,8 @@
21
21
  "scripts": {
22
22
  "build": "tsup ./index.ts --format esm,cjs --dts --out-dir dist && cp -r ../template ./dist/template",
23
23
  "build:win": "tsup ./index.ts --format esm,cjs --dts --out-dir dist && xcopy ..\\template dist\\template /E /I /Y && npm link",
24
- "clear": "pnpm dlx rimraf dist"
24
+ "clear": "pnpm dlx rimraf dist",
25
+ "test": "vitest --run --typecheck"
25
26
  },
26
27
  "publishConfig": {
27
28
  "access": "public"
@@ -46,14 +47,15 @@
46
47
  "dependencies": {
47
48
  "chalk": "^5.6.2",
48
49
  "commander": "^14.0.2",
49
- "inquirer": "^12.10.0"
50
+ "inquirer": "^13.3.2"
50
51
  },
51
52
  "devDependencies": {
52
- "@commitlint/cli": "^20.3.1",
53
+ "@commitlint/cli": "^20.5.0",
53
54
  "@commitlint/config-conventional": "^20.4.2",
54
- "@types/node": "^25.2.3",
55
+ "@types/node": "^25.5.0",
55
56
  "changelogithub": "^14.0.0",
56
57
  "tsup": "^8.5.0",
57
- "typescript": "^5.9.3"
58
+ "typescript": "^5.9.3",
59
+ "vitest": "^4.0.18"
58
60
  }
59
61
  }