authverse 1.1.9 → 1.1.10

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.
package/dist/index.cjs CHANGED
@@ -26,7 +26,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
26
  var import_commander = require("commander");
27
27
 
28
28
  // cli/init.ts
29
- var import_inquirer3 = __toESM(require("inquirer"), 1);
29
+ var import_inquirer4 = __toESM(require("inquirer"), 1);
30
30
 
31
31
  // script/prisma.ts
32
32
  var import_url2 = require("url");
@@ -447,25 +447,41 @@ ${CreateFolder({ srcFolder, destFolder: "proxy.ts" })}
447
447
  };
448
448
 
449
449
  // script/drizzleRun.ts
450
+ var import_chalk5 = __toESM(require("chalk"), 1);
451
+ var import_path5 = __toESM(require("path"), 1);
452
+ var import_fs5 = __toESM(require("fs"), 1);
453
+
454
+ // drizzle/drizzleNextSetup.ts
450
455
  var import_chalk3 = __toESM(require("chalk"), 1);
451
456
  var import_path3 = __toESM(require("path"), 1);
452
- var import_url3 = require("url");
453
457
  var import_fs3 = __toESM(require("fs"), 1);
458
+ var import_url3 = require("url");
454
459
  var import_inquirer2 = __toESM(require("inquirer"), 1);
455
460
  var import_meta3 = {};
456
- var drizzleRun = async ({ authUi, cmd }) => {
461
+ var drizzleNextSetup = async ({
462
+ authUi,
463
+ cmd,
464
+ projectDir
465
+ }) => {
457
466
  try {
458
- const projectDir = process.cwd();
459
467
  const packageJsonPath = import_path3.default.join(projectDir, "package.json");
460
468
  const packageJson2 = JSON.parse(import_fs3.default.readFileSync(packageJsonPath, "utf-8"));
461
469
  if (!packageJson2.dependencies["better-auth"]) {
462
470
  console.log(import_chalk3.default.cyan("\n\u2699\uFE0F Initializing better auth...\n"));
463
471
  packageManager("better-auth");
464
472
  }
465
- if (!packageJson2.dependencies["drizzle-orm"] && !packageJson2.dependencies["drizzle-orm"] && !packageJson2.dependencies["drizzle-kit"] && !packageJson2.devDependencies["drizzle-kit"]) {
473
+ const drizzleDeps = [
474
+ "drizzle-orm",
475
+ "@neondatabase/serverless",
476
+ "dotenv",
477
+ "drizzle-kit"
478
+ ];
479
+ const missingDrizzleDeps = drizzleDeps.filter((dep) => {
480
+ return !packageJson2.dependencies?.[dep] && !packageJson2.devDependencies?.[dep];
481
+ });
482
+ if (missingDrizzleDeps.length > 0) {
466
483
  console.log(import_chalk3.default.cyan("\n\u2699\uFE0F Initializing drizzle...\n"));
467
- packageManager("drizzle-orm @neondatabase/serverless dotenv");
468
- packageManager("drizzle-kit", true);
484
+ packageManager(missingDrizzleDeps.join(" "));
469
485
  }
470
486
  const __filename = (0, import_url3.fileURLToPath)(import_meta3.url);
471
487
  const __dirname = import_path3.default.dirname(__filename);
@@ -623,23 +639,318 @@ ${CreateFolder({ srcFolder, destFolder: "proxy.ts" })}
623
639
  )
624
640
  );
625
641
  }
642
+ } catch (error) {
643
+ console.error(import_chalk3.default.red("Drizzle setup failed:"), error);
644
+ }
645
+ };
646
+
647
+ // drizzle/drizzleNextChecker.ts
648
+ var import_path4 = __toESM(require("path"), 1);
649
+ var import_chalk4 = __toESM(require("chalk"), 1);
650
+ var import_fs4 = __toESM(require("fs"), 1);
651
+ var import_url4 = require("url");
652
+ var import_inquirer3 = __toESM(require("inquirer"), 1);
653
+
654
+ // drizzle/drizzle-utils.ts
655
+ var extractColumnNames = (tableDef) => {
656
+ const columns = [];
657
+ const lines = tableDef.split("\n");
658
+ for (const line of lines) {
659
+ const columnMatch = line.match(/^\s*(\w+):/);
660
+ if (columnMatch && !line.includes("//") && !line.includes("export const")) {
661
+ columns.push(columnMatch[1]);
662
+ }
663
+ }
664
+ return columns;
665
+ };
666
+ var extractTableDefinition = (content, tableName) => {
667
+ const tableRegex = new RegExp(
668
+ `export const ${tableName} = pgTable\\(["']${tableName}["'][\\s\\S]*?\\n\\}\\);`,
669
+ "m"
670
+ );
671
+ const match = content.match(tableRegex);
672
+ return match ? match[0] : null;
673
+ };
674
+ var addMissingColumnsToTable = (existingTableDef, templateTableDef) => {
675
+ const existingColumns = extractColumnNames(existingTableDef);
676
+ const templateColumns = extractColumnNames(templateTableDef);
677
+ const missingColumns = templateColumns.filter(
678
+ (col) => !existingColumns.includes(col)
679
+ );
680
+ if (missingColumns.length === 0) {
681
+ return existingTableDef;
682
+ }
683
+ const lines = templateTableDef.split("\n");
684
+ const columnDefinitions = [];
685
+ for (const line of lines) {
686
+ for (const col of missingColumns) {
687
+ if (line.trim().startsWith(`${col}:`)) {
688
+ columnDefinitions.push(line);
689
+ break;
690
+ }
691
+ }
692
+ }
693
+ const existingLines = existingTableDef.split("\n");
694
+ const insertPosition = existingLines.length - 1;
695
+ for (const colDef of columnDefinitions) {
696
+ existingLines.splice(insertPosition, 0, ` ${colDef.trim()}`);
697
+ }
698
+ return existingLines.join("\n");
699
+ };
700
+
701
+ // drizzle/drizzleNextChecker.ts
702
+ var import_meta4 = {};
703
+ var drizzleNextChecker = async ({
704
+ authUi,
705
+ cmd,
706
+ projectDir
707
+ }) => {
708
+ try {
709
+ const drizzleConfigPath = import_path4.default.join(projectDir, "drizzle.config.ts");
710
+ if (!import_fs4.default.existsSync(drizzleConfigPath)) {
711
+ return await drizzleNextSetup({ authUi, cmd, projectDir });
712
+ }
713
+ const drizzleConfigContent = import_fs4.default.readFileSync(drizzleConfigPath, "utf-8");
714
+ const schemaMatch = drizzleConfigContent.match(/schema:\s*["'`](.*?)["'`]/);
715
+ const schemaPath = schemaMatch ? schemaMatch[1] : null;
716
+ if (!schemaPath || schemaPath === "") {
717
+ return await drizzleNextSetup({ authUi, cmd, projectDir });
718
+ }
719
+ const __filename = (0, import_url4.fileURLToPath)(import_meta4.url);
720
+ const __dirname = import_path4.default.dirname(__filename);
721
+ const dbTemplatePath = import_path4.default.resolve(__dirname, "./template/db/schema.ts");
722
+ const schemaFilePath = import_path4.default.join(projectDir, schemaPath);
723
+ if (!import_fs4.default.existsSync(schemaFilePath)) {
724
+ const dbFolder = import_path4.default.dirname(schemaFilePath);
725
+ if (!import_fs4.default.existsSync(dbFolder)) {
726
+ import_fs4.default.mkdirSync(dbFolder, { recursive: true });
727
+ }
728
+ import_fs4.default.copyFileSync(dbTemplatePath, schemaFilePath);
729
+ } else {
730
+ let schemaFileContent = import_fs4.default.readFileSync(schemaFilePath, "utf-8");
731
+ const dbTemplateContent = import_fs4.default.readFileSync(dbTemplatePath, "utf-8");
732
+ const requiredTables = ["user", "session", "account", "verification"];
733
+ let needsUpdate = false;
734
+ let updatedSchemaContent = schemaFileContent;
735
+ for (const table of requiredTables) {
736
+ const existingTable = extractTableDefinition(
737
+ updatedSchemaContent,
738
+ table
739
+ );
740
+ const templateTable = extractTableDefinition(dbTemplateContent, table);
741
+ if (!existingTable && templateTable) {
742
+ const schemaExportIndex = updatedSchemaContent.indexOf(
743
+ "export const schema ="
744
+ );
745
+ if (schemaExportIndex !== -1) {
746
+ updatedSchemaContent = updatedSchemaContent.slice(0, schemaExportIndex) + templateTable + "\n\n" + updatedSchemaContent.slice(schemaExportIndex);
747
+ } else {
748
+ updatedSchemaContent += "\n\n" + templateTable;
749
+ }
750
+ needsUpdate = true;
751
+ } else if (existingTable && templateTable) {
752
+ const existingColumns = extractColumnNames(existingTable);
753
+ const templateColumns = extractColumnNames(templateTable);
754
+ const missingColumns = templateColumns.filter(
755
+ (col) => !existingColumns.includes(col)
756
+ );
757
+ if (missingColumns.length > 0) {
758
+ const updatedTable = addMissingColumnsToTable(
759
+ existingTable,
760
+ templateTable
761
+ );
762
+ updatedSchemaContent = updatedSchemaContent.replace(
763
+ existingTable,
764
+ updatedTable
765
+ );
766
+ needsUpdate = true;
767
+ }
768
+ }
769
+ }
770
+ if (needsUpdate) {
771
+ const schemaExportRegex = /export const schema = \{([\s\S]*?)\};/;
772
+ const schemaMatch2 = updatedSchemaContent.match(schemaExportRegex);
773
+ if (schemaMatch2) {
774
+ let currentSchemaContent = schemaMatch2[1];
775
+ for (const table of requiredTables) {
776
+ if (!currentSchemaContent.includes(`${table},`)) {
777
+ const lines = currentSchemaContent.split("\n");
778
+ const lastNonEmptyLine = lines.length - 1;
779
+ if (lines[lastNonEmptyLine].trim() === "}") {
780
+ lines[lastNonEmptyLine] = ` ${table},
781
+ ${lines[lastNonEmptyLine]}`;
782
+ } else {
783
+ lines.push(` ${table},`);
784
+ }
785
+ currentSchemaContent = lines.join("\n");
786
+ }
787
+ }
788
+ updatedSchemaContent = updatedSchemaContent.replace(
789
+ schemaExportRegex,
790
+ `export const schema = {${currentSchemaContent}};`
791
+ );
792
+ }
793
+ import_fs4.default.writeFileSync(schemaFilePath, updatedSchemaContent);
794
+ }
795
+ }
796
+ const packageJsonPath = import_path4.default.join(projectDir, "package.json");
797
+ const packageJson2 = JSON.parse(import_fs4.default.readFileSync(packageJsonPath, "utf-8"));
798
+ if (!packageJson2.dependencies["better-auth"]) {
799
+ console.log(import_chalk4.default.cyan("\n\u2699\uFE0F Initializing better auth...\n"));
800
+ packageManager("better-auth");
801
+ }
802
+ const drizzleDeps = [
803
+ "drizzle-orm",
804
+ "@neondatabase/serverless",
805
+ "dotenv",
806
+ "drizzle-kit"
807
+ ];
808
+ const missingDrizzleDeps = drizzleDeps.filter((dep) => {
809
+ return !packageJson2.dependencies?.[dep] && !packageJson2.devDependencies?.[dep];
810
+ });
811
+ if (missingDrizzleDeps.length > 0) {
812
+ console.log(import_chalk4.default.cyan("\n\u2699\uFE0F Initializing drizzle...\n"));
813
+ packageManager(missingDrizzleDeps.join(" "));
814
+ }
815
+ const envPath = import_path4.default.join(projectDir, ".env");
816
+ if (!import_fs4.default.existsSync(envPath)) {
817
+ import_fs4.default.writeFileSync(envPath, "DATABASE_URL=\n");
818
+ }
819
+ const secret = await GenerateSecret();
820
+ const envContent = import_fs4.default.readFileSync(envPath, "utf-8");
821
+ if (!envContent.includes("BETTER_AUTH_SECRET")) {
822
+ import_fs4.default.appendFileSync(envPath, `
823
+
824
+ BETTER_AUTH_SECRET=${secret}`);
825
+ }
826
+ if (!envContent.includes("BETTER_AUTH_URL")) {
827
+ import_fs4.default.appendFileSync(envPath, `
828
+ BETTER_AUTH_URL=http://localhost:3000
829
+ `);
830
+ }
831
+ const srcFolder = import_fs4.default.existsSync(import_path4.default.join(projectDir, "src")) ? "src" : "";
832
+ const libPath = import_path4.default.join(projectDir, srcFolder, "lib");
833
+ if (!import_fs4.default.existsSync(libPath)) {
834
+ import_fs4.default.mkdirSync(libPath, { recursive: true });
835
+ }
836
+ const authPath = import_path4.default.join(libPath, "auth.ts");
837
+ const authClientPath = import_path4.default.join(libPath, "auth-client.ts");
838
+ if (import_fs4.default.existsSync(authPath) || import_fs4.default.existsSync(authClientPath)) {
839
+ const answers = await import_inquirer3.default.prompt([
840
+ {
841
+ type: "confirm",
842
+ name: "overwrite",
843
+ message: "Do you want to overwrite existing auth lib/auth.ts or lib/auth-client.ts",
844
+ default: false
845
+ }
846
+ ]);
847
+ if (answers.overwrite) {
848
+ const authTemplatePath = import_path4.default.resolve(
849
+ __dirname,
850
+ "./template/lib/auth-drizzle.ts"
851
+ );
852
+ const authDestinationPath = import_path4.default.join(libPath, "auth.ts");
853
+ import_fs4.default.copyFileSync(authTemplatePath, authDestinationPath);
854
+ const authClientTemplatePath = import_path4.default.resolve(
855
+ __dirname,
856
+ "./template/lib/auth-client.ts"
857
+ );
858
+ const authClientDestinationPath = import_path4.default.join(libPath, "auth-client.ts");
859
+ import_fs4.default.copyFileSync(authClientTemplatePath, authClientDestinationPath);
860
+ }
861
+ } else {
862
+ const authTemplatePath = import_path4.default.resolve(
863
+ __dirname,
864
+ "./template/lib/auth-drizzle.ts"
865
+ );
866
+ const authDestinationPath = import_path4.default.join(libPath, "auth.ts");
867
+ import_fs4.default.copyFileSync(authTemplatePath, authDestinationPath);
868
+ const authClientTemplatePath = import_path4.default.resolve(
869
+ __dirname,
870
+ "./template/lib/auth-client.ts"
871
+ );
872
+ const authClientDestinationPath = import_path4.default.join(libPath, "auth-client.ts");
873
+ import_fs4.default.copyFileSync(authClientTemplatePath, authClientDestinationPath);
874
+ }
875
+ const routeTemplatePath = import_path4.default.resolve(
876
+ __dirname,
877
+ "./template/api/route.ts"
878
+ );
879
+ const routeDestinationDir = import_path4.default.join(
880
+ projectDir,
881
+ srcFolder,
882
+ "app",
883
+ "api",
884
+ "auth",
885
+ "[...all]"
886
+ );
887
+ if (!import_fs4.default.existsSync(routeDestinationDir)) {
888
+ import_fs4.default.mkdirSync(routeDestinationDir, { recursive: true });
889
+ }
890
+ const routeDestinationPath = import_path4.default.join(routeDestinationDir, "route.ts");
891
+ import_fs4.default.copyFileSync(routeTemplatePath, routeDestinationPath);
892
+ const proxyTemplatePath = import_path4.default.resolve(
893
+ __dirname,
894
+ "./template/proxy/proxy.ts"
895
+ );
896
+ const proxyDestinationDir = import_path4.default.join(projectDir, srcFolder);
897
+ const proxyDestinationPath = import_path4.default.join(proxyDestinationDir, "proxy.ts");
898
+ import_fs4.default.copyFileSync(proxyTemplatePath, proxyDestinationPath);
899
+ if (authUi) {
900
+ await authUiRun({
901
+ folder: srcFolder,
902
+ packageJson: projectDir,
903
+ cmd,
904
+ database: "drizzle"
905
+ });
906
+ } else {
907
+ console.log(import_chalk4.default.green("\nCompleted installation successfully"));
908
+ console.log(import_chalk4.default.cyan("\nInstall Package:"));
909
+ console.log(import_chalk4.default.white(`\u2022 drizzle schema
910
+ \u2022 better-auth`));
911
+ console.log(import_chalk4.default.cyan("\nFiles created:"));
912
+ console.log(
913
+ import_chalk4.default.white(
914
+ `${CreateFolder({ srcFolder, destFolder: "lib/auth.ts" })}
915
+ ${CreateFolder({ srcFolder, destFolder: "lib/auth-client.ts" })}
916
+ ${CreateFolder({ srcFolder, destFolder: "app/api/auth/[...all]/route.ts" })}
917
+ ${CreateFolder({ srcFolder, destFolder: "proxy.ts" })}
918
+ `
919
+ )
920
+ );
921
+ }
922
+ } catch (error) {
923
+ console.error(import_chalk4.default.red("Error checking Drizzle setup:"), error);
924
+ }
925
+ };
926
+
927
+ // script/drizzleRun.ts
928
+ var drizzleRun = async ({ authUi, cmd }) => {
929
+ try {
930
+ const projectDir = process.cwd();
931
+ const drizzleConfigPath = import_path5.default.join(projectDir, "drizzle.config.ts");
932
+ if (import_fs5.default.existsSync(drizzleConfigPath)) {
933
+ await drizzleNextChecker({ authUi, cmd, projectDir });
934
+ } else {
935
+ await drizzleNextSetup({ authUi, cmd, projectDir });
936
+ }
626
937
  } catch (err) {
627
- console.error(import_chalk3.default.red("Drizzle setup failed:"), err);
938
+ console.error(import_chalk5.default.red("Drizzle setup failed:"), err);
628
939
  }
629
940
  };
630
941
 
631
942
  // script/prismaRunTanstackStart.ts
632
- var import_chalk5 = __toESM(require("chalk"), 1);
633
- var import_path5 = __toESM(require("path"), 1);
634
- var import_url5 = require("url");
635
- var import_fs5 = __toESM(require("fs"), 1);
943
+ var import_chalk7 = __toESM(require("chalk"), 1);
944
+ var import_path7 = __toESM(require("path"), 1);
945
+ var import_url6 = require("url");
946
+ var import_fs7 = __toESM(require("fs"), 1);
636
947
 
637
948
  // script/authUiTanstackState.ts
638
- var import_chalk4 = __toESM(require("chalk"), 1);
639
- var import_url4 = require("url");
640
- var import_path4 = __toESM(require("path"), 1);
641
- var import_fs4 = __toESM(require("fs"), 1);
642
- var import_meta4 = {};
949
+ var import_chalk6 = __toESM(require("chalk"), 1);
950
+ var import_url5 = require("url");
951
+ var import_path6 = __toESM(require("path"), 1);
952
+ var import_fs6 = __toESM(require("fs"), 1);
953
+ var import_meta5 = {};
643
954
  var shadcnComponents2 = [
644
955
  "button.tsx",
645
956
  "card.tsx",
@@ -656,10 +967,10 @@ var authUiTanstackState = async ({
656
967
  }) => {
657
968
  try {
658
969
  const projectDir = process.cwd();
659
- const shadcnPath = import_path4.default.join(projectDir, "src", "components", "ui");
660
- const shadcnConfigPath = import_path4.default.join(projectDir, "components.json");
661
- if (!import_fs4.default.existsSync(shadcnPath) || !import_fs4.default.existsSync(shadcnConfigPath)) {
662
- console.log(import_chalk4.default.yellow("\n Installing shadcn ui Components\n"));
970
+ const shadcnPath = import_path6.default.join(projectDir, "src", "components", "ui");
971
+ const shadcnConfigPath = import_path6.default.join(projectDir, "components.json");
972
+ if (!import_fs6.default.existsSync(shadcnPath) || !import_fs6.default.existsSync(shadcnConfigPath)) {
973
+ console.log(import_chalk6.default.yellow("\n Installing shadcn ui Components\n"));
663
974
  if (cmd == true) {
664
975
  runCommand("shadcn@latest init");
665
976
  runCommand("shadcn@latest add button sonner card field input");
@@ -667,60 +978,60 @@ var authUiTanstackState = async ({
667
978
  runCommand("shadcn@latest add button sonner card field input");
668
979
  }
669
980
  }
670
- const shadcnFiles = import_fs4.default.readdirSync(shadcnPath);
981
+ const shadcnFiles = import_fs6.default.readdirSync(shadcnPath);
671
982
  const missingComponents = shadcnComponents2.filter(
672
983
  (component) => !shadcnFiles.includes(component)
673
984
  );
674
985
  if (missingComponents.length > 0) {
675
- console.log(import_chalk4.default.yellow("\n Installing shadcn ui Components\n"));
986
+ console.log(import_chalk6.default.yellow("\n Installing shadcn ui Components\n"));
676
987
  const install = missingComponents.map((components) => components.split(".")[0]).join(" ");
677
988
  runCommand(`shadcn@latest add ${install}`);
678
989
  }
679
990
  if (!packageJson2.dependencies?.["@tanstack/react-form"] || !packageJson2.dependencies?.["zod"]) {
680
991
  packageManager("@tanstack/react-form zod");
681
992
  }
682
- const __filename = (0, import_url4.fileURLToPath)(import_meta4.url);
683
- const __dirname = import_path4.default.dirname(__filename);
684
- const srcPath = import_path4.default.join(projectDir, "src");
685
- const componentPath = import_path4.default.resolve(
993
+ const __filename = (0, import_url5.fileURLToPath)(import_meta5.url);
994
+ const __dirname = import_path6.default.dirname(__filename);
995
+ const srcPath = import_path6.default.join(projectDir, "src");
996
+ const componentPath = import_path6.default.resolve(
686
997
  __dirname,
687
998
  "./template/TanstackStart/components"
688
999
  );
689
- const authversePathComponents = import_path4.default.join(
1000
+ const authversePathComponents = import_path6.default.join(
690
1001
  srcPath,
691
1002
  "components",
692
1003
  "authverse"
693
1004
  );
694
- if (!import_fs4.default.existsSync(authversePathComponents)) {
695
- import_fs4.default.mkdirSync(authversePathComponents, { recursive: true });
1005
+ if (!import_fs6.default.existsSync(authversePathComponents)) {
1006
+ import_fs6.default.mkdirSync(authversePathComponents, { recursive: true });
696
1007
  }
697
- import_fs4.default.copyFileSync(
1008
+ import_fs6.default.copyFileSync(
698
1009
  `${componentPath}/LoginComponent.tsx`,
699
- import_path4.default.join(authversePathComponents, "LoginComponent.tsx")
1010
+ import_path6.default.join(authversePathComponents, "LoginComponent.tsx")
700
1011
  );
701
- import_fs4.default.copyFileSync(
1012
+ import_fs6.default.copyFileSync(
702
1013
  `${componentPath}/SingUpComponent.tsx`,
703
- import_path4.default.join(authversePathComponents, "SingUpComponent.tsx")
1014
+ import_path6.default.join(authversePathComponents, "SingUpComponent.tsx")
704
1015
  );
705
- const pageRoutesPath = import_path4.default.join(`${srcPath}/routes`, "auth");
706
- if (!import_fs4.default.existsSync(pageRoutesPath)) {
707
- import_fs4.default.mkdirSync(pageRoutesPath, { recursive: true });
1016
+ const pageRoutesPath = import_path6.default.join(`${srcPath}/routes`, "auth");
1017
+ if (!import_fs6.default.existsSync(pageRoutesPath)) {
1018
+ import_fs6.default.mkdirSync(pageRoutesPath, { recursive: true });
708
1019
  }
709
- const templateRoutesPage = import_path4.default.resolve(
1020
+ const templateRoutesPage = import_path6.default.resolve(
710
1021
  __dirname,
711
1022
  "./template/TanstackStart/routes/auth"
712
1023
  );
713
- import_fs4.default.copyFileSync(
1024
+ import_fs6.default.copyFileSync(
714
1025
  `${templateRoutesPage}/login.tsx`,
715
- import_path4.default.join(pageRoutesPath, "login.tsx")
1026
+ import_path6.default.join(pageRoutesPath, "login.tsx")
716
1027
  );
717
- import_fs4.default.copyFileSync(
1028
+ import_fs6.default.copyFileSync(
718
1029
  `${templateRoutesPage}/signup.tsx`,
719
- import_path4.default.join(pageRoutesPath, "signup.tsx")
1030
+ import_path6.default.join(pageRoutesPath, "signup.tsx")
720
1031
  );
721
- const rootPath = import_path4.default.join(projectDir, "src/routes", "__root.tsx");
722
- if (import_fs4.default.existsSync(rootPath)) {
723
- let rootContent = import_fs4.default.readFileSync(rootPath, "utf-8");
1032
+ const rootPath = import_path6.default.join(projectDir, "src/routes", "__root.tsx");
1033
+ if (import_fs6.default.existsSync(rootPath)) {
1034
+ let rootContent = import_fs6.default.readFileSync(rootPath, "utf-8");
724
1035
  if (!rootContent.includes("Toaster")) {
725
1036
  rootContent = `import { Toaster } from "@/components/ui/sonner";
726
1037
  ${rootContent}`;
@@ -731,15 +1042,15 @@ ${rootContent}`;
731
1042
  " <Toaster />\n </body>"
732
1043
  );
733
1044
  }
734
- import_fs4.default.writeFileSync(rootPath, rootContent, "utf-8");
1045
+ import_fs6.default.writeFileSync(rootPath, rootContent, "utf-8");
735
1046
  }
736
- console.log(import_chalk4.default.green("\nCompleted installation successfully"));
737
- console.log(import_chalk4.default.cyan("\nInstall Package:"));
738
- console.log(import_chalk4.default.white(`\u2022 ${database} schema
1047
+ console.log(import_chalk6.default.green("\nCompleted installation successfully"));
1048
+ console.log(import_chalk6.default.cyan("\nInstall Package:"));
1049
+ console.log(import_chalk6.default.white(`\u2022 ${database} schema
739
1050
  \u2022 better-auth`));
740
- console.log(import_chalk4.default.cyan("\nFiles created:"));
1051
+ console.log(import_chalk6.default.cyan("\nFiles created:"));
741
1052
  console.log(
742
- import_chalk4.default.white(
1053
+ import_chalk6.default.white(
743
1054
  `\u2022 src/lib/auth.ts
744
1055
  \u2022 src/lib/auth-client.ts
745
1056
  \u2022 src/app/api/auth/[...all]/route.ts
@@ -753,12 +1064,12 @@ ${rootContent}`;
753
1064
  )
754
1065
  );
755
1066
  } catch (error) {
756
- console.log(import_chalk4.default.red("Auth Ui Tanstack State Error: ", error));
1067
+ console.log(import_chalk6.default.red("Auth Ui Tanstack State Error: ", error));
757
1068
  }
758
1069
  };
759
1070
 
760
1071
  // script/prismaRunTanstackStart.ts
761
- var import_meta5 = {};
1072
+ var import_meta6 = {};
762
1073
  var prismaRunTanstackStart = async ({
763
1074
  authUi,
764
1075
  database,
@@ -766,12 +1077,12 @@ var prismaRunTanstackStart = async ({
766
1077
  }) => {
767
1078
  try {
768
1079
  const projectDir = process.cwd();
769
- const __filename = (0, import_url5.fileURLToPath)(import_meta5.url);
770
- const __dirname = import_path5.default.dirname(__filename);
771
- const packageJsonPath = import_path5.default.join(projectDir, "package.json");
772
- const packageJson2 = JSON.parse(import_fs5.default.readFileSync(packageJsonPath, "utf-8"));
1080
+ const __filename = (0, import_url6.fileURLToPath)(import_meta6.url);
1081
+ const __dirname = import_path7.default.dirname(__filename);
1082
+ const packageJsonPath = import_path7.default.join(projectDir, "package.json");
1083
+ const packageJson2 = JSON.parse(import_fs7.default.readFileSync(packageJsonPath, "utf-8"));
773
1084
  if (!packageJson2.devDependencies?.prisma || !packageJson2.dependencies?.["@prisma/client"]) {
774
- console.log(import_chalk5.default.cyan("\n\u2699\uFE0F Initializing Prisma...\n"));
1085
+ console.log(import_chalk7.default.cyan("\n\u2699\uFE0F Initializing Prisma...\n"));
775
1086
  if (database !== "Mongodb") {
776
1087
  packageManager("prisma", true);
777
1088
  packageManager("@prisma/client");
@@ -786,98 +1097,98 @@ var prismaRunTanstackStart = async ({
786
1097
  packageManager("@prisma/client@6.19.0");
787
1098
  }
788
1099
  }
789
- const prismaDir = import_path5.default.join(projectDir, "prisma");
790
- if (!import_fs5.default.existsSync(prismaDir)) {
791
- console.log(import_chalk5.default.yellow("\n\u2699\uFE0F Initializing Prisma...\n"));
1100
+ const prismaDir = import_path7.default.join(projectDir, "prisma");
1101
+ if (!import_fs7.default.existsSync(prismaDir)) {
1102
+ console.log(import_chalk7.default.yellow("\n\u2699\uFE0F Initializing Prisma...\n"));
792
1103
  runCommand("prisma init");
793
- const templatePath = import_path5.default.resolve(
1104
+ const templatePath = import_path7.default.resolve(
794
1105
  __dirname,
795
1106
  `./template/prisma/${database}/schema.prisma`
796
1107
  );
797
- if (!import_fs5.default.existsSync(prismaDir)) {
798
- import_fs5.default.mkdirSync(prismaDir, { recursive: true });
1108
+ if (!import_fs7.default.existsSync(prismaDir)) {
1109
+ import_fs7.default.mkdirSync(prismaDir, { recursive: true });
799
1110
  }
800
- const destinationPath = import_path5.default.join(prismaDir, "schema.prisma");
801
- import_fs5.default.copyFileSync(templatePath, destinationPath);
1111
+ const destinationPath = import_path7.default.join(prismaDir, "schema.prisma");
1112
+ import_fs7.default.copyFileSync(templatePath, destinationPath);
802
1113
  if (database === "Mongodb") {
803
- const prismaConfigPath = import_path5.default.resolve(
1114
+ const prismaConfigPath = import_path7.default.resolve(
804
1115
  __dirname,
805
1116
  `./template/config/prisma.config.ts`
806
1117
  );
807
- const prismaConfigDestinationPath = import_path5.default.join("", "prisma.config.ts");
808
- import_fs5.default.copyFileSync(prismaConfigPath, prismaConfigDestinationPath);
1118
+ const prismaConfigDestinationPath = import_path7.default.join("", "prisma.config.ts");
1119
+ import_fs7.default.copyFileSync(prismaConfigPath, prismaConfigDestinationPath);
809
1120
  }
810
1121
  } else {
811
- const schemaPath = import_path5.default.join(prismaDir, "schema.prisma");
812
- const schemaContent = import_fs5.default.readFileSync(schemaPath, "utf-8");
1122
+ const schemaPath = import_path7.default.join(prismaDir, "schema.prisma");
1123
+ const schemaContent = import_fs7.default.readFileSync(schemaPath, "utf-8");
813
1124
  if (!schemaContent.includes("User") || !schemaContent.includes("Session") || !schemaContent.includes("Account") || !schemaContent.includes("Verification")) {
814
- const templatePath = import_path5.default.resolve(
1125
+ const templatePath = import_path7.default.resolve(
815
1126
  __dirname,
816
1127
  `./template/prisma/${database}/schema.prisma_copy`
817
1128
  );
818
- import_fs5.default.appendFileSync(schemaPath, "\n");
819
- import_fs5.default.appendFileSync(schemaPath, import_fs5.default.readFileSync(templatePath));
1129
+ import_fs7.default.appendFileSync(schemaPath, "\n");
1130
+ import_fs7.default.appendFileSync(schemaPath, import_fs7.default.readFileSync(templatePath));
820
1131
  }
821
1132
  }
822
1133
  if (!packageJson2.dependencies?.["better-auth"]) {
823
- console.log(import_chalk5.default.yellow("\n\u2699\uFE0F Initializing better-auth...\n"));
1134
+ console.log(import_chalk7.default.yellow("\n\u2699\uFE0F Initializing better-auth...\n"));
824
1135
  packageManager("better-auth");
825
1136
  }
826
1137
  const secret = await GenerateSecret();
827
- const envPath = import_path5.default.join(projectDir, ".env");
828
- const envContent = import_fs5.default.readFileSync(envPath, "utf-8");
1138
+ const envPath = import_path7.default.join(projectDir, ".env");
1139
+ const envContent = import_fs7.default.readFileSync(envPath, "utf-8");
829
1140
  if (!envContent.includes("BETTER_AUTH_SECRET")) {
830
- import_fs5.default.appendFileSync(envPath, `
1141
+ import_fs7.default.appendFileSync(envPath, `
831
1142
 
832
1143
  BETTER_AUTH_SECRET=${secret}`);
833
1144
  }
834
1145
  if (!envContent.includes("BETTER_AUTH_URL")) {
835
- import_fs5.default.appendFileSync(envPath, `
1146
+ import_fs7.default.appendFileSync(envPath, `
836
1147
  BETTER_AUTH_URL=http://localhost:3000
837
1148
  `);
838
1149
  }
839
- const srcPath = import_path5.default.join(projectDir, "src");
840
- const libPath = import_path5.default.join(srcPath, "lib");
841
- if (!import_fs5.default.existsSync(libPath)) {
842
- import_fs5.default.mkdirSync(libPath, { recursive: true });
1150
+ const srcPath = import_path7.default.join(projectDir, "src");
1151
+ const libPath = import_path7.default.join(srcPath, "lib");
1152
+ if (!import_fs7.default.existsSync(libPath)) {
1153
+ import_fs7.default.mkdirSync(libPath, { recursive: true });
843
1154
  }
844
- const authTemplatePath = import_path5.default.resolve(
1155
+ const authTemplatePath = import_path7.default.resolve(
845
1156
  __dirname,
846
1157
  `./template/TanstackStart/lib/${database}/auth.ts`
847
1158
  );
848
- const authDestinationPath = import_path5.default.join(libPath, "auth.ts");
849
- import_fs5.default.copyFileSync(authTemplatePath, authDestinationPath);
850
- const authClientTemplatePath = import_path5.default.resolve(
1159
+ const authDestinationPath = import_path7.default.join(libPath, "auth.ts");
1160
+ import_fs7.default.copyFileSync(authTemplatePath, authDestinationPath);
1161
+ const authClientTemplatePath = import_path7.default.resolve(
851
1162
  __dirname,
852
1163
  "./template/lib/auth-client.ts"
853
1164
  );
854
- const authClientDestinationPath = import_path5.default.join(libPath, "auth-client.ts");
855
- import_fs5.default.copyFileSync(authClientTemplatePath, authClientDestinationPath);
856
- const middlewarePath = import_path5.default.join(srcPath, "middleware");
857
- if (!import_fs5.default.existsSync(middlewarePath)) {
858
- import_fs5.default.mkdirSync(middlewarePath, { recursive: true });
1165
+ const authClientDestinationPath = import_path7.default.join(libPath, "auth-client.ts");
1166
+ import_fs7.default.copyFileSync(authClientTemplatePath, authClientDestinationPath);
1167
+ const middlewarePath = import_path7.default.join(srcPath, "middleware");
1168
+ if (!import_fs7.default.existsSync(middlewarePath)) {
1169
+ import_fs7.default.mkdirSync(middlewarePath, { recursive: true });
859
1170
  }
860
- const authMiddlewareTemplatePath = import_path5.default.resolve(
1171
+ const authMiddlewareTemplatePath = import_path7.default.resolve(
861
1172
  __dirname,
862
1173
  `./template/TanstackStart/middleware/auth.ts`
863
1174
  );
864
- const authMiddlewareDestinationPath = import_path5.default.join(middlewarePath, "auth.ts");
865
- import_fs5.default.copyFileSync(authMiddlewareTemplatePath, authMiddlewareDestinationPath);
866
- const fileRouteTemplatePath = import_path5.default.resolve(
1175
+ const authMiddlewareDestinationPath = import_path7.default.join(middlewarePath, "auth.ts");
1176
+ import_fs7.default.copyFileSync(authMiddlewareTemplatePath, authMiddlewareDestinationPath);
1177
+ const fileRouteTemplatePath = import_path7.default.resolve(
867
1178
  __dirname,
868
1179
  `./template/TanstackStart/routes/$.ts`
869
1180
  );
870
- const fileRouteDestinationPath = import_path5.default.join(
1181
+ const fileRouteDestinationPath = import_path7.default.join(
871
1182
  srcPath,
872
1183
  "routes",
873
1184
  "api",
874
1185
  "auth"
875
1186
  );
876
- if (!import_fs5.default.existsSync(fileRouteDestinationPath)) {
877
- import_fs5.default.mkdirSync(fileRouteDestinationPath, { recursive: true });
1187
+ if (!import_fs7.default.existsSync(fileRouteDestinationPath)) {
1188
+ import_fs7.default.mkdirSync(fileRouteDestinationPath, { recursive: true });
878
1189
  }
879
- const apiDestinationPath = import_path5.default.join(fileRouteDestinationPath, "$.ts");
880
- import_fs5.default.copyFileSync(fileRouteTemplatePath, apiDestinationPath);
1190
+ const apiDestinationPath = import_path7.default.join(fileRouteDestinationPath, "$.ts");
1191
+ import_fs7.default.copyFileSync(fileRouteTemplatePath, apiDestinationPath);
881
1192
  if (authUi) {
882
1193
  await authUiTanstackState({
883
1194
  packageJson: packageJson2,
@@ -885,13 +1196,13 @@ BETTER_AUTH_URL=http://localhost:3000
885
1196
  database: "prisma"
886
1197
  });
887
1198
  } else {
888
- console.log(import_chalk5.default.green("\nCompleted installation successfully"));
889
- console.log(import_chalk5.default.cyan("\nInstall Package:"));
890
- console.log(import_chalk5.default.white(`\u2022 prisma ${database} schema
1199
+ console.log(import_chalk7.default.green("\nCompleted installation successfully"));
1200
+ console.log(import_chalk7.default.cyan("\nInstall Package:"));
1201
+ console.log(import_chalk7.default.white(`\u2022 prisma ${database} schema
891
1202
  \u2022 better-auth`));
892
- console.log(import_chalk5.default.cyan("\nFiles created:"));
1203
+ console.log(import_chalk7.default.cyan("\nFiles created:"));
893
1204
  console.log(
894
- import_chalk5.default.white(
1205
+ import_chalk7.default.white(
895
1206
  `\u2022 src/lib/auth.ts
896
1207
  \u2022 src/lib/auth-client.ts
897
1208
  \u2022 src/app/api/auth/[...all]/route.ts
@@ -901,111 +1212,116 @@ BETTER_AUTH_URL=http://localhost:3000
901
1212
  );
902
1213
  }
903
1214
  } catch (err) {
904
- console.log(import_chalk5.default.red("Prisma Run Tanstack State Error: ", err));
1215
+ console.log(import_chalk7.default.red("Prisma Run Tanstack State Error: ", err));
905
1216
  }
906
1217
  };
907
1218
 
908
1219
  // script/drizzleRunTanstackStart.ts
909
- var import_chalk6 = __toESM(require("chalk"), 1);
910
- var import_path6 = __toESM(require("path"), 1);
911
- var import_fs6 = __toESM(require("fs"), 1);
912
- var import_url6 = require("url");
913
- var import_meta6 = {};
914
- var drizzleRunTanstackStart = async ({
1220
+ var import_chalk10 = __toESM(require("chalk"), 1);
1221
+ var import_path10 = __toESM(require("path"), 1);
1222
+ var import_fs10 = __toESM(require("fs"), 1);
1223
+
1224
+ // drizzle/drizzleTanstackSetup.ts
1225
+ var import_chalk8 = __toESM(require("chalk"), 1);
1226
+ var import_path8 = __toESM(require("path"), 1);
1227
+ var import_fs8 = __toESM(require("fs"), 1);
1228
+ var import_url7 = require("url");
1229
+ var import_meta7 = {};
1230
+ var drizzleTanstackSetup = async ({
915
1231
  authUi,
916
- cmd
1232
+ cmd,
1233
+ projectDir
917
1234
  }) => {
918
1235
  try {
919
- const projectDir = process.cwd();
920
- const packageJsonPath = import_path6.default.join(projectDir, "package.json");
921
- const packageJson2 = JSON.parse(import_fs6.default.readFileSync(packageJsonPath, "utf-8"));
1236
+ const packageJsonPath = import_path8.default.join(projectDir, "package.json");
1237
+ const packageJson2 = JSON.parse(import_fs8.default.readFileSync(packageJsonPath, "utf-8"));
922
1238
  if (!packageJson2.dependencies["better-auth"]) {
923
- console.log(import_chalk6.default.cyan("\n\u2699\uFE0F Initializing better auth...\n"));
1239
+ console.log(import_chalk8.default.cyan("\n\u2699\uFE0F Initializing better auth...\n"));
924
1240
  packageManager("better-auth");
925
1241
  }
926
1242
  if (!packageJson2.dependencies["drizzle-orm"] && !packageJson2.dependencies["drizzle-orm"] && !packageJson2.dependencies["drizzle-kit"] && !packageJson2.devDependencies["drizzle-kit"]) {
927
- console.log(import_chalk6.default.cyan("\n\u2699\uFE0F Initializing drizzle...\n"));
1243
+ console.log(import_chalk8.default.cyan("\n\u2699\uFE0F Initializing drizzle...\n"));
928
1244
  packageManager("drizzle-orm @neondatabase/serverless dotenv");
929
1245
  packageManager("drizzle-kit", true);
930
1246
  }
931
- const __filename = (0, import_url6.fileURLToPath)(import_meta6.url);
932
- const __dirname = import_path6.default.dirname(__filename);
933
- const envPath = import_path6.default.join(projectDir, ".env");
934
- if (!import_fs6.default.existsSync(envPath)) {
935
- import_fs6.default.writeFileSync(envPath, "DATABASE_URL=\n");
1247
+ const __filename = (0, import_url7.fileURLToPath)(import_meta7.url);
1248
+ const __dirname = import_path8.default.dirname(__filename);
1249
+ const envPath = import_path8.default.join(projectDir, ".env");
1250
+ if (!import_fs8.default.existsSync(envPath)) {
1251
+ import_fs8.default.writeFileSync(envPath, "DATABASE_URL=\n");
936
1252
  }
937
1253
  const secret = await GenerateSecret();
938
- const envContent = import_fs6.default.readFileSync(envPath, "utf-8");
1254
+ const envContent = import_fs8.default.readFileSync(envPath, "utf-8");
939
1255
  if (!envContent.includes("BETTER_AUTH_SECRET")) {
940
- import_fs6.default.appendFileSync(envPath, `
1256
+ import_fs8.default.appendFileSync(envPath, `
941
1257
 
942
1258
  BETTER_AUTH_SECRET=${secret}`);
943
1259
  }
944
1260
  if (!envContent.includes("BETTER_AUTH_URL")) {
945
- import_fs6.default.appendFileSync(envPath, `
1261
+ import_fs8.default.appendFileSync(envPath, `
946
1262
  BETTER_AUTH_URL=http://localhost:3000
947
1263
  `);
948
1264
  }
949
- const srcPath = import_path6.default.join(projectDir, "src");
950
- const libPath = import_path6.default.join(srcPath, "lib");
951
- if (!import_fs6.default.existsSync(libPath)) {
952
- import_fs6.default.mkdirSync(libPath, { recursive: true });
1265
+ const srcPath = import_path8.default.join(projectDir, "src");
1266
+ const libPath = import_path8.default.join(srcPath, "lib");
1267
+ if (!import_fs8.default.existsSync(libPath)) {
1268
+ import_fs8.default.mkdirSync(libPath, { recursive: true });
953
1269
  }
954
- const authTemplatePath = import_path6.default.resolve(
1270
+ const authTemplatePath = import_path8.default.resolve(
955
1271
  __dirname,
956
1272
  "./template/TanstackStart/lib/auth-drizzle.ts"
957
1273
  );
958
- const authDestinationPath = import_path6.default.join(libPath, "auth.ts");
959
- import_fs6.default.copyFileSync(authTemplatePath, authDestinationPath);
960
- const authClientTemplatePath = import_path6.default.resolve(
1274
+ const authDestinationPath = import_path8.default.join(libPath, "auth.ts");
1275
+ import_fs8.default.copyFileSync(authTemplatePath, authDestinationPath);
1276
+ const authClientTemplatePath = import_path8.default.resolve(
961
1277
  __dirname,
962
1278
  "./template/lib/auth-client.ts"
963
1279
  );
964
- const authClientDestinationPath = import_path6.default.join(libPath, "auth-client.ts");
965
- import_fs6.default.copyFileSync(authClientTemplatePath, authClientDestinationPath);
966
- const dbTemplatePath = import_path6.default.resolve(__dirname, "./template/db");
967
- const dbDir = import_path6.default.join(projectDir, "db");
968
- if (!import_fs6.default.existsSync(dbDir)) {
969
- import_fs6.default.mkdirSync(dbDir, { recursive: true });
970
- }
971
- const dbDestinationPath = import_path6.default.join(dbDir, "drizzle.ts");
972
- import_fs6.default.copyFileSync(`${dbTemplatePath}/drizzle.ts`, dbDestinationPath);
973
- const schemaDestinationPath = import_path6.default.join(dbDir, "schema.ts");
974
- import_fs6.default.copyFileSync(`${dbTemplatePath}/schema.ts`, schemaDestinationPath);
975
- const drizzleConfigTemplatePath = import_path6.default.resolve(
1280
+ const authClientDestinationPath = import_path8.default.join(libPath, "auth-client.ts");
1281
+ import_fs8.default.copyFileSync(authClientTemplatePath, authClientDestinationPath);
1282
+ const dbTemplatePath = import_path8.default.resolve(__dirname, "./template/db");
1283
+ const dbDir = import_path8.default.join(projectDir, "db");
1284
+ if (!import_fs8.default.existsSync(dbDir)) {
1285
+ import_fs8.default.mkdirSync(dbDir, { recursive: true });
1286
+ }
1287
+ const dbDestinationPath = import_path8.default.join(dbDir, "drizzle.ts");
1288
+ import_fs8.default.copyFileSync(`${dbTemplatePath}/drizzle.ts`, dbDestinationPath);
1289
+ const schemaDestinationPath = import_path8.default.join(dbDir, "schema.ts");
1290
+ import_fs8.default.copyFileSync(`${dbTemplatePath}/schema.ts`, schemaDestinationPath);
1291
+ const drizzleConfigTemplatePath = import_path8.default.resolve(
976
1292
  __dirname,
977
1293
  "./template/config/drizzle.config.ts"
978
1294
  );
979
- const drizzleConfigDestinationPath = import_path6.default.join(
1295
+ const drizzleConfigDestinationPath = import_path8.default.join(
980
1296
  projectDir,
981
1297
  "drizzle.config.ts"
982
1298
  );
983
- import_fs6.default.copyFileSync(drizzleConfigTemplatePath, drizzleConfigDestinationPath);
984
- const middlewarePath = import_path6.default.join(srcPath, "middleware");
985
- if (!import_fs6.default.existsSync(middlewarePath)) {
986
- import_fs6.default.mkdirSync(middlewarePath, { recursive: true });
1299
+ import_fs8.default.copyFileSync(drizzleConfigTemplatePath, drizzleConfigDestinationPath);
1300
+ const middlewarePath = import_path8.default.join(srcPath, "middleware");
1301
+ if (!import_fs8.default.existsSync(middlewarePath)) {
1302
+ import_fs8.default.mkdirSync(middlewarePath, { recursive: true });
987
1303
  }
988
- const authMiddlewareTemplatePath = import_path6.default.resolve(
1304
+ const authMiddlewareTemplatePath = import_path8.default.resolve(
989
1305
  __dirname,
990
1306
  `./template/TanstackStart/middleware/auth.ts`
991
1307
  );
992
- const authMiddlewareDestinationPath = import_path6.default.join(middlewarePath, "auth.ts");
993
- import_fs6.default.copyFileSync(authMiddlewareTemplatePath, authMiddlewareDestinationPath);
994
- const fileRouteTemplatePath = import_path6.default.resolve(
1308
+ const authMiddlewareDestinationPath = import_path8.default.join(middlewarePath, "auth.ts");
1309
+ import_fs8.default.copyFileSync(authMiddlewareTemplatePath, authMiddlewareDestinationPath);
1310
+ const fileRouteTemplatePath = import_path8.default.resolve(
995
1311
  __dirname,
996
1312
  `./template/TanstackStart/routes/$.ts`
997
1313
  );
998
- const fileRouteDestinationPath = import_path6.default.join(
1314
+ const fileRouteDestinationPath = import_path8.default.join(
999
1315
  srcPath,
1000
1316
  "routes",
1001
1317
  "api",
1002
1318
  "auth"
1003
1319
  );
1004
- if (!import_fs6.default.existsSync(fileRouteDestinationPath)) {
1005
- import_fs6.default.mkdirSync(fileRouteDestinationPath, { recursive: true });
1320
+ if (!import_fs8.default.existsSync(fileRouteDestinationPath)) {
1321
+ import_fs8.default.mkdirSync(fileRouteDestinationPath, { recursive: true });
1006
1322
  }
1007
- const apiDestinationPath = import_path6.default.join(fileRouteDestinationPath, "$.ts");
1008
- import_fs6.default.copyFileSync(fileRouteTemplatePath, apiDestinationPath);
1323
+ const apiDestinationPath = import_path8.default.join(fileRouteDestinationPath, "$.ts");
1324
+ import_fs8.default.copyFileSync(fileRouteTemplatePath, apiDestinationPath);
1009
1325
  if (authUi) {
1010
1326
  await authUiTanstackState({
1011
1327
  packageJson: packageJson2,
@@ -1013,13 +1329,13 @@ BETTER_AUTH_URL=http://localhost:3000
1013
1329
  database: "drizzle"
1014
1330
  });
1015
1331
  } else {
1016
- console.log(import_chalk6.default.green("\nCompleted installation successfully"));
1017
- console.log(import_chalk6.default.cyan("\nInstall Package:"));
1018
- console.log(import_chalk6.default.white(`\u2022 drizzle schema
1332
+ console.log(import_chalk8.default.green("\nCompleted installation successfully"));
1333
+ console.log(import_chalk8.default.cyan("\nInstall Package:"));
1334
+ console.log(import_chalk8.default.white(`\u2022 drizzle schema
1019
1335
  \u2022 better-auth`));
1020
- console.log(import_chalk6.default.cyan("\nFiles created:"));
1336
+ console.log(import_chalk8.default.cyan("\nFiles created:"));
1021
1337
  console.log(
1022
- import_chalk6.default.white(
1338
+ import_chalk8.default.white(
1023
1339
  `\u2022 src/lib/auth.ts
1024
1340
  \u2022 src/lib/auth-client.ts
1025
1341
  \u2022 src/app/api/auth/[...all]/route.ts
@@ -1028,74 +1344,295 @@ BETTER_AUTH_URL=http://localhost:3000
1028
1344
  )
1029
1345
  );
1030
1346
  }
1031
- } catch (err) {
1032
- console.error(import_chalk6.default.red("Drizzle setup failed:"), err);
1033
- }
1034
- };
1035
-
1036
- // utils/framework.ts
1037
- var import_path7 = __toESM(require("path"), 1);
1038
- var import_fs7 = __toESM(require("fs"), 1);
1039
- var getFramework = async () => {
1040
- const projectDir = process.cwd();
1041
- if (!import_fs7.default.existsSync(import_path7.default.join(projectDir, "package.json"))) {
1042
- return {
1043
- framework: null,
1044
- error: "No framework detected"
1045
- };
1046
- }
1047
- const packageJson2 = JSON.parse(
1048
- import_fs7.default.readFileSync(import_path7.default.join(projectDir, "package.json"), "utf-8")
1049
- );
1050
- const hasNext = packageJson2?.dependencies?.["next"] || packageJson2?.devDependencies?.["next"];
1051
- if (hasNext) {
1052
- return {
1053
- framework: "Next js",
1054
- error: null
1055
- };
1056
- }
1057
- const hasTanstackState = packageJson2?.devDependencies?.["@tanstack/devtools-vite"] || packageJson2?.devDependencies?.["@tanstack/eslint-config"] || packageJson2?.devDependencies?.["@tanstack/react-start"];
1058
- if (hasTanstackState) {
1059
- return {
1060
- framework: "tanstack start",
1061
- error: null
1062
- };
1347
+ } catch (error) {
1348
+ console.log(import_chalk8.default.red("Failed to setup drizzle ", error));
1063
1349
  }
1064
- return {
1065
- framework: null,
1066
- error: "No framework supported authverse"
1067
- };
1068
1350
  };
1069
1351
 
1070
- // cli/init.ts
1071
- var import_chalk7 = __toESM(require("chalk"), 1);
1072
- var initAnswer = async () => {
1073
- const { framework, error } = await getFramework();
1074
- if (error) {
1075
- console.log(import_chalk7.default.red(error));
1076
- return;
1077
- }
1078
- console.log(`\u2714 Detected framework: ${framework}`);
1079
- const answers = await import_inquirer3.default.prompt([
1080
- {
1081
- type: "list",
1082
- name: "orm",
1083
- message: "Choose Your ORM:",
1084
- choices: ["Prisma", "Drizzle"]
1085
- },
1086
- {
1087
- type: "list",
1088
- name: "database",
1089
- message: "Select Database:",
1090
- choices: ["Postgresql", "Mongodb", "Mysql"],
1091
- when: (ans) => ans.orm === "Prisma"
1092
- },
1093
- {
1094
- type: "confirm",
1095
- name: "authUi",
1096
- message: "Do you want to include auth UI design?",
1097
- default: true
1098
- }
1352
+ // drizzle/drizzleTanstackChecker.ts
1353
+ var import_chalk9 = __toESM(require("chalk"), 1);
1354
+ var import_path9 = __toESM(require("path"), 1);
1355
+ var import_fs9 = __toESM(require("fs"), 1);
1356
+ var import_url8 = require("url");
1357
+ var import_meta8 = {};
1358
+ var drizzleTanstackChecker = async ({
1359
+ authUi,
1360
+ cmd,
1361
+ projectDir
1362
+ }) => {
1363
+ try {
1364
+ const drizzleConfigPath = import_path9.default.join(projectDir, "drizzle.config.ts");
1365
+ if (!import_fs9.default.existsSync(drizzleConfigPath)) {
1366
+ return await drizzleTanstackSetup({ authUi, cmd, projectDir });
1367
+ }
1368
+ const drizzleConfigContent = import_fs9.default.readFileSync(drizzleConfigPath, "utf-8");
1369
+ const schemaMatch = drizzleConfigContent.match(/schema:\s*["'`](.*?)["'`]/);
1370
+ const schemaPath = schemaMatch ? schemaMatch[1] : null;
1371
+ if (!schemaPath || schemaPath === "") {
1372
+ return await drizzleTanstackSetup({ authUi, cmd, projectDir });
1373
+ }
1374
+ const __filename = (0, import_url8.fileURLToPath)(import_meta8.url);
1375
+ const __dirname = import_path9.default.dirname(__filename);
1376
+ const dbTemplatePath = import_path9.default.resolve(__dirname, "./template/db/schema.ts");
1377
+ const schemaFilePath = import_path9.default.join(projectDir, schemaPath);
1378
+ if (!import_fs9.default.existsSync(schemaFilePath)) {
1379
+ const dbFolder = import_path9.default.dirname(schemaFilePath);
1380
+ if (!import_fs9.default.existsSync(dbFolder)) {
1381
+ import_fs9.default.mkdirSync(dbFolder, { recursive: true });
1382
+ }
1383
+ import_fs9.default.copyFileSync(dbTemplatePath, schemaFilePath);
1384
+ } else {
1385
+ let schemaFileContent = import_fs9.default.readFileSync(schemaFilePath, "utf-8");
1386
+ const dbTemplateContent = import_fs9.default.readFileSync(dbTemplatePath, "utf-8");
1387
+ const requiredTables = ["user", "session", "account", "verification"];
1388
+ let needsUpdate = false;
1389
+ let updatedSchemaContent = schemaFileContent;
1390
+ for (const table of requiredTables) {
1391
+ const existingTable = extractTableDefinition(
1392
+ updatedSchemaContent,
1393
+ table
1394
+ );
1395
+ const templateTable = extractTableDefinition(dbTemplateContent, table);
1396
+ if (!existingTable && templateTable) {
1397
+ const schemaExportIndex = updatedSchemaContent.indexOf(
1398
+ "export const schema ="
1399
+ );
1400
+ if (schemaExportIndex !== -1) {
1401
+ updatedSchemaContent = updatedSchemaContent.slice(0, schemaExportIndex) + templateTable + "\n\n" + updatedSchemaContent.slice(schemaExportIndex);
1402
+ } else {
1403
+ updatedSchemaContent += "\n\n" + templateTable;
1404
+ }
1405
+ needsUpdate = true;
1406
+ } else if (existingTable && templateTable) {
1407
+ const existingColumns = extractColumnNames(existingTable);
1408
+ const templateColumns = extractColumnNames(templateTable);
1409
+ const missingColumns = templateColumns.filter(
1410
+ (col) => !existingColumns.includes(col)
1411
+ );
1412
+ if (missingColumns.length > 0) {
1413
+ const updatedTable = addMissingColumnsToTable(
1414
+ existingTable,
1415
+ templateTable
1416
+ );
1417
+ updatedSchemaContent = updatedSchemaContent.replace(
1418
+ existingTable,
1419
+ updatedTable
1420
+ );
1421
+ needsUpdate = true;
1422
+ }
1423
+ }
1424
+ }
1425
+ if (needsUpdate) {
1426
+ const schemaExportRegex = /export const schema = \{([\s\S]*?)\};/;
1427
+ const schemaMatch2 = updatedSchemaContent.match(schemaExportRegex);
1428
+ if (schemaMatch2) {
1429
+ let currentSchemaContent = schemaMatch2[1];
1430
+ for (const table of requiredTables) {
1431
+ if (!currentSchemaContent.includes(`${table},`)) {
1432
+ const lines = currentSchemaContent.split("\n");
1433
+ const lastNonEmptyLine = lines.length - 1;
1434
+ if (lines[lastNonEmptyLine].trim() === "}") {
1435
+ lines[lastNonEmptyLine] = ` ${table},
1436
+ ${lines[lastNonEmptyLine]}`;
1437
+ } else {
1438
+ lines.push(` ${table},`);
1439
+ }
1440
+ currentSchemaContent = lines.join("\n");
1441
+ }
1442
+ }
1443
+ updatedSchemaContent = updatedSchemaContent.replace(
1444
+ schemaExportRegex,
1445
+ `export const schema = {${currentSchemaContent}};`
1446
+ );
1447
+ }
1448
+ import_fs9.default.writeFileSync(schemaFilePath, updatedSchemaContent);
1449
+ }
1450
+ }
1451
+ const packageJsonPath = import_path9.default.join(projectDir, "package.json");
1452
+ const packageJson2 = JSON.parse(import_fs9.default.readFileSync(packageJsonPath, "utf-8"));
1453
+ if (!packageJson2.dependencies["better-auth"]) {
1454
+ console.log(import_chalk9.default.cyan("\n\u2699\uFE0F Initializing better auth...\n"));
1455
+ packageManager("better-auth");
1456
+ }
1457
+ const drizzleDeps = [
1458
+ "drizzle-orm",
1459
+ "@neondatabase/serverless",
1460
+ "dotenv",
1461
+ "drizzle-kit"
1462
+ ];
1463
+ const missingDrizzleDeps = drizzleDeps.filter((dep) => {
1464
+ return !packageJson2.dependencies?.[dep] && !packageJson2.devDependencies?.[dep];
1465
+ });
1466
+ if (missingDrizzleDeps.length > 0) {
1467
+ console.log(import_chalk9.default.cyan("\n\u2699\uFE0F Initializing drizzle...\n"));
1468
+ packageManager(missingDrizzleDeps.join(" "));
1469
+ }
1470
+ const envPath = import_path9.default.join(projectDir, ".env");
1471
+ if (!import_fs9.default.existsSync(envPath)) {
1472
+ import_fs9.default.writeFileSync(envPath, "DATABASE_URL=\n");
1473
+ }
1474
+ const secret = await GenerateSecret();
1475
+ const envContent = import_fs9.default.readFileSync(envPath, "utf-8");
1476
+ if (!envContent.includes("BETTER_AUTH_SECRET")) {
1477
+ import_fs9.default.appendFileSync(envPath, `
1478
+
1479
+ BETTER_AUTH_SECRET=${secret}`);
1480
+ }
1481
+ if (!envContent.includes("BETTER_AUTH_URL")) {
1482
+ import_fs9.default.appendFileSync(envPath, `
1483
+ BETTER_AUTH_URL=http://localhost:3000
1484
+ `);
1485
+ }
1486
+ const srcPath = import_path9.default.join(projectDir, "src");
1487
+ const libPath = import_path9.default.join(srcPath, "lib");
1488
+ if (!import_fs9.default.existsSync(libPath)) {
1489
+ import_fs9.default.mkdirSync(libPath, { recursive: true });
1490
+ }
1491
+ const authTemplatePath = import_path9.default.resolve(
1492
+ __dirname,
1493
+ "./template/TanstackStart/lib/auth-drizzle.ts"
1494
+ );
1495
+ const authDestinationPath = import_path9.default.join(libPath, "auth.ts");
1496
+ import_fs9.default.copyFileSync(authTemplatePath, authDestinationPath);
1497
+ const authClientTemplatePath = import_path9.default.resolve(
1498
+ __dirname,
1499
+ "./template/lib/auth-client.ts"
1500
+ );
1501
+ const authClientDestinationPath = import_path9.default.join(libPath, "auth-client.ts");
1502
+ import_fs9.default.copyFileSync(authClientTemplatePath, authClientDestinationPath);
1503
+ const middlewarePath = import_path9.default.join(srcPath, "middleware");
1504
+ if (!import_fs9.default.existsSync(middlewarePath)) {
1505
+ import_fs9.default.mkdirSync(middlewarePath, { recursive: true });
1506
+ }
1507
+ const authMiddlewareTemplatePath = import_path9.default.resolve(
1508
+ __dirname,
1509
+ `./template/TanstackStart/middleware/auth.ts`
1510
+ );
1511
+ const authMiddlewareDestinationPath = import_path9.default.join(middlewarePath, "auth.ts");
1512
+ import_fs9.default.copyFileSync(authMiddlewareTemplatePath, authMiddlewareDestinationPath);
1513
+ const fileRouteTemplatePath = import_path9.default.resolve(
1514
+ __dirname,
1515
+ `./template/TanstackStart/routes/$.ts`
1516
+ );
1517
+ const fileRouteDestinationPath = import_path9.default.join(
1518
+ srcPath,
1519
+ "routes",
1520
+ "api",
1521
+ "auth"
1522
+ );
1523
+ if (!import_fs9.default.existsSync(fileRouteDestinationPath)) {
1524
+ import_fs9.default.mkdirSync(fileRouteDestinationPath, { recursive: true });
1525
+ }
1526
+ const apiDestinationPath = import_path9.default.join(fileRouteDestinationPath, "$.ts");
1527
+ import_fs9.default.copyFileSync(fileRouteTemplatePath, apiDestinationPath);
1528
+ if (authUi) {
1529
+ await authUiTanstackState({
1530
+ packageJson: packageJson2,
1531
+ cmd,
1532
+ database: "drizzle"
1533
+ });
1534
+ } else {
1535
+ console.log(import_chalk9.default.green("\nCompleted installation successfully"));
1536
+ console.log(import_chalk9.default.cyan("\nInstall Package:"));
1537
+ console.log(import_chalk9.default.white(`\u2022 drizzle schema
1538
+ \u2022 better-auth`));
1539
+ console.log(import_chalk9.default.cyan("\nFiles created:"));
1540
+ console.log(
1541
+ import_chalk9.default.white(
1542
+ `\u2022 src/lib/auth.ts
1543
+ \u2022 src/lib/auth-client.ts
1544
+ \u2022 src/app/api/auth/[...all]/route.ts
1545
+ \u2022 src/proxy.ts
1546
+ `
1547
+ )
1548
+ );
1549
+ }
1550
+ } catch (error) {
1551
+ console.log(import_chalk9.default.red("Failed to setup drizzle ", error));
1552
+ }
1553
+ };
1554
+
1555
+ // script/drizzleRunTanstackStart.ts
1556
+ var drizzleRunTanstackStart = async ({
1557
+ authUi,
1558
+ cmd
1559
+ }) => {
1560
+ try {
1561
+ const projectDir = process.cwd();
1562
+ const drizzleConfigPath = import_path10.default.join(projectDir, "drizzle.config.ts");
1563
+ if (import_fs10.default.existsSync(drizzleConfigPath)) {
1564
+ await drizzleTanstackChecker({ authUi, cmd, projectDir });
1565
+ } else {
1566
+ await drizzleTanstackSetup({ authUi, cmd, projectDir });
1567
+ }
1568
+ } catch (err) {
1569
+ console.error(import_chalk10.default.red("Drizzle setup failed:"), err);
1570
+ }
1571
+ };
1572
+
1573
+ // utils/framework.ts
1574
+ var import_path11 = __toESM(require("path"), 1);
1575
+ var import_fs11 = __toESM(require("fs"), 1);
1576
+ var getFramework = async () => {
1577
+ const projectDir = process.cwd();
1578
+ if (!import_fs11.default.existsSync(import_path11.default.join(projectDir, "package.json"))) {
1579
+ return {
1580
+ framework: null,
1581
+ error: "No framework detected"
1582
+ };
1583
+ }
1584
+ const packageJson2 = JSON.parse(
1585
+ import_fs11.default.readFileSync(import_path11.default.join(projectDir, "package.json"), "utf-8")
1586
+ );
1587
+ const hasNext = packageJson2?.dependencies?.["next"] || packageJson2?.devDependencies?.["next"];
1588
+ if (hasNext) {
1589
+ return {
1590
+ framework: "Next js",
1591
+ error: null
1592
+ };
1593
+ }
1594
+ const hasTanstackState = packageJson2?.devDependencies?.["@tanstack/devtools-vite"] || packageJson2?.devDependencies?.["@tanstack/eslint-config"] || packageJson2?.devDependencies?.["@tanstack/react-start"];
1595
+ if (hasTanstackState) {
1596
+ return {
1597
+ framework: "tanstack start",
1598
+ error: null
1599
+ };
1600
+ }
1601
+ return {
1602
+ framework: null,
1603
+ error: "No framework supported authverse"
1604
+ };
1605
+ };
1606
+
1607
+ // cli/init.ts
1608
+ var import_chalk11 = __toESM(require("chalk"), 1);
1609
+ var initAnswer = async () => {
1610
+ const { framework, error } = await getFramework();
1611
+ if (error) {
1612
+ console.log(import_chalk11.default.red(error));
1613
+ return;
1614
+ }
1615
+ console.log(`\u2714 Detected framework: ${framework}`);
1616
+ const answers = await import_inquirer4.default.prompt([
1617
+ {
1618
+ type: "select",
1619
+ name: "orm",
1620
+ message: "Choose Your ORM:",
1621
+ choices: ["Prisma", "Drizzle"]
1622
+ },
1623
+ {
1624
+ type: "select",
1625
+ name: "database",
1626
+ message: "Select Database:",
1627
+ choices: ["Postgresql", "Mongodb", "Mysql"],
1628
+ when: (ans) => ans.orm === "Prisma"
1629
+ },
1630
+ {
1631
+ type: "confirm",
1632
+ name: "authUi",
1633
+ message: "Do you want to include auth UI design?",
1634
+ default: true
1635
+ }
1099
1636
  ]);
1100
1637
  if (framework === "Next js" && answers.orm === "Prisma") {
1101
1638
  await prismaRun({
@@ -1126,37 +1663,37 @@ var initAnswer = async () => {
1126
1663
  };
1127
1664
 
1128
1665
  // index.ts
1129
- var import_fs31 = require("fs");
1666
+ var import_fs35 = require("fs");
1130
1667
 
1131
1668
  // cli/oauth.ts
1132
- var import_chalk20 = __toESM(require("chalk"), 1);
1669
+ var import_chalk24 = __toESM(require("chalk"), 1);
1133
1670
 
1134
1671
  // oauth/googleNext.ts
1135
- var import_chalk8 = __toESM(require("chalk"), 1);
1136
- var import_fs8 = __toESM(require("fs"), 1);
1137
- var import_path8 = __toESM(require("path"), 1);
1138
- var import_url7 = require("url");
1139
- var import_meta7 = {};
1672
+ var import_chalk12 = __toESM(require("chalk"), 1);
1673
+ var import_fs12 = __toESM(require("fs"), 1);
1674
+ var import_path12 = __toESM(require("path"), 1);
1675
+ var import_url9 = require("url");
1676
+ var import_meta9 = {};
1140
1677
  var googleNext = async () => {
1141
1678
  try {
1142
- const __filename = (0, import_url7.fileURLToPath)(import_meta7.url);
1143
- const __dirname = import_path8.default.dirname(__filename);
1679
+ const __filename = (0, import_url9.fileURLToPath)(import_meta9.url);
1680
+ const __dirname = import_path12.default.dirname(__filename);
1144
1681
  const projectDir = process.cwd();
1145
- const srcPath = import_path8.default.join(projectDir, "src");
1146
- const folder = import_fs8.default.existsSync(srcPath) ? "src" : "";
1147
- const authFilePath = import_path8.default.join(projectDir, folder, "lib", "auth.ts");
1148
- if (!import_fs8.default.existsSync(authFilePath)) {
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"));
1682
+ const srcPath = import_path12.default.join(projectDir, "src");
1683
+ const folder = import_fs12.default.existsSync(srcPath) ? "src" : "";
1684
+ const authFilePath = import_path12.default.join(projectDir, folder, "lib", "auth.ts");
1685
+ if (!import_fs12.default.existsSync(authFilePath)) {
1686
+ console.log(import_chalk12.default.red("No Configured Better Auth file found"));
1687
+ console.log(import_chalk12.default.cyan("Run authverse init to initialize better auth"));
1151
1688
  return;
1152
1689
  }
1153
- let content = import_fs8.default.readFileSync(authFilePath, "utf8");
1690
+ let content = import_fs12.default.readFileSync(authFilePath, "utf8");
1154
1691
  if (!content.includes("betterAuth({")) {
1155
- console.log(import_chalk8.default.red("betterAuth({}) block not found"));
1692
+ console.log(import_chalk12.default.red("betterAuth({}) block not found"));
1156
1693
  return;
1157
1694
  }
1158
1695
  if (content.includes("socialProviders") && content.includes("google:")) {
1159
- console.log(import_chalk8.default.yellow("Google provider already exists"));
1696
+ console.log(import_chalk12.default.yellow("Google provider already exists"));
1160
1697
  return;
1161
1698
  }
1162
1699
  const googleProviderEntry = `
@@ -1179,7 +1716,7 @@ var googleNext = async () => {
1179
1716
  }
1180
1717
  }
1181
1718
  if (insertPos === -1) {
1182
- console.log(import_chalk8.default.red("Failed to parse socialProviders block"));
1719
+ console.log(import_chalk12.default.red("Failed to parse socialProviders block"));
1183
1720
  return;
1184
1721
  }
1185
1722
  content = content.slice(0, insertPos) + googleProviderEntry + "\n " + content.slice(insertPos);
@@ -1187,7 +1724,7 @@ var googleNext = async () => {
1187
1724
  const databaseRegex = /database:\s*(prismaAdapter|drizzleAdapter)\([\s\S]*?\),/;
1188
1725
  if (!databaseRegex.test(content)) {
1189
1726
  console.log(
1190
- import_chalk8.default.red(
1727
+ import_chalk12.default.red(
1191
1728
  "Could not find database adapter (prismaAdapter or drizzleAdapter)"
1192
1729
  )
1193
1730
  );
@@ -1203,12 +1740,12 @@ ${googleProviderEntry}
1203
1740
  ${socialProvidersBlock}`
1204
1741
  );
1205
1742
  }
1206
- import_fs8.default.writeFileSync(authFilePath, content, "utf8");
1207
- const envPath = import_path8.default.join(projectDir, ".env");
1208
- if (import_fs8.default.existsSync(envPath)) {
1209
- const envContent = import_fs8.default.readFileSync(envPath, "utf8");
1743
+ import_fs12.default.writeFileSync(authFilePath, content, "utf8");
1744
+ const envPath = import_path12.default.join(projectDir, ".env");
1745
+ if (import_fs12.default.existsSync(envPath)) {
1746
+ const envContent = import_fs12.default.readFileSync(envPath, "utf8");
1210
1747
  if (!envContent.includes("GOOGLE_CLIENT_ID")) {
1211
- import_fs8.default.appendFileSync(
1748
+ import_fs12.default.appendFileSync(
1212
1749
  envPath,
1213
1750
  `
1214
1751
 
@@ -1219,61 +1756,61 @@ GOOGLE_CLIENT_SECRET=
1219
1756
  );
1220
1757
  }
1221
1758
  }
1222
- const componentTemplate = import_path8.default.resolve(
1759
+ const componentTemplate = import_path12.default.resolve(
1223
1760
  __dirname,
1224
1761
  "./template/components/GoogleOAuthButton.tsx"
1225
1762
  );
1226
- const componentsDir = import_path8.default.join(
1763
+ const componentsDir = import_path12.default.join(
1227
1764
  projectDir,
1228
1765
  folder,
1229
1766
  "components",
1230
1767
  "authverse"
1231
1768
  );
1232
- if (!import_fs8.default.existsSync(componentsDir)) {
1233
- import_fs8.default.mkdirSync(componentsDir, { recursive: true });
1769
+ if (!import_fs12.default.existsSync(componentsDir)) {
1770
+ import_fs12.default.mkdirSync(componentsDir, { recursive: true });
1234
1771
  }
1235
- const componentDest = import_path8.default.join(componentsDir, "GoogleOAuthButton.tsx");
1236
- if (import_fs8.default.existsSync(componentTemplate)) {
1237
- import_fs8.default.copyFileSync(componentTemplate, componentDest);
1772
+ const componentDest = import_path12.default.join(componentsDir, "GoogleOAuthButton.tsx");
1773
+ if (import_fs12.default.existsSync(componentTemplate)) {
1774
+ import_fs12.default.copyFileSync(componentTemplate, componentDest);
1238
1775
  }
1239
- console.log(import_chalk8.default.green("Google provider added & merged successfully\n"));
1776
+ console.log(import_chalk12.default.green("Google provider added & merged successfully\n"));
1240
1777
  console.log(
1241
- import_chalk8.default.white(
1778
+ import_chalk12.default.white(
1242
1779
  `${CreateFolder({ srcFolder: folder, destFolder: "components/authverse/GoogleOAuthButton.tsx" })}
1243
1780
  `
1244
1781
  )
1245
1782
  );
1246
1783
  } catch (error) {
1247
- console.log(import_chalk8.default.red("googleRun error:"), error);
1784
+ console.log(import_chalk12.default.red("googleRun error:"), error);
1248
1785
  }
1249
1786
  };
1250
1787
 
1251
1788
  // oauth/githubNext.ts
1252
- var import_chalk9 = __toESM(require("chalk"), 1);
1253
- var import_fs9 = __toESM(require("fs"), 1);
1254
- var import_path9 = __toESM(require("path"), 1);
1255
- var import_url8 = require("url");
1256
- var import_meta8 = {};
1789
+ var import_chalk13 = __toESM(require("chalk"), 1);
1790
+ var import_fs13 = __toESM(require("fs"), 1);
1791
+ var import_path13 = __toESM(require("path"), 1);
1792
+ var import_url10 = require("url");
1793
+ var import_meta10 = {};
1257
1794
  var githubNext = async () => {
1258
1795
  try {
1259
- const __filename = (0, import_url8.fileURLToPath)(import_meta8.url);
1260
- const __dirname = import_path9.default.dirname(__filename);
1796
+ const __filename = (0, import_url10.fileURLToPath)(import_meta10.url);
1797
+ const __dirname = import_path13.default.dirname(__filename);
1261
1798
  const projectDir = process.cwd();
1262
- const srcPath = import_path9.default.join(projectDir, "src");
1263
- const folder = import_fs9.default.existsSync(srcPath) ? "src" : "";
1264
- const authFilePath = import_path9.default.join(projectDir, folder, "lib", "auth.ts");
1265
- if (!import_fs9.default.existsSync(authFilePath)) {
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"));
1799
+ const srcPath = import_path13.default.join(projectDir, "src");
1800
+ const folder = import_fs13.default.existsSync(srcPath) ? "src" : "";
1801
+ const authFilePath = import_path13.default.join(projectDir, folder, "lib", "auth.ts");
1802
+ if (!import_fs13.default.existsSync(authFilePath)) {
1803
+ console.log(import_chalk13.default.red("No Configured Better Auth file found"));
1804
+ console.log(import_chalk13.default.cyan("Run authverse init to initialize better auth"));
1268
1805
  return;
1269
1806
  }
1270
- let content = import_fs9.default.readFileSync(authFilePath, "utf8");
1807
+ let content = import_fs13.default.readFileSync(authFilePath, "utf8");
1271
1808
  if (!content.includes("betterAuth({")) {
1272
- console.log(import_chalk9.default.red("betterAuth({}) block not found"));
1809
+ console.log(import_chalk13.default.red("betterAuth({}) block not found"));
1273
1810
  return;
1274
1811
  }
1275
1812
  if (content.includes("socialProviders") && content.includes("github:")) {
1276
- console.log(import_chalk9.default.yellow("GitHub provider already exists"));
1813
+ console.log(import_chalk13.default.yellow("GitHub provider already exists"));
1277
1814
  return;
1278
1815
  }
1279
1816
  const githubProviderEntry = `
@@ -1296,7 +1833,7 @@ var githubNext = async () => {
1296
1833
  }
1297
1834
  }
1298
1835
  if (insertPos === -1) {
1299
- console.log(import_chalk9.default.red("Failed to parse socialProviders block"));
1836
+ console.log(import_chalk13.default.red("Failed to parse socialProviders block"));
1300
1837
  return;
1301
1838
  }
1302
1839
  content = content.slice(0, insertPos) + githubProviderEntry + "\n " + content.slice(insertPos);
@@ -1304,7 +1841,7 @@ var githubNext = async () => {
1304
1841
  const databaseRegex = /database:\s*(prismaAdapter|drizzleAdapter)\([\s\S]*?\),/;
1305
1842
  if (!databaseRegex.test(content)) {
1306
1843
  console.log(
1307
- import_chalk9.default.red(
1844
+ import_chalk13.default.red(
1308
1845
  "Could not find database adapter (prismaAdapter or drizzleAdapter)"
1309
1846
  )
1310
1847
  );
@@ -1320,12 +1857,12 @@ ${githubProviderEntry}
1320
1857
  ${socialProvidersBlock}`
1321
1858
  );
1322
1859
  }
1323
- import_fs9.default.writeFileSync(authFilePath, content, "utf8");
1324
- const envPath = import_path9.default.join(projectDir, ".env");
1325
- if (import_fs9.default.existsSync(envPath)) {
1326
- const envContent = import_fs9.default.readFileSync(envPath, "utf8");
1860
+ import_fs13.default.writeFileSync(authFilePath, content, "utf8");
1861
+ const envPath = import_path13.default.join(projectDir, ".env");
1862
+ if (import_fs13.default.existsSync(envPath)) {
1863
+ const envContent = import_fs13.default.readFileSync(envPath, "utf8");
1327
1864
  if (!envContent.includes("GITHUB_CLIENT_ID")) {
1328
- import_fs9.default.appendFileSync(
1865
+ import_fs13.default.appendFileSync(
1329
1866
  envPath,
1330
1867
  `
1331
1868
 
@@ -1336,60 +1873,60 @@ GITHUB_CLIENT_SECRET=
1336
1873
  );
1337
1874
  }
1338
1875
  }
1339
- const componentTemplate = import_path9.default.resolve(
1876
+ const componentTemplate = import_path13.default.resolve(
1340
1877
  __dirname,
1341
1878
  "./template/components/GithubOAuthButton.tsx"
1342
1879
  );
1343
- const componentsDir = import_path9.default.join(
1880
+ const componentsDir = import_path13.default.join(
1344
1881
  projectDir,
1345
1882
  folder,
1346
1883
  "components",
1347
1884
  "authverse"
1348
1885
  );
1349
- if (!import_fs9.default.existsSync(componentsDir)) {
1350
- import_fs9.default.mkdirSync(componentsDir, { recursive: true });
1886
+ if (!import_fs13.default.existsSync(componentsDir)) {
1887
+ import_fs13.default.mkdirSync(componentsDir, { recursive: true });
1351
1888
  }
1352
- const componentDest = import_path9.default.join(componentsDir, "GithubOAuthButton.tsx");
1353
- if (import_fs9.default.existsSync(componentTemplate)) {
1354
- import_fs9.default.copyFileSync(componentTemplate, componentDest);
1889
+ const componentDest = import_path13.default.join(componentsDir, "GithubOAuthButton.tsx");
1890
+ if (import_fs13.default.existsSync(componentTemplate)) {
1891
+ import_fs13.default.copyFileSync(componentTemplate, componentDest);
1355
1892
  }
1356
- console.log(import_chalk9.default.green("GitHub provider added & merged successfully\n"));
1893
+ console.log(import_chalk13.default.green("GitHub provider added & merged successfully\n"));
1357
1894
  console.log(
1358
- import_chalk9.default.white(
1895
+ import_chalk13.default.white(
1359
1896
  `${CreateFolder({ srcFolder: folder, destFolder: "components/authverse/GithubOAuthButton.tsx" })}
1360
1897
  `
1361
1898
  )
1362
1899
  );
1363
1900
  } catch (error) {
1364
- console.log(import_chalk9.default.red("githubRun error:"), error);
1901
+ console.log(import_chalk13.default.red("githubRun error:"), error);
1365
1902
  }
1366
1903
  };
1367
1904
 
1368
1905
  // oauth/googleTanstackStart.ts
1369
- var import_chalk10 = __toESM(require("chalk"), 1);
1370
- var import_fs10 = __toESM(require("fs"), 1);
1371
- var import_path10 = __toESM(require("path"), 1);
1372
- var import_url9 = require("url");
1373
- var import_meta9 = {};
1906
+ var import_chalk14 = __toESM(require("chalk"), 1);
1907
+ var import_fs14 = __toESM(require("fs"), 1);
1908
+ var import_path14 = __toESM(require("path"), 1);
1909
+ var import_url11 = require("url");
1910
+ var import_meta11 = {};
1374
1911
  var googleTanstackStart = async () => {
1375
1912
  try {
1376
- const __filename = (0, import_url9.fileURLToPath)(import_meta9.url);
1377
- const __dirname = import_path10.default.dirname(__filename);
1913
+ const __filename = (0, import_url11.fileURLToPath)(import_meta11.url);
1914
+ const __dirname = import_path14.default.dirname(__filename);
1378
1915
  const projectDir = process.cwd();
1379
- const srcPath = import_path10.default.join(projectDir, "src");
1380
- const authFilePath = import_path10.default.join(srcPath, "lib", "auth.ts");
1381
- if (!import_fs10.default.existsSync(authFilePath)) {
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"));
1916
+ const srcPath = import_path14.default.join(projectDir, "src");
1917
+ const authFilePath = import_path14.default.join(srcPath, "lib", "auth.ts");
1918
+ if (!import_fs14.default.existsSync(authFilePath)) {
1919
+ console.log(import_chalk14.default.red("No Configured Better Auth file found"));
1920
+ console.log(import_chalk14.default.cyan("Run authverse init to initialize better auth"));
1384
1921
  return;
1385
1922
  }
1386
- let content = import_fs10.default.readFileSync(authFilePath, "utf8");
1923
+ let content = import_fs14.default.readFileSync(authFilePath, "utf8");
1387
1924
  if (!content.includes("betterAuth({")) {
1388
- console.log(import_chalk10.default.red("betterAuth({}) block not found"));
1925
+ console.log(import_chalk14.default.red("betterAuth({}) block not found"));
1389
1926
  return;
1390
1927
  }
1391
1928
  if (content.includes("socialProviders") && content.includes("google:")) {
1392
- console.log(import_chalk10.default.yellow("Google provider already exists"));
1929
+ console.log(import_chalk14.default.yellow("Google provider already exists"));
1393
1930
  return;
1394
1931
  }
1395
1932
  const googleProviderEntry = `
@@ -1412,7 +1949,7 @@ var googleTanstackStart = async () => {
1412
1949
  }
1413
1950
  }
1414
1951
  if (insertPos === -1) {
1415
- console.log(import_chalk10.default.red("Failed to parse socialProviders block"));
1952
+ console.log(import_chalk14.default.red("Failed to parse socialProviders block"));
1416
1953
  return;
1417
1954
  }
1418
1955
  content = content.slice(0, insertPos) + googleProviderEntry + "\n " + content.slice(insertPos);
@@ -1420,7 +1957,7 @@ var googleTanstackStart = async () => {
1420
1957
  const databaseRegex = /database:\s*(prismaAdapter|drizzleAdapter)\([\s\S]*?\),/;
1421
1958
  if (!databaseRegex.test(content)) {
1422
1959
  console.log(
1423
- import_chalk10.default.red(
1960
+ import_chalk14.default.red(
1424
1961
  "Could not find database adapter (prismaAdapter or drizzleAdapter)"
1425
1962
  )
1426
1963
  );
@@ -1436,12 +1973,12 @@ ${googleProviderEntry}
1436
1973
  ${socialProvidersBlock}`
1437
1974
  );
1438
1975
  }
1439
- import_fs10.default.writeFileSync(authFilePath, content, "utf8");
1440
- const envPath = import_path10.default.join(projectDir, ".env");
1441
- if (import_fs10.default.existsSync(envPath)) {
1442
- const envContent = import_fs10.default.readFileSync(envPath, "utf8");
1976
+ import_fs14.default.writeFileSync(authFilePath, content, "utf8");
1977
+ const envPath = import_path14.default.join(projectDir, ".env");
1978
+ if (import_fs14.default.existsSync(envPath)) {
1979
+ const envContent = import_fs14.default.readFileSync(envPath, "utf8");
1443
1980
  if (!envContent.includes("GOOGLE_CLIENT_ID")) {
1444
- import_fs10.default.appendFileSync(
1981
+ import_fs14.default.appendFileSync(
1445
1982
  envPath,
1446
1983
  `
1447
1984
 
@@ -1452,52 +1989,52 @@ GOOGLE_CLIENT_SECRET=
1452
1989
  );
1453
1990
  }
1454
1991
  }
1455
- const componentTemplate = import_path10.default.resolve(
1992
+ const componentTemplate = import_path14.default.resolve(
1456
1993
  __dirname,
1457
1994
  "./template/TanstackStart/components/GoogleOAuthButton.tsx"
1458
1995
  );
1459
- const componentsDir = import_path10.default.join(srcPath, "components", "authverse");
1460
- if (!import_fs10.default.existsSync(componentsDir)) {
1461
- import_fs10.default.mkdirSync(componentsDir, { recursive: true });
1996
+ const componentsDir = import_path14.default.join(srcPath, "components", "authverse");
1997
+ if (!import_fs14.default.existsSync(componentsDir)) {
1998
+ import_fs14.default.mkdirSync(componentsDir, { recursive: true });
1462
1999
  }
1463
- const componentDest = import_path10.default.join(componentsDir, "GoogleOAuthButton.tsx");
1464
- if (import_fs10.default.existsSync(componentTemplate)) {
1465
- import_fs10.default.copyFileSync(componentTemplate, componentDest);
2000
+ const componentDest = import_path14.default.join(componentsDir, "GoogleOAuthButton.tsx");
2001
+ if (import_fs14.default.existsSync(componentTemplate)) {
2002
+ import_fs14.default.copyFileSync(componentTemplate, componentDest);
1466
2003
  }
1467
- console.log(import_chalk10.default.green("Google provider added & merged successfully\n"));
2004
+ console.log(import_chalk14.default.green("Google provider added & merged successfully\n"));
1468
2005
  console.log(
1469
- import_chalk10.default.white("\u2022 src/components/authverse/GoogleOAuthButton.tsx")
2006
+ import_chalk14.default.white("\u2022 src/components/authverse/GoogleOAuthButton.tsx")
1470
2007
  );
1471
2008
  } catch (error) {
1472
- console.log(import_chalk10.default.red("googleRunTanstackState error:"), error);
2009
+ console.log(import_chalk14.default.red("googleRunTanstackState error:"), error);
1473
2010
  }
1474
2011
  };
1475
2012
 
1476
2013
  // oauth/githubTanstackStart.ts
1477
- var import_chalk11 = __toESM(require("chalk"), 1);
1478
- var import_fs11 = __toESM(require("fs"), 1);
1479
- var import_path11 = __toESM(require("path"), 1);
1480
- var import_url10 = require("url");
1481
- var import_meta10 = {};
2014
+ var import_chalk15 = __toESM(require("chalk"), 1);
2015
+ var import_fs15 = __toESM(require("fs"), 1);
2016
+ var import_path15 = __toESM(require("path"), 1);
2017
+ var import_url12 = require("url");
2018
+ var import_meta12 = {};
1482
2019
  var githubTanstackStart = async () => {
1483
2020
  try {
1484
- const __filename = (0, import_url10.fileURLToPath)(import_meta10.url);
1485
- const __dirname = import_path11.default.dirname(__filename);
2021
+ const __filename = (0, import_url12.fileURLToPath)(import_meta12.url);
2022
+ const __dirname = import_path15.default.dirname(__filename);
1486
2023
  const projectDir = process.cwd();
1487
- const srcPath = import_path11.default.join(projectDir, "src");
1488
- const authFilePath = import_path11.default.join(srcPath, "lib", "auth.ts");
1489
- if (!import_fs11.default.existsSync(authFilePath)) {
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"));
2024
+ const srcPath = import_path15.default.join(projectDir, "src");
2025
+ const authFilePath = import_path15.default.join(srcPath, "lib", "auth.ts");
2026
+ if (!import_fs15.default.existsSync(authFilePath)) {
2027
+ console.log(import_chalk15.default.red("No Configured Better Auth file found"));
2028
+ console.log(import_chalk15.default.cyan("Run authverse init to initialize better auth"));
1492
2029
  return;
1493
2030
  }
1494
- let content = import_fs11.default.readFileSync(authFilePath, "utf8");
2031
+ let content = import_fs15.default.readFileSync(authFilePath, "utf8");
1495
2032
  if (!content.includes("betterAuth({")) {
1496
- console.log(import_chalk11.default.red("betterAuth({}) block not found"));
2033
+ console.log(import_chalk15.default.red("betterAuth({}) block not found"));
1497
2034
  return;
1498
2035
  }
1499
2036
  if (content.includes("socialProviders") && content.includes("github:")) {
1500
- console.log(import_chalk11.default.yellow("Github provider already exists"));
2037
+ console.log(import_chalk15.default.yellow("Github provider already exists"));
1501
2038
  return;
1502
2039
  }
1503
2040
  const githubProviderEntry = `
@@ -1520,7 +2057,7 @@ var githubTanstackStart = async () => {
1520
2057
  }
1521
2058
  }
1522
2059
  if (insertPos === -1) {
1523
- console.log(import_chalk11.default.red("Failed to parse socialProviders block"));
2060
+ console.log(import_chalk15.default.red("Failed to parse socialProviders block"));
1524
2061
  return;
1525
2062
  }
1526
2063
  content = content.slice(0, insertPos) + githubProviderEntry + "\n " + content.slice(insertPos);
@@ -1528,7 +2065,7 @@ var githubTanstackStart = async () => {
1528
2065
  const databaseRegex = /database:\s*(prismaAdapter|drizzleAdapter)\([\s\S]*?\),/;
1529
2066
  if (!databaseRegex.test(content)) {
1530
2067
  console.log(
1531
- import_chalk11.default.red(
2068
+ import_chalk15.default.red(
1532
2069
  "Could not find database adapter (prismaAdapter or drizzleAdapter)"
1533
2070
  )
1534
2071
  );
@@ -1544,12 +2081,12 @@ ${githubProviderEntry}
1544
2081
  ${socialProvidersBlock}`
1545
2082
  );
1546
2083
  }
1547
- import_fs11.default.writeFileSync(authFilePath, content, "utf8");
1548
- const envPath = import_path11.default.join(projectDir, ".env");
1549
- if (import_fs11.default.existsSync(envPath)) {
1550
- const envContent = import_fs11.default.readFileSync(envPath, "utf8");
2084
+ import_fs15.default.writeFileSync(authFilePath, content, "utf8");
2085
+ const envPath = import_path15.default.join(projectDir, ".env");
2086
+ if (import_fs15.default.existsSync(envPath)) {
2087
+ const envContent = import_fs15.default.readFileSync(envPath, "utf8");
1551
2088
  if (!envContent.includes("GITHUB_CLIENT_ID")) {
1552
- import_fs11.default.appendFileSync(
2089
+ import_fs15.default.appendFileSync(
1553
2090
  envPath,
1554
2091
  `
1555
2092
 
@@ -1560,53 +2097,53 @@ GITHUB_CLIENT_SECRET=
1560
2097
  );
1561
2098
  }
1562
2099
  }
1563
- const componentTemplate = import_path11.default.resolve(
2100
+ const componentTemplate = import_path15.default.resolve(
1564
2101
  __dirname,
1565
2102
  "./template/TanstackStart/components/GithubOAuthButton.tsx"
1566
2103
  );
1567
- const componentsDir = import_path11.default.join(srcPath, "components", "authverse");
1568
- if (!import_fs11.default.existsSync(componentsDir)) {
1569
- import_fs11.default.mkdirSync(componentsDir, { recursive: true });
2104
+ const componentsDir = import_path15.default.join(srcPath, "components", "authverse");
2105
+ if (!import_fs15.default.existsSync(componentsDir)) {
2106
+ import_fs15.default.mkdirSync(componentsDir, { recursive: true });
1570
2107
  }
1571
- const componentDest = import_path11.default.join(componentsDir, "GithubOAuthButton.tsx");
1572
- if (import_fs11.default.existsSync(componentTemplate)) {
1573
- import_fs11.default.copyFileSync(componentTemplate, componentDest);
2108
+ const componentDest = import_path15.default.join(componentsDir, "GithubOAuthButton.tsx");
2109
+ if (import_fs15.default.existsSync(componentTemplate)) {
2110
+ import_fs15.default.copyFileSync(componentTemplate, componentDest);
1574
2111
  }
1575
- console.log(import_chalk11.default.green("Github provider added & merged successfully\n"));
2112
+ console.log(import_chalk15.default.green("Github provider added & merged successfully\n"));
1576
2113
  console.log(
1577
- import_chalk11.default.white("\u2022 src/components/authverse/GithubOAuthButton.tsx")
2114
+ import_chalk15.default.white("\u2022 src/components/authverse/GithubOAuthButton.tsx")
1578
2115
  );
1579
2116
  } catch (error) {
1580
- console.log(import_chalk11.default.red("githubRunTanstackState error:"), error);
2117
+ console.log(import_chalk15.default.red("githubRunTanstackState error:"), error);
1581
2118
  }
1582
2119
  };
1583
2120
 
1584
2121
  // oauth/facebookNext.ts
1585
- var import_chalk12 = __toESM(require("chalk"), 1);
1586
- var import_fs12 = __toESM(require("fs"), 1);
1587
- var import_path12 = __toESM(require("path"), 1);
1588
- var import_url11 = require("url");
1589
- var import_meta11 = {};
2122
+ var import_chalk16 = __toESM(require("chalk"), 1);
2123
+ var import_fs16 = __toESM(require("fs"), 1);
2124
+ var import_path16 = __toESM(require("path"), 1);
2125
+ var import_url13 = require("url");
2126
+ var import_meta13 = {};
1590
2127
  var facebookNext = async () => {
1591
2128
  try {
1592
- const __filename = (0, import_url11.fileURLToPath)(import_meta11.url);
1593
- const __dirname = import_path12.default.dirname(__filename);
2129
+ const __filename = (0, import_url13.fileURLToPath)(import_meta13.url);
2130
+ const __dirname = import_path16.default.dirname(__filename);
1594
2131
  const projectDir = process.cwd();
1595
- const srcPath = import_path12.default.join(projectDir, "src");
1596
- const folder = import_fs12.default.existsSync(srcPath) ? "src" : "";
1597
- const authFilePath = import_path12.default.join(projectDir, folder, "lib", "auth.ts");
1598
- if (!import_fs12.default.existsSync(authFilePath)) {
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"));
2132
+ const srcPath = import_path16.default.join(projectDir, "src");
2133
+ const folder = import_fs16.default.existsSync(srcPath) ? "src" : "";
2134
+ const authFilePath = import_path16.default.join(projectDir, folder, "lib", "auth.ts");
2135
+ if (!import_fs16.default.existsSync(authFilePath)) {
2136
+ console.log(import_chalk16.default.red("No Configured Better Auth file found"));
2137
+ console.log(import_chalk16.default.cyan("Run authverse init to initialize better auth"));
1601
2138
  return;
1602
2139
  }
1603
- let content = import_fs12.default.readFileSync(authFilePath, "utf8");
2140
+ let content = import_fs16.default.readFileSync(authFilePath, "utf8");
1604
2141
  if (!content.includes("betterAuth({")) {
1605
- console.log(import_chalk12.default.red("betterAuth({}) block not found"));
2142
+ console.log(import_chalk16.default.red("betterAuth({}) block not found"));
1606
2143
  return;
1607
2144
  }
1608
2145
  if (content.includes("socialProviders") && content.includes("facebook:")) {
1609
- console.log(import_chalk12.default.yellow("Facebook provider already exists"));
2146
+ console.log(import_chalk16.default.yellow("Facebook provider already exists"));
1610
2147
  return;
1611
2148
  }
1612
2149
  const facebookProviderEntry = `
@@ -1629,7 +2166,7 @@ var facebookNext = async () => {
1629
2166
  }
1630
2167
  }
1631
2168
  if (insertPos === -1) {
1632
- console.log(import_chalk12.default.red("Failed to parse socialProviders block"));
2169
+ console.log(import_chalk16.default.red("Failed to parse socialProviders block"));
1633
2170
  return;
1634
2171
  }
1635
2172
  content = content.slice(0, insertPos) + facebookProviderEntry + "\n " + content.slice(insertPos);
@@ -1637,7 +2174,7 @@ var facebookNext = async () => {
1637
2174
  const databaseRegex = /database:\s*(prismaAdapter|drizzleAdapter)\([\s\S]*?\),/;
1638
2175
  if (!databaseRegex.test(content)) {
1639
2176
  console.log(
1640
- import_chalk12.default.red(
2177
+ import_chalk16.default.red(
1641
2178
  "Could not find database adapter (prismaAdapter or drizzleAdapter)"
1642
2179
  )
1643
2180
  );
@@ -1653,12 +2190,12 @@ ${facebookProviderEntry}
1653
2190
  ${socialProvidersBlock}`
1654
2191
  );
1655
2192
  }
1656
- import_fs12.default.writeFileSync(authFilePath, content, "utf8");
1657
- const envPath = import_path12.default.join(projectDir, ".env");
1658
- if (import_fs12.default.existsSync(envPath)) {
1659
- const envContent = import_fs12.default.readFileSync(envPath, "utf8");
2193
+ import_fs16.default.writeFileSync(authFilePath, content, "utf8");
2194
+ const envPath = import_path16.default.join(projectDir, ".env");
2195
+ if (import_fs16.default.existsSync(envPath)) {
2196
+ const envContent = import_fs16.default.readFileSync(envPath, "utf8");
1660
2197
  if (!envContent.includes("FACEBOOK_CLIENT_ID")) {
1661
- import_fs12.default.appendFileSync(
2198
+ import_fs16.default.appendFileSync(
1662
2199
  envPath,
1663
2200
  `
1664
2201
 
@@ -1669,60 +2206,60 @@ FACEBOOK_CLIENT_SECRET=
1669
2206
  );
1670
2207
  }
1671
2208
  }
1672
- const componentTemplate = import_path12.default.resolve(
2209
+ const componentTemplate = import_path16.default.resolve(
1673
2210
  __dirname,
1674
2211
  "./template/components/FacebookOAuthButton.tsx"
1675
2212
  );
1676
- const componentsDir = import_path12.default.join(
2213
+ const componentsDir = import_path16.default.join(
1677
2214
  projectDir,
1678
2215
  folder,
1679
2216
  "components",
1680
2217
  "authverse"
1681
2218
  );
1682
- if (!import_fs12.default.existsSync(componentsDir)) {
1683
- import_fs12.default.mkdirSync(componentsDir, { recursive: true });
2219
+ if (!import_fs16.default.existsSync(componentsDir)) {
2220
+ import_fs16.default.mkdirSync(componentsDir, { recursive: true });
1684
2221
  }
1685
- const componentDest = import_path12.default.join(componentsDir, "FacebookOAuthButton.tsx");
1686
- if (import_fs12.default.existsSync(componentTemplate)) {
1687
- import_fs12.default.copyFileSync(componentTemplate, componentDest);
2222
+ const componentDest = import_path16.default.join(componentsDir, "FacebookOAuthButton.tsx");
2223
+ if (import_fs16.default.existsSync(componentTemplate)) {
2224
+ import_fs16.default.copyFileSync(componentTemplate, componentDest);
1688
2225
  }
1689
- console.log(import_chalk12.default.green("Facebook provider added & merged successfully\n"));
2226
+ console.log(import_chalk16.default.green("Facebook provider added & merged successfully\n"));
1690
2227
  console.log(
1691
- import_chalk12.default.white(
2228
+ import_chalk16.default.white(
1692
2229
  `${CreateFolder({ srcFolder: folder, destFolder: "components/authverse/FacebookOAuthButton.tsx" })}
1693
2230
  `
1694
2231
  )
1695
2232
  );
1696
2233
  } catch (error) {
1697
- console.log(import_chalk12.default.red("facebookRun error:"), error);
2234
+ console.log(import_chalk16.default.red("facebookRun error:"), error);
1698
2235
  }
1699
2236
  };
1700
2237
 
1701
2238
  // oauth/facebookTanstackStart.ts
1702
- var import_chalk13 = __toESM(require("chalk"), 1);
1703
- var import_fs13 = __toESM(require("fs"), 1);
1704
- var import_path13 = __toESM(require("path"), 1);
1705
- var import_url12 = require("url");
1706
- var import_meta12 = {};
2239
+ var import_chalk17 = __toESM(require("chalk"), 1);
2240
+ var import_fs17 = __toESM(require("fs"), 1);
2241
+ var import_path17 = __toESM(require("path"), 1);
2242
+ var import_url14 = require("url");
2243
+ var import_meta14 = {};
1707
2244
  var facebookTanstackStart = async () => {
1708
2245
  try {
1709
- const __filename = (0, import_url12.fileURLToPath)(import_meta12.url);
1710
- const __dirname = import_path13.default.dirname(__filename);
2246
+ const __filename = (0, import_url14.fileURLToPath)(import_meta14.url);
2247
+ const __dirname = import_path17.default.dirname(__filename);
1711
2248
  const projectDir = process.cwd();
1712
- const srcPath = import_path13.default.join(projectDir, "src");
1713
- const authFilePath = import_path13.default.join(srcPath, "lib", "auth.ts");
1714
- if (!import_fs13.default.existsSync(authFilePath)) {
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"));
2249
+ const srcPath = import_path17.default.join(projectDir, "src");
2250
+ const authFilePath = import_path17.default.join(srcPath, "lib", "auth.ts");
2251
+ if (!import_fs17.default.existsSync(authFilePath)) {
2252
+ console.log(import_chalk17.default.red("No Configured Better Auth file found"));
2253
+ console.log(import_chalk17.default.cyan("Run authverse init to initialize better auth"));
1717
2254
  return;
1718
2255
  }
1719
- let content = import_fs13.default.readFileSync(authFilePath, "utf8");
2256
+ let content = import_fs17.default.readFileSync(authFilePath, "utf8");
1720
2257
  if (!content.includes("betterAuth({")) {
1721
- console.log(import_chalk13.default.red("betterAuth({}) block not found"));
2258
+ console.log(import_chalk17.default.red("betterAuth({}) block not found"));
1722
2259
  return;
1723
2260
  }
1724
2261
  if (content.includes("socialProviders") && content.includes("facebook:")) {
1725
- console.log(import_chalk13.default.yellow("Facebook provider already exists"));
2262
+ console.log(import_chalk17.default.yellow("Facebook provider already exists"));
1726
2263
  return;
1727
2264
  }
1728
2265
  const facebookProviderEntry = `
@@ -1745,7 +2282,7 @@ var facebookTanstackStart = async () => {
1745
2282
  }
1746
2283
  }
1747
2284
  if (insertPos === -1) {
1748
- console.log(import_chalk13.default.red("Failed to parse socialProviders block"));
2285
+ console.log(import_chalk17.default.red("Failed to parse socialProviders block"));
1749
2286
  return;
1750
2287
  }
1751
2288
  content = content.slice(0, insertPos) + facebookProviderEntry + "\n " + content.slice(insertPos);
@@ -1753,7 +2290,7 @@ var facebookTanstackStart = async () => {
1753
2290
  const databaseRegex = /database:\s*(prismaAdapter|drizzleAdapter)\([\s\S]*?\),/;
1754
2291
  if (!databaseRegex.test(content)) {
1755
2292
  console.log(
1756
- import_chalk13.default.red(
2293
+ import_chalk17.default.red(
1757
2294
  "Could not find database adapter (prismaAdapter or drizzleAdapter)"
1758
2295
  )
1759
2296
  );
@@ -1769,12 +2306,12 @@ ${facebookProviderEntry}
1769
2306
  ${socialProvidersBlock}`
1770
2307
  );
1771
2308
  }
1772
- import_fs13.default.writeFileSync(authFilePath, content, "utf8");
1773
- const envPath = import_path13.default.join(projectDir, ".env");
1774
- if (import_fs13.default.existsSync(envPath)) {
1775
- const envContent = import_fs13.default.readFileSync(envPath, "utf8");
2309
+ import_fs17.default.writeFileSync(authFilePath, content, "utf8");
2310
+ const envPath = import_path17.default.join(projectDir, ".env");
2311
+ if (import_fs17.default.existsSync(envPath)) {
2312
+ const envContent = import_fs17.default.readFileSync(envPath, "utf8");
1776
2313
  if (!envContent.includes("FACEBOOK_CLIENT_ID")) {
1777
- import_fs13.default.appendFileSync(
2314
+ import_fs17.default.appendFileSync(
1778
2315
  envPath,
1779
2316
  `
1780
2317
 
@@ -1785,53 +2322,53 @@ FACEBOOK_CLIENT_SECRET=
1785
2322
  );
1786
2323
  }
1787
2324
  }
1788
- const componentTemplate = import_path13.default.resolve(
2325
+ const componentTemplate = import_path17.default.resolve(
1789
2326
  __dirname,
1790
2327
  "./template/TanstackStart/components/FacebookOAuthButton.tsx"
1791
2328
  );
1792
- const componentsDir = import_path13.default.join(srcPath, "components", "authverse");
1793
- if (!import_fs13.default.existsSync(componentsDir)) {
1794
- import_fs13.default.mkdirSync(componentsDir, { recursive: true });
2329
+ const componentsDir = import_path17.default.join(srcPath, "components", "authverse");
2330
+ if (!import_fs17.default.existsSync(componentsDir)) {
2331
+ import_fs17.default.mkdirSync(componentsDir, { recursive: true });
1795
2332
  }
1796
- const componentDest = import_path13.default.join(componentsDir, "FacebookOAuthButton.tsx");
1797
- if (import_fs13.default.existsSync(componentTemplate)) {
1798
- import_fs13.default.copyFileSync(componentTemplate, componentDest);
2333
+ const componentDest = import_path17.default.join(componentsDir, "FacebookOAuthButton.tsx");
2334
+ if (import_fs17.default.existsSync(componentTemplate)) {
2335
+ import_fs17.default.copyFileSync(componentTemplate, componentDest);
1799
2336
  }
1800
- console.log(import_chalk13.default.green("Facebook provider added & merged successfully\n"));
2337
+ console.log(import_chalk17.default.green("Facebook provider added & merged successfully\n"));
1801
2338
  console.log(
1802
- import_chalk13.default.white("\u2022 src/components/authverse/FacebookOAuthButton.tsx")
2339
+ import_chalk17.default.white("\u2022 src/components/authverse/FacebookOAuthButton.tsx")
1803
2340
  );
1804
2341
  } catch (error) {
1805
- console.log(import_chalk13.default.red("facebookRunTanstackState error:"), error);
2342
+ console.log(import_chalk17.default.red("facebookRunTanstackState error:"), error);
1806
2343
  }
1807
2344
  };
1808
2345
 
1809
2346
  // oauth/LinkedInNext.ts
1810
- var import_chalk14 = __toESM(require("chalk"), 1);
1811
- var import_fs14 = __toESM(require("fs"), 1);
1812
- var import_path14 = __toESM(require("path"), 1);
1813
- var import_url13 = require("url");
1814
- var import_meta13 = {};
2347
+ var import_chalk18 = __toESM(require("chalk"), 1);
2348
+ var import_fs18 = __toESM(require("fs"), 1);
2349
+ var import_path18 = __toESM(require("path"), 1);
2350
+ var import_url15 = require("url");
2351
+ var import_meta15 = {};
1815
2352
  var LinkedInNext = async () => {
1816
2353
  try {
1817
- const __filename = (0, import_url13.fileURLToPath)(import_meta13.url);
1818
- const __dirname = import_path14.default.dirname(__filename);
2354
+ const __filename = (0, import_url15.fileURLToPath)(import_meta15.url);
2355
+ const __dirname = import_path18.default.dirname(__filename);
1819
2356
  const projectDir = process.cwd();
1820
- const srcPath = import_path14.default.join(projectDir, "src");
1821
- const folder = import_fs14.default.existsSync(srcPath) ? "src" : "";
1822
- const authFilePath = import_path14.default.join(projectDir, folder, "lib", "auth.ts");
1823
- if (!import_fs14.default.existsSync(authFilePath)) {
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"));
2357
+ const srcPath = import_path18.default.join(projectDir, "src");
2358
+ const folder = import_fs18.default.existsSync(srcPath) ? "src" : "";
2359
+ const authFilePath = import_path18.default.join(projectDir, folder, "lib", "auth.ts");
2360
+ if (!import_fs18.default.existsSync(authFilePath)) {
2361
+ console.log(import_chalk18.default.red("No Configured Better Auth file found"));
2362
+ console.log(import_chalk18.default.cyan("Run authverse init to initialize better auth"));
1826
2363
  return;
1827
2364
  }
1828
- let content = import_fs14.default.readFileSync(authFilePath, "utf8");
2365
+ let content = import_fs18.default.readFileSync(authFilePath, "utf8");
1829
2366
  if (!content.includes("betterAuth({")) {
1830
- console.log(import_chalk14.default.red("betterAuth({}) block not found"));
2367
+ console.log(import_chalk18.default.red("betterAuth({}) block not found"));
1831
2368
  return;
1832
2369
  }
1833
2370
  if (content.includes("socialProviders") && content.includes("LinkedIn:")) {
1834
- console.log(import_chalk14.default.yellow("LinkedIn provider already exists"));
2371
+ console.log(import_chalk18.default.yellow("LinkedIn provider already exists"));
1835
2372
  return;
1836
2373
  }
1837
2374
  const LinkedInProviderEntry = `
@@ -1854,7 +2391,7 @@ var LinkedInNext = async () => {
1854
2391
  }
1855
2392
  }
1856
2393
  if (insertPos === -1) {
1857
- console.log(import_chalk14.default.red("Failed to parse socialProviders block"));
2394
+ console.log(import_chalk18.default.red("Failed to parse socialProviders block"));
1858
2395
  return;
1859
2396
  }
1860
2397
  content = content.slice(0, insertPos) + LinkedInProviderEntry + "\n " + content.slice(insertPos);
@@ -1862,7 +2399,7 @@ var LinkedInNext = async () => {
1862
2399
  const databaseRegex = /database:\s*(prismaAdapter|drizzleAdapter)\([\s\S]*?\),/;
1863
2400
  if (!databaseRegex.test(content)) {
1864
2401
  console.log(
1865
- import_chalk14.default.red(
2402
+ import_chalk18.default.red(
1866
2403
  "Could not find database adapter (prismaAdapter or drizzleAdapter)"
1867
2404
  )
1868
2405
  );
@@ -1878,12 +2415,12 @@ ${LinkedInProviderEntry}
1878
2415
  ${socialProvidersBlock}`
1879
2416
  );
1880
2417
  }
1881
- import_fs14.default.writeFileSync(authFilePath, content, "utf8");
1882
- const envPath = import_path14.default.join(projectDir, ".env");
1883
- if (import_fs14.default.existsSync(envPath)) {
1884
- const envContent = import_fs14.default.readFileSync(envPath, "utf8");
2418
+ import_fs18.default.writeFileSync(authFilePath, content, "utf8");
2419
+ const envPath = import_path18.default.join(projectDir, ".env");
2420
+ if (import_fs18.default.existsSync(envPath)) {
2421
+ const envContent = import_fs18.default.readFileSync(envPath, "utf8");
1885
2422
  if (!envContent.includes("LINKEDIN_CLIENT_ID")) {
1886
- import_fs14.default.appendFileSync(
2423
+ import_fs18.default.appendFileSync(
1887
2424
  envPath,
1888
2425
  `
1889
2426
 
@@ -1894,60 +2431,60 @@ LINKEDIN_CLIENT_SECRET=
1894
2431
  );
1895
2432
  }
1896
2433
  }
1897
- const componentTemplate = import_path14.default.resolve(
2434
+ const componentTemplate = import_path18.default.resolve(
1898
2435
  __dirname,
1899
2436
  "./template/components/LinkedInOAuthButton.tsx"
1900
2437
  );
1901
- const componentsDir = import_path14.default.join(
2438
+ const componentsDir = import_path18.default.join(
1902
2439
  projectDir,
1903
2440
  folder,
1904
2441
  "components",
1905
2442
  "authverse"
1906
2443
  );
1907
- if (!import_fs14.default.existsSync(componentsDir)) {
1908
- import_fs14.default.mkdirSync(componentsDir, { recursive: true });
2444
+ if (!import_fs18.default.existsSync(componentsDir)) {
2445
+ import_fs18.default.mkdirSync(componentsDir, { recursive: true });
1909
2446
  }
1910
- const componentDest = import_path14.default.join(componentsDir, "LinkedInOAuthButton.tsx");
1911
- if (import_fs14.default.existsSync(componentTemplate)) {
1912
- import_fs14.default.copyFileSync(componentTemplate, componentDest);
2447
+ const componentDest = import_path18.default.join(componentsDir, "LinkedInOAuthButton.tsx");
2448
+ if (import_fs18.default.existsSync(componentTemplate)) {
2449
+ import_fs18.default.copyFileSync(componentTemplate, componentDest);
1913
2450
  }
1914
- console.log(import_chalk14.default.green("LinkedIn provider added & merged successfully\n"));
2451
+ console.log(import_chalk18.default.green("LinkedIn provider added & merged successfully\n"));
1915
2452
  console.log(
1916
- import_chalk14.default.white(
2453
+ import_chalk18.default.white(
1917
2454
  `${CreateFolder({ srcFolder: folder, destFolder: "components/authverse/LinkedInOAuthButton.tsx" })}
1918
2455
  `
1919
2456
  )
1920
2457
  );
1921
2458
  } catch (error) {
1922
- console.log(import_chalk14.default.red("LinkedIn error:"), error);
2459
+ console.log(import_chalk18.default.red("LinkedIn error:"), error);
1923
2460
  }
1924
2461
  };
1925
2462
 
1926
2463
  // oauth/LinkedInTanstackStart.ts
1927
- var import_chalk15 = __toESM(require("chalk"), 1);
1928
- var import_fs15 = __toESM(require("fs"), 1);
1929
- var import_path15 = __toESM(require("path"), 1);
1930
- var import_url14 = require("url");
1931
- var import_meta14 = {};
2464
+ var import_chalk19 = __toESM(require("chalk"), 1);
2465
+ var import_fs19 = __toESM(require("fs"), 1);
2466
+ var import_path19 = __toESM(require("path"), 1);
2467
+ var import_url16 = require("url");
2468
+ var import_meta16 = {};
1932
2469
  var LinkedInTanstackStart = async () => {
1933
2470
  try {
1934
- const __filename = (0, import_url14.fileURLToPath)(import_meta14.url);
1935
- const __dirname = import_path15.default.dirname(__filename);
2471
+ const __filename = (0, import_url16.fileURLToPath)(import_meta16.url);
2472
+ const __dirname = import_path19.default.dirname(__filename);
1936
2473
  const projectDir = process.cwd();
1937
- const srcPath = import_path15.default.join(projectDir, "src");
1938
- const authFilePath = import_path15.default.join(srcPath, "lib", "auth.ts");
1939
- if (!import_fs15.default.existsSync(authFilePath)) {
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"));
2474
+ const srcPath = import_path19.default.join(projectDir, "src");
2475
+ const authFilePath = import_path19.default.join(srcPath, "lib", "auth.ts");
2476
+ if (!import_fs19.default.existsSync(authFilePath)) {
2477
+ console.log(import_chalk19.default.red("No Configured Better Auth file found"));
2478
+ console.log(import_chalk19.default.cyan("Run authverse init to initialize better auth"));
1942
2479
  return;
1943
2480
  }
1944
- let content = import_fs15.default.readFileSync(authFilePath, "utf8");
2481
+ let content = import_fs19.default.readFileSync(authFilePath, "utf8");
1945
2482
  if (!content.includes("betterAuth({")) {
1946
- console.log(import_chalk15.default.red("betterAuth({}) block not found"));
2483
+ console.log(import_chalk19.default.red("betterAuth({}) block not found"));
1947
2484
  return;
1948
2485
  }
1949
2486
  if (content.includes("socialProviders") && content.includes("linkedin:")) {
1950
- console.log(import_chalk15.default.yellow("LinkedIn provider already exists"));
2487
+ console.log(import_chalk19.default.yellow("LinkedIn provider already exists"));
1951
2488
  return;
1952
2489
  }
1953
2490
  const LinkedInProviderEntry = `
@@ -1970,7 +2507,7 @@ var LinkedInTanstackStart = async () => {
1970
2507
  }
1971
2508
  }
1972
2509
  if (insertPos === -1) {
1973
- console.log(import_chalk15.default.red("Failed to parse socialProviders block"));
2510
+ console.log(import_chalk19.default.red("Failed to parse socialProviders block"));
1974
2511
  return;
1975
2512
  }
1976
2513
  content = content.slice(0, insertPos) + LinkedInProviderEntry + "\n " + content.slice(insertPos);
@@ -1978,7 +2515,7 @@ var LinkedInTanstackStart = async () => {
1978
2515
  const databaseRegex = /database:\s*(prismaAdapter|drizzleAdapter)\([\s\S]*?\),/;
1979
2516
  if (!databaseRegex.test(content)) {
1980
2517
  console.log(
1981
- import_chalk15.default.red(
2518
+ import_chalk19.default.red(
1982
2519
  "Could not find database adapter (prismaAdapter or drizzleAdapter)"
1983
2520
  )
1984
2521
  );
@@ -1994,12 +2531,12 @@ ${LinkedInProviderEntry}
1994
2531
  ${socialProvidersBlock}`
1995
2532
  );
1996
2533
  }
1997
- import_fs15.default.writeFileSync(authFilePath, content, "utf8");
1998
- const envPath = import_path15.default.join(projectDir, ".env");
1999
- if (import_fs15.default.existsSync(envPath)) {
2000
- const envContent = import_fs15.default.readFileSync(envPath, "utf8");
2534
+ import_fs19.default.writeFileSync(authFilePath, content, "utf8");
2535
+ const envPath = import_path19.default.join(projectDir, ".env");
2536
+ if (import_fs19.default.existsSync(envPath)) {
2537
+ const envContent = import_fs19.default.readFileSync(envPath, "utf8");
2001
2538
  if (!envContent.includes("LINKEDIN_CLIENT_ID")) {
2002
- import_fs15.default.appendFileSync(
2539
+ import_fs19.default.appendFileSync(
2003
2540
  envPath,
2004
2541
  `
2005
2542
 
@@ -2010,53 +2547,53 @@ LINKEDIN_CLIENT_SECRET=
2010
2547
  );
2011
2548
  }
2012
2549
  }
2013
- const componentTemplate = import_path15.default.resolve(
2550
+ const componentTemplate = import_path19.default.resolve(
2014
2551
  __dirname,
2015
2552
  "./template/TanstackStart/components/LinkedInOAuthButton.tsx"
2016
2553
  );
2017
- const componentsDir = import_path15.default.join(srcPath, "components", "authverse");
2018
- if (!import_fs15.default.existsSync(componentsDir)) {
2019
- import_fs15.default.mkdirSync(componentsDir, { recursive: true });
2554
+ const componentsDir = import_path19.default.join(srcPath, "components", "authverse");
2555
+ if (!import_fs19.default.existsSync(componentsDir)) {
2556
+ import_fs19.default.mkdirSync(componentsDir, { recursive: true });
2020
2557
  }
2021
- const componentDest = import_path15.default.join(componentsDir, "LinkedInOAuthButton.tsx");
2022
- if (import_fs15.default.existsSync(componentTemplate)) {
2023
- import_fs15.default.copyFileSync(componentTemplate, componentDest);
2558
+ const componentDest = import_path19.default.join(componentsDir, "LinkedInOAuthButton.tsx");
2559
+ if (import_fs19.default.existsSync(componentTemplate)) {
2560
+ import_fs19.default.copyFileSync(componentTemplate, componentDest);
2024
2561
  }
2025
- console.log(import_chalk15.default.green("LinkedIn provider added & merged successfully\n"));
2562
+ console.log(import_chalk19.default.green("LinkedIn provider added & merged successfully\n"));
2026
2563
  console.log(
2027
- import_chalk15.default.white("\u2022 src/components/authverse/LinkedInOAuthButton.tsx")
2564
+ import_chalk19.default.white("\u2022 src/components/authverse/LinkedInOAuthButton.tsx")
2028
2565
  );
2029
2566
  } catch (error) {
2030
- console.log(import_chalk15.default.red("LinkedInTanstackState error:"), error);
2567
+ console.log(import_chalk19.default.red("LinkedInTanstackState error:"), error);
2031
2568
  }
2032
2569
  };
2033
2570
 
2034
2571
  // oauth/twitterNext.ts
2035
- var import_chalk16 = __toESM(require("chalk"), 1);
2036
- var import_fs16 = __toESM(require("fs"), 1);
2037
- var import_path16 = __toESM(require("path"), 1);
2038
- var import_url15 = require("url");
2039
- var import_meta15 = {};
2572
+ var import_chalk20 = __toESM(require("chalk"), 1);
2573
+ var import_fs20 = __toESM(require("fs"), 1);
2574
+ var import_path20 = __toESM(require("path"), 1);
2575
+ var import_url17 = require("url");
2576
+ var import_meta17 = {};
2040
2577
  var twitterNext = async () => {
2041
2578
  try {
2042
- const __filename = (0, import_url15.fileURLToPath)(import_meta15.url);
2043
- const __dirname = import_path16.default.dirname(__filename);
2579
+ const __filename = (0, import_url17.fileURLToPath)(import_meta17.url);
2580
+ const __dirname = import_path20.default.dirname(__filename);
2044
2581
  const projectDir = process.cwd();
2045
- const srcPath = import_path16.default.join(projectDir, "src");
2046
- const folder = import_fs16.default.existsSync(srcPath) ? "src" : "";
2047
- const authFilePath = import_path16.default.join(projectDir, folder, "lib", "auth.ts");
2048
- if (!import_fs16.default.existsSync(authFilePath)) {
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"));
2582
+ const srcPath = import_path20.default.join(projectDir, "src");
2583
+ const folder = import_fs20.default.existsSync(srcPath) ? "src" : "";
2584
+ const authFilePath = import_path20.default.join(projectDir, folder, "lib", "auth.ts");
2585
+ if (!import_fs20.default.existsSync(authFilePath)) {
2586
+ console.log(import_chalk20.default.red("No Configured Better Auth file found"));
2587
+ console.log(import_chalk20.default.cyan("Run authverse init to initialize better auth"));
2051
2588
  return;
2052
2589
  }
2053
- let content = import_fs16.default.readFileSync(authFilePath, "utf8");
2590
+ let content = import_fs20.default.readFileSync(authFilePath, "utf8");
2054
2591
  if (!content.includes("betterAuth({")) {
2055
- console.log(import_chalk16.default.red("betterAuth({}) block not found"));
2592
+ console.log(import_chalk20.default.red("betterAuth({}) block not found"));
2056
2593
  return;
2057
2594
  }
2058
2595
  if (content.includes("socialProviders") && content.includes("twitter:")) {
2059
- console.log(import_chalk16.default.yellow("twitter provider already exists"));
2596
+ console.log(import_chalk20.default.yellow("twitter provider already exists"));
2060
2597
  return;
2061
2598
  }
2062
2599
  const twitterProviderEntry = `
@@ -2079,7 +2616,7 @@ var twitterNext = async () => {
2079
2616
  }
2080
2617
  }
2081
2618
  if (insertPos === -1) {
2082
- console.log(import_chalk16.default.red("Failed to parse socialProviders block"));
2619
+ console.log(import_chalk20.default.red("Failed to parse socialProviders block"));
2083
2620
  return;
2084
2621
  }
2085
2622
  content = content.slice(0, insertPos) + twitterProviderEntry + "\n " + content.slice(insertPos);
@@ -2087,7 +2624,7 @@ var twitterNext = async () => {
2087
2624
  const databaseRegex = /database:\s*(prismaAdapter|drizzleAdapter)\([\s\S]*?\),/;
2088
2625
  if (!databaseRegex.test(content)) {
2089
2626
  console.log(
2090
- import_chalk16.default.red(
2627
+ import_chalk20.default.red(
2091
2628
  "Could not find database adapter (prismaAdapter or drizzleAdapter)"
2092
2629
  )
2093
2630
  );
@@ -2103,12 +2640,12 @@ ${twitterProviderEntry}
2103
2640
  ${socialProvidersBlock}`
2104
2641
  );
2105
2642
  }
2106
- import_fs16.default.writeFileSync(authFilePath, content, "utf8");
2107
- const envPath = import_path16.default.join(projectDir, ".env");
2108
- if (import_fs16.default.existsSync(envPath)) {
2109
- const envContent = import_fs16.default.readFileSync(envPath, "utf8");
2643
+ import_fs20.default.writeFileSync(authFilePath, content, "utf8");
2644
+ const envPath = import_path20.default.join(projectDir, ".env");
2645
+ if (import_fs20.default.existsSync(envPath)) {
2646
+ const envContent = import_fs20.default.readFileSync(envPath, "utf8");
2110
2647
  if (!envContent.includes("TWITTER_CLIENT_ID")) {
2111
- import_fs16.default.appendFileSync(
2648
+ import_fs20.default.appendFileSync(
2112
2649
  envPath,
2113
2650
  `
2114
2651
 
@@ -2119,60 +2656,60 @@ TWITTER_CLIENT_SECRET=
2119
2656
  );
2120
2657
  }
2121
2658
  }
2122
- const componentTemplate = import_path16.default.resolve(
2659
+ const componentTemplate = import_path20.default.resolve(
2123
2660
  __dirname,
2124
2661
  "./template/components/twitterOAuthButton.tsx"
2125
2662
  );
2126
- const componentsDir = import_path16.default.join(
2663
+ const componentsDir = import_path20.default.join(
2127
2664
  projectDir,
2128
2665
  folder,
2129
2666
  "components",
2130
2667
  "authverse"
2131
2668
  );
2132
- if (!import_fs16.default.existsSync(componentsDir)) {
2133
- import_fs16.default.mkdirSync(componentsDir, { recursive: true });
2669
+ if (!import_fs20.default.existsSync(componentsDir)) {
2670
+ import_fs20.default.mkdirSync(componentsDir, { recursive: true });
2134
2671
  }
2135
- const componentDest = import_path16.default.join(componentsDir, "twitterOAuthButton.tsx");
2136
- if (import_fs16.default.existsSync(componentTemplate)) {
2137
- import_fs16.default.copyFileSync(componentTemplate, componentDest);
2672
+ const componentDest = import_path20.default.join(componentsDir, "twitterOAuthButton.tsx");
2673
+ if (import_fs20.default.existsSync(componentTemplate)) {
2674
+ import_fs20.default.copyFileSync(componentTemplate, componentDest);
2138
2675
  }
2139
- console.log(import_chalk16.default.green("Twitter provider added & merged successfully\n"));
2676
+ console.log(import_chalk20.default.green("Twitter provider added & merged successfully\n"));
2140
2677
  console.log(
2141
- import_chalk16.default.white(
2678
+ import_chalk20.default.white(
2142
2679
  `${CreateFolder({ srcFolder: folder, destFolder: "components/authverse/TwitterOAuthButton.tsx" })}
2143
2680
  `
2144
2681
  )
2145
2682
  );
2146
2683
  } catch (error) {
2147
- console.log(import_chalk16.default.red("twitter error:"), error);
2684
+ console.log(import_chalk20.default.red("twitter error:"), error);
2148
2685
  }
2149
2686
  };
2150
2687
 
2151
2688
  // oauth/twitterTanstackStart.ts
2152
- var import_chalk17 = __toESM(require("chalk"), 1);
2153
- var import_fs17 = __toESM(require("fs"), 1);
2154
- var import_path17 = __toESM(require("path"), 1);
2155
- var import_url16 = require("url");
2156
- var import_meta16 = {};
2689
+ var import_chalk21 = __toESM(require("chalk"), 1);
2690
+ var import_fs21 = __toESM(require("fs"), 1);
2691
+ var import_path21 = __toESM(require("path"), 1);
2692
+ var import_url18 = require("url");
2693
+ var import_meta18 = {};
2157
2694
  var twitterTanstackStart = async () => {
2158
2695
  try {
2159
- const __filename = (0, import_url16.fileURLToPath)(import_meta16.url);
2160
- const __dirname = import_path17.default.dirname(__filename);
2696
+ const __filename = (0, import_url18.fileURLToPath)(import_meta18.url);
2697
+ const __dirname = import_path21.default.dirname(__filename);
2161
2698
  const projectDir = process.cwd();
2162
- const srcPath = import_path17.default.join(projectDir, "src");
2163
- const authFilePath = import_path17.default.join(srcPath, "lib", "auth.ts");
2164
- if (!import_fs17.default.existsSync(authFilePath)) {
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"));
2699
+ const srcPath = import_path21.default.join(projectDir, "src");
2700
+ const authFilePath = import_path21.default.join(srcPath, "lib", "auth.ts");
2701
+ if (!import_fs21.default.existsSync(authFilePath)) {
2702
+ console.log(import_chalk21.default.red("No Configured Better Auth file found"));
2703
+ console.log(import_chalk21.default.cyan("Run authverse init to initialize better auth"));
2167
2704
  return;
2168
2705
  }
2169
- let content = import_fs17.default.readFileSync(authFilePath, "utf8");
2706
+ let content = import_fs21.default.readFileSync(authFilePath, "utf8");
2170
2707
  if (!content.includes("betterAuth({")) {
2171
- console.log(import_chalk17.default.red("betterAuth({}) block not found"));
2708
+ console.log(import_chalk21.default.red("betterAuth({}) block not found"));
2172
2709
  return;
2173
2710
  }
2174
2711
  if (content.includes("socialProviders") && content.includes("twitter:")) {
2175
- console.log(import_chalk17.default.yellow("twitter provider already exists"));
2712
+ console.log(import_chalk21.default.yellow("twitter provider already exists"));
2176
2713
  return;
2177
2714
  }
2178
2715
  const twitterProviderEntry = `
@@ -2195,7 +2732,7 @@ var twitterTanstackStart = async () => {
2195
2732
  }
2196
2733
  }
2197
2734
  if (insertPos === -1) {
2198
- console.log(import_chalk17.default.red("Failed to parse socialProviders block"));
2735
+ console.log(import_chalk21.default.red("Failed to parse socialProviders block"));
2199
2736
  return;
2200
2737
  }
2201
2738
  content = content.slice(0, insertPos) + twitterProviderEntry + "\n " + content.slice(insertPos);
@@ -2203,7 +2740,7 @@ var twitterTanstackStart = async () => {
2203
2740
  const databaseRegex = /database:\s*(prismaAdapter|drizzleAdapter)\([\s\S]*?\),/;
2204
2741
  if (!databaseRegex.test(content)) {
2205
2742
  console.log(
2206
- import_chalk17.default.red(
2743
+ import_chalk21.default.red(
2207
2744
  "Could not find database adapter (prismaAdapter or drizzleAdapter)"
2208
2745
  )
2209
2746
  );
@@ -2219,12 +2756,12 @@ ${twitterProviderEntry}
2219
2756
  ${socialProvidersBlock}`
2220
2757
  );
2221
2758
  }
2222
- import_fs17.default.writeFileSync(authFilePath, content, "utf8");
2223
- const envPath = import_path17.default.join(projectDir, ".env");
2224
- if (import_fs17.default.existsSync(envPath)) {
2225
- const envContent = import_fs17.default.readFileSync(envPath, "utf8");
2759
+ import_fs21.default.writeFileSync(authFilePath, content, "utf8");
2760
+ const envPath = import_path21.default.join(projectDir, ".env");
2761
+ if (import_fs21.default.existsSync(envPath)) {
2762
+ const envContent = import_fs21.default.readFileSync(envPath, "utf8");
2226
2763
  if (!envContent.includes("TWITTER_CLIENT_ID")) {
2227
- import_fs17.default.appendFileSync(
2764
+ import_fs21.default.appendFileSync(
2228
2765
  envPath,
2229
2766
  `
2230
2767
 
@@ -2235,54 +2772,54 @@ TWITTER_CLIENT_SECRET=
2235
2772
  );
2236
2773
  }
2237
2774
  }
2238
- const componentTemplate = import_path17.default.resolve(
2775
+ const componentTemplate = import_path21.default.resolve(
2239
2776
  __dirname,
2240
2777
  "./template/TanstackStart/components/twitterOAuthButton.tsx"
2241
2778
  );
2242
- const componentsDir = import_path17.default.join(srcPath, "components", "authverse");
2243
- if (!import_fs17.default.existsSync(componentsDir)) {
2244
- import_fs17.default.mkdirSync(componentsDir, { recursive: true });
2779
+ const componentsDir = import_path21.default.join(srcPath, "components", "authverse");
2780
+ if (!import_fs21.default.existsSync(componentsDir)) {
2781
+ import_fs21.default.mkdirSync(componentsDir, { recursive: true });
2245
2782
  }
2246
- const componentDest = import_path17.default.join(componentsDir, "twitterOAuthButton.tsx");
2247
- if (import_fs17.default.existsSync(componentTemplate)) {
2248
- import_fs17.default.copyFileSync(componentTemplate, componentDest);
2783
+ const componentDest = import_path21.default.join(componentsDir, "twitterOAuthButton.tsx");
2784
+ if (import_fs21.default.existsSync(componentTemplate)) {
2785
+ import_fs21.default.copyFileSync(componentTemplate, componentDest);
2249
2786
  }
2250
- console.log(import_chalk17.default.green("twitter provider added & merged successfully\n"));
2787
+ console.log(import_chalk21.default.green("twitter provider added & merged successfully\n"));
2251
2788
  console.log(
2252
- import_chalk17.default.white("\u2022 src/components/authverse/twitterOAuthButton.tsx")
2789
+ import_chalk21.default.white("\u2022 src/components/authverse/twitterOAuthButton.tsx")
2253
2790
  );
2254
2791
  } catch (error) {
2255
- console.log(import_chalk17.default.red("twitter tanstack state error:"), error);
2792
+ console.log(import_chalk21.default.red("twitter tanstack state error:"), error);
2256
2793
  }
2257
2794
  };
2258
2795
 
2259
2796
  // oauth/AppleNext.ts
2260
- var import_chalk18 = __toESM(require("chalk"), 1);
2261
- var import_fs18 = __toESM(require("fs"), 1);
2262
- var import_path18 = __toESM(require("path"), 1);
2263
- var import_url17 = require("url");
2264
- var import_meta17 = {};
2797
+ var import_chalk22 = __toESM(require("chalk"), 1);
2798
+ var import_fs22 = __toESM(require("fs"), 1);
2799
+ var import_path22 = __toESM(require("path"), 1);
2800
+ var import_url19 = require("url");
2801
+ var import_meta19 = {};
2265
2802
  var AppleNext = async () => {
2266
2803
  try {
2267
- const __filename = (0, import_url17.fileURLToPath)(import_meta17.url);
2268
- const __dirname = import_path18.default.dirname(__filename);
2804
+ const __filename = (0, import_url19.fileURLToPath)(import_meta19.url);
2805
+ const __dirname = import_path22.default.dirname(__filename);
2269
2806
  const projectDir = process.cwd();
2270
- const srcPath = import_path18.default.join(projectDir, "src");
2271
- const folder = import_fs18.default.existsSync(srcPath) ? "src" : "";
2272
- const authFilePath = import_path18.default.join(projectDir, folder, "lib", "auth.ts");
2273
- if (!import_fs18.default.existsSync(authFilePath)) {
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"));
2807
+ const srcPath = import_path22.default.join(projectDir, "src");
2808
+ const folder = import_fs22.default.existsSync(srcPath) ? "src" : "";
2809
+ const authFilePath = import_path22.default.join(projectDir, folder, "lib", "auth.ts");
2810
+ if (!import_fs22.default.existsSync(authFilePath)) {
2811
+ console.log(import_chalk22.default.red("No Configured Better Auth file found"));
2812
+ console.log(import_chalk22.default.cyan("Run authverse init to initialize better auth"));
2276
2813
  return;
2277
2814
  }
2278
- let content = import_fs18.default.readFileSync(authFilePath, "utf8");
2815
+ let content = import_fs22.default.readFileSync(authFilePath, "utf8");
2279
2816
  if (!content.includes("betterAuth({")) {
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"));
2817
+ console.log(import_chalk22.default.red("betterAuth({}) block not found"));
2818
+ console.log(import_chalk22.default.cyan("Run authverse init to initialize better auth"));
2282
2819
  return;
2283
2820
  }
2284
2821
  if (content.includes("socialProviders") && content.includes("apple:")) {
2285
- console.log(import_chalk18.default.yellow("Apple provider already exists"));
2822
+ console.log(import_chalk22.default.yellow("Apple provider already exists"));
2286
2823
  return;
2287
2824
  }
2288
2825
  const appleProviderEntry = `
@@ -2307,7 +2844,7 @@ var AppleNext = async () => {
2307
2844
  }
2308
2845
  }
2309
2846
  if (insertPos === -1) {
2310
- console.log(import_chalk18.default.red("Failed to parse socialProviders block"));
2847
+ console.log(import_chalk22.default.red("Failed to parse socialProviders block"));
2311
2848
  return;
2312
2849
  }
2313
2850
  content = content.slice(0, insertPos) + appleProviderEntry + "\n " + content.slice(insertPos);
@@ -2315,7 +2852,7 @@ var AppleNext = async () => {
2315
2852
  const databaseRegex = /database:\s*(prismaAdapter|drizzleAdapter)\([\s\S]*?\),/;
2316
2853
  if (!databaseRegex.test(content)) {
2317
2854
  console.log(
2318
- import_chalk18.default.red(
2855
+ import_chalk22.default.red(
2319
2856
  "Could not find database adapter (prismaAdapter or drizzleAdapter)"
2320
2857
  )
2321
2858
  );
@@ -2345,12 +2882,12 @@ ${socialProvidersBlock}`
2345
2882
  content = content.slice(0, insertPos) + '\n trustedOrigins: ["https://appleid.apple.com"],' + content.slice(insertPos);
2346
2883
  }
2347
2884
  }
2348
- import_fs18.default.writeFileSync(authFilePath, content, "utf8");
2349
- const envPath = import_path18.default.join(projectDir, ".env");
2350
- if (import_fs18.default.existsSync(envPath)) {
2351
- const envContent = import_fs18.default.readFileSync(envPath, "utf8");
2885
+ import_fs22.default.writeFileSync(authFilePath, content, "utf8");
2886
+ const envPath = import_path22.default.join(projectDir, ".env");
2887
+ if (import_fs22.default.existsSync(envPath)) {
2888
+ const envContent = import_fs22.default.readFileSync(envPath, "utf8");
2352
2889
  if (!envContent.includes("APPLE_CLIENT_ID")) {
2353
- import_fs18.default.appendFileSync(
2890
+ import_fs22.default.appendFileSync(
2354
2891
  envPath,
2355
2892
  `
2356
2893
 
@@ -2362,60 +2899,60 @@ APPLE_BUNDLE_ID=
2362
2899
  );
2363
2900
  }
2364
2901
  }
2365
- const componentTemplate = import_path18.default.resolve(
2902
+ const componentTemplate = import_path22.default.resolve(
2366
2903
  __dirname,
2367
2904
  "./template/components/AppleOAuthButton.tsx"
2368
2905
  );
2369
- const componentsDir = import_path18.default.join(
2906
+ const componentsDir = import_path22.default.join(
2370
2907
  projectDir,
2371
2908
  folder,
2372
2909
  "components",
2373
2910
  "authverse"
2374
2911
  );
2375
- if (!import_fs18.default.existsSync(componentsDir)) {
2376
- import_fs18.default.mkdirSync(componentsDir, { recursive: true });
2912
+ if (!import_fs22.default.existsSync(componentsDir)) {
2913
+ import_fs22.default.mkdirSync(componentsDir, { recursive: true });
2377
2914
  }
2378
- const componentDest = import_path18.default.join(componentsDir, "AppleOAuthButton.tsx");
2379
- if (import_fs18.default.existsSync(componentTemplate)) {
2380
- import_fs18.default.copyFileSync(componentTemplate, componentDest);
2915
+ const componentDest = import_path22.default.join(componentsDir, "AppleOAuthButton.tsx");
2916
+ if (import_fs22.default.existsSync(componentTemplate)) {
2917
+ import_fs22.default.copyFileSync(componentTemplate, componentDest);
2381
2918
  }
2382
- console.log(import_chalk18.default.green("Apple provider added & merged successfully\n"));
2919
+ console.log(import_chalk22.default.green("Apple provider added & merged successfully\n"));
2383
2920
  console.log(
2384
- import_chalk18.default.white(
2921
+ import_chalk22.default.white(
2385
2922
  `${CreateFolder({ srcFolder: folder, destFolder: "components/authverse/AppleOAuthButton.tsx" })}
2386
2923
  `
2387
2924
  )
2388
2925
  );
2389
2926
  } catch (error) {
2390
- console.log(import_chalk18.default.red("apple next error:"), error);
2927
+ console.log(import_chalk22.default.red("apple next error:"), error);
2391
2928
  }
2392
2929
  };
2393
2930
 
2394
2931
  // oauth/AppleTanstackStart.ts
2395
- var import_chalk19 = __toESM(require("chalk"), 1);
2396
- var import_fs19 = __toESM(require("fs"), 1);
2397
- var import_path19 = __toESM(require("path"), 1);
2398
- var import_url18 = require("url");
2399
- var import_meta18 = {};
2932
+ var import_chalk23 = __toESM(require("chalk"), 1);
2933
+ var import_fs23 = __toESM(require("fs"), 1);
2934
+ var import_path23 = __toESM(require("path"), 1);
2935
+ var import_url20 = require("url");
2936
+ var import_meta20 = {};
2400
2937
  var AppleTanstackStart = async () => {
2401
2938
  try {
2402
- const __filename = (0, import_url18.fileURLToPath)(import_meta18.url);
2403
- const __dirname = import_path19.default.dirname(__filename);
2939
+ const __filename = (0, import_url20.fileURLToPath)(import_meta20.url);
2940
+ const __dirname = import_path23.default.dirname(__filename);
2404
2941
  const projectDir = process.cwd();
2405
- const srcPath = import_path19.default.join(projectDir, "src");
2406
- const authFilePath = import_path19.default.join(srcPath, "lib", "auth.ts");
2407
- if (!import_fs19.default.existsSync(authFilePath)) {
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"));
2942
+ const srcPath = import_path23.default.join(projectDir, "src");
2943
+ const authFilePath = import_path23.default.join(srcPath, "lib", "auth.ts");
2944
+ if (!import_fs23.default.existsSync(authFilePath)) {
2945
+ console.log(import_chalk23.default.red("No Configured Better Auth file found"));
2946
+ console.log(import_chalk23.default.cyan("Run authverse init to initialize better auth"));
2410
2947
  return;
2411
2948
  }
2412
- let content = import_fs19.default.readFileSync(authFilePath, "utf8");
2949
+ let content = import_fs23.default.readFileSync(authFilePath, "utf8");
2413
2950
  if (!content.includes("betterAuth({")) {
2414
- console.log(import_chalk19.default.red("betterAuth({}) block not found"));
2951
+ console.log(import_chalk23.default.red("betterAuth({}) block not found"));
2415
2952
  return;
2416
2953
  }
2417
2954
  if (content.includes("socialProviders") && content.includes("apple:")) {
2418
- console.log(import_chalk19.default.yellow("Apple provider already exists"));
2955
+ console.log(import_chalk23.default.yellow("Apple provider already exists"));
2419
2956
  return;
2420
2957
  }
2421
2958
  const appleProviderEntry = `
@@ -2440,7 +2977,7 @@ var AppleTanstackStart = async () => {
2440
2977
  }
2441
2978
  }
2442
2979
  if (insertPos === -1) {
2443
- console.log(import_chalk19.default.red("Failed to parse socialProviders block"));
2980
+ console.log(import_chalk23.default.red("Failed to parse socialProviders block"));
2444
2981
  return;
2445
2982
  }
2446
2983
  content = content.slice(0, insertPos) + appleProviderEntry + "\n " + content.slice(insertPos);
@@ -2448,7 +2985,7 @@ var AppleTanstackStart = async () => {
2448
2985
  const databaseRegex = /database:\s*(prismaAdapter|drizzleAdapter)\([\s\S]*?\),/;
2449
2986
  if (!databaseRegex.test(content)) {
2450
2987
  console.log(
2451
- import_chalk19.default.red(
2988
+ import_chalk23.default.red(
2452
2989
  "Could not find database adapter (prismaAdapter or drizzleAdapter)"
2453
2990
  )
2454
2991
  );
@@ -2478,12 +3015,12 @@ ${socialProvidersBlock}`
2478
3015
  content = content.slice(0, insertPos) + '\n trustedOrigins: ["https://appleid.apple.com"],' + content.slice(insertPos);
2479
3016
  }
2480
3017
  }
2481
- import_fs19.default.writeFileSync(authFilePath, content, "utf8");
2482
- const envPath = import_path19.default.join(projectDir, ".env");
2483
- if (import_fs19.default.existsSync(envPath)) {
2484
- const envContent = import_fs19.default.readFileSync(envPath, "utf8");
3018
+ import_fs23.default.writeFileSync(authFilePath, content, "utf8");
3019
+ const envPath = import_path23.default.join(projectDir, ".env");
3020
+ if (import_fs23.default.existsSync(envPath)) {
3021
+ const envContent = import_fs23.default.readFileSync(envPath, "utf8");
2485
3022
  if (!envContent.includes("APPLE_CLIENT_ID")) {
2486
- import_fs19.default.appendFileSync(
3023
+ import_fs23.default.appendFileSync(
2487
3024
  envPath,
2488
3025
  `
2489
3026
 
@@ -2495,22 +3032,22 @@ APPLE_BUNDLE_ID=
2495
3032
  );
2496
3033
  }
2497
3034
  }
2498
- const componentTemplate = import_path19.default.resolve(
3035
+ const componentTemplate = import_path23.default.resolve(
2499
3036
  __dirname,
2500
3037
  "./template/TanstackStart/components/AppleOAuthButton.tsx"
2501
3038
  );
2502
- const componentsDir = import_path19.default.join(srcPath, "components", "authverse");
2503
- if (!import_fs19.default.existsSync(componentsDir)) {
2504
- import_fs19.default.mkdirSync(componentsDir, { recursive: true });
3039
+ const componentsDir = import_path23.default.join(srcPath, "components", "authverse");
3040
+ if (!import_fs23.default.existsSync(componentsDir)) {
3041
+ import_fs23.default.mkdirSync(componentsDir, { recursive: true });
2505
3042
  }
2506
- const componentDest = import_path19.default.join(componentsDir, "AppleOAuthButton.tsx");
2507
- if (import_fs19.default.existsSync(componentTemplate)) {
2508
- import_fs19.default.copyFileSync(componentTemplate, componentDest);
3043
+ const componentDest = import_path23.default.join(componentsDir, "AppleOAuthButton.tsx");
3044
+ if (import_fs23.default.existsSync(componentTemplate)) {
3045
+ import_fs23.default.copyFileSync(componentTemplate, componentDest);
2509
3046
  }
2510
- console.log(import_chalk19.default.green("Apple provider added & merged successfully\n"));
2511
- console.log(import_chalk19.default.white("\u2022 src/components/authverse/AppleOAuthButton.tsx"));
3047
+ console.log(import_chalk23.default.green("Apple provider added & merged successfully\n"));
3048
+ console.log(import_chalk23.default.white("\u2022 src/components/authverse/AppleOAuthButton.tsx"));
2512
3049
  } catch (error) {
2513
- console.log(import_chalk19.default.red("apple tanstack state error:"), error);
3050
+ console.log(import_chalk23.default.red("apple tanstack state error:"), error);
2514
3051
  }
2515
3052
  };
2516
3053
 
@@ -2519,7 +3056,7 @@ var Oauth = async ({ oauth }) => {
2519
3056
  try {
2520
3057
  const { framework, error } = await getFramework();
2521
3058
  if (error) {
2522
- console.log(import_chalk20.default.red(error));
3059
+ console.log(import_chalk24.default.red(error));
2523
3060
  return;
2524
3061
  }
2525
3062
  if (framework === "Next js" && oauth == "google") {
@@ -2553,461 +3090,465 @@ var Oauth = async ({ oauth }) => {
2553
3090
  await AppleTanstackStart();
2554
3091
  }
2555
3092
  if (oauth !== "google" && oauth !== "github" && oauth !== "facebook" && oauth !== "LinkedIn" && oauth !== "twitter" && oauth !== "apple") {
2556
- console.log(import_chalk20.default.red("Invalid oauth provider"));
3093
+ console.log(import_chalk24.default.red("Invalid oauth provider"));
2557
3094
  return;
2558
3095
  }
2559
3096
  } catch (error) {
2560
- console.log(import_chalk20.default.red("Error adding oauth:"), error);
3097
+ console.log(import_chalk24.default.red("Error adding oauth:"), error);
2561
3098
  }
2562
3099
  };
2563
3100
 
2564
3101
  // script/forgetNext.ts
2565
- var import_chalk28 = __toESM(require("chalk"), 1);
2566
- var import_path27 = __toESM(require("path"), 1);
2567
- var import_url25 = require("url");
2568
- var import_fs27 = __toESM(require("fs"), 1);
3102
+ var import_chalk32 = __toESM(require("chalk"), 1);
3103
+ var import_path31 = __toESM(require("path"), 1);
3104
+ var import_url27 = require("url");
3105
+ var import_fs31 = __toESM(require("fs"), 1);
2569
3106
 
2570
3107
  // cli/email.ts
2571
- var import_path26 = __toESM(require("path"), 1);
2572
- var import_fs26 = __toESM(require("fs"), 1);
2573
- var import_inquirer4 = __toESM(require("inquirer"), 1);
3108
+ var import_path30 = __toESM(require("path"), 1);
3109
+ var import_fs30 = __toESM(require("fs"), 1);
3110
+ var import_inquirer5 = __toESM(require("inquirer"), 1);
2574
3111
 
2575
3112
  // email/gmailRun.ts
2576
- var import_chalk21 = __toESM(require("chalk"), 1);
2577
- var import_path20 = __toESM(require("path"), 1);
2578
- var import_fs20 = __toESM(require("fs"), 1);
2579
- var import_url19 = require("url");
2580
- var import_meta19 = {};
3113
+ var import_chalk25 = __toESM(require("chalk"), 1);
3114
+ var import_path24 = __toESM(require("path"), 1);
3115
+ var import_fs24 = __toESM(require("fs"), 1);
3116
+ var import_url21 = require("url");
3117
+ var import_meta21 = {};
2581
3118
  var gmailRun = async () => {
2582
3119
  try {
2583
3120
  const projectDir = process.cwd();
2584
- const packageJsonPath = import_path20.default.join(projectDir, "package.json");
2585
- const packageJson2 = JSON.parse(import_fs20.default.readFileSync(packageJsonPath, "utf-8"));
2586
- const srcFolder = import_fs20.default.existsSync(import_path20.default.join(projectDir, "src")) ? "src" : "";
2587
- const __filename = (0, import_url19.fileURLToPath)(import_meta19.url);
2588
- const __dirname = import_path20.default.dirname(__filename);
3121
+ const packageJsonPath = import_path24.default.join(projectDir, "package.json");
3122
+ const packageJson2 = JSON.parse(import_fs24.default.readFileSync(packageJsonPath, "utf-8"));
3123
+ const srcFolder = import_fs24.default.existsSync(import_path24.default.join(projectDir, "src")) ? "src" : "";
3124
+ const __filename = (0, import_url21.fileURLToPath)(import_meta21.url);
3125
+ const __dirname = import_path24.default.dirname(__filename);
2589
3126
  if (!packageJson2.dependencies?.nodemailer || !packageJson2.devDependencies?.["@types/nodemailer"]) {
2590
- console.log(import_chalk21.default.cyan("\n\u2699\uFE0F Installing nodemailer...\n"));
3127
+ console.log(import_chalk25.default.cyan("\n\u2699\uFE0F Installing nodemailer...\n"));
2591
3128
  packageManager("nodemailer");
2592
3129
  packageManager("@types/nodemailer", true);
2593
3130
  }
2594
3131
  if (!packageJson2.dependencies?.["@react-email/components"]) {
2595
- console.log(import_chalk21.default.cyan("\n\u2699\uFE0F Installing @react-email/components...\n"));
3132
+ console.log(import_chalk25.default.cyan("\n\u2699\uFE0F Installing @react-email/components...\n"));
2596
3133
  packageManager("@react-email/components");
2597
3134
  }
2598
3135
  if (!packageJson2.dependencies?.["@react-email/render"]) {
2599
- console.log(import_chalk21.default.cyan("\n\u2699\uFE0F Installing @react-email/render...\n"));
3136
+ console.log(import_chalk25.default.cyan("\n\u2699\uFE0F Installing @react-email/render...\n"));
2600
3137
  packageManager("@react-email/render");
2601
3138
  }
2602
- const envPath = import_path20.default.join(projectDir, ".env");
2603
- const envContent = import_fs20.default.readFileSync(envPath, "utf8");
3139
+ const envPath = import_path24.default.join(projectDir, ".env");
3140
+ const envContent = import_fs24.default.readFileSync(envPath, "utf8");
2604
3141
  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")) {
2605
- import_fs20.default.appendFileSync(envPath, `
3142
+ import_fs24.default.appendFileSync(envPath, `
2606
3143
 
2607
3144
  # Gmail API Key for sending emails`);
2608
- import_fs20.default.appendFileSync(envPath, `
3145
+ import_fs24.default.appendFileSync(envPath, `
2609
3146
  GMAIL_HOST=`);
2610
- import_fs20.default.appendFileSync(envPath, `
3147
+ import_fs24.default.appendFileSync(envPath, `
2611
3148
  GMAIL_PORT=`);
2612
- import_fs20.default.appendFileSync(envPath, `
3149
+ import_fs24.default.appendFileSync(envPath, `
2613
3150
  GMAIL_SERVICE=`);
2614
- import_fs20.default.appendFileSync(envPath, `
3151
+ import_fs24.default.appendFileSync(envPath, `
2615
3152
  GMAIL_MAIL=`);
2616
- import_fs20.default.appendFileSync(envPath, `
3153
+ import_fs24.default.appendFileSync(envPath, `
2617
3154
  GMAIL_NAME=`);
2618
- import_fs20.default.appendFileSync(envPath, `
3155
+ import_fs24.default.appendFileSync(envPath, `
2619
3156
  GMAIL_PASSWORD=`);
2620
3157
  }
2621
- const templatePath = import_path20.default.resolve(
3158
+ const templatePath = import_path24.default.resolve(
2622
3159
  __dirname,
2623
3160
  "./template/email/emailGmail.ts"
2624
3161
  );
2625
- const libPath = import_path20.default.join(projectDir, srcFolder, "lib");
2626
- if (!import_fs20.default.existsSync(libPath)) {
2627
- import_fs20.default.mkdirSync(libPath, { recursive: true });
3162
+ const libPath = import_path24.default.join(projectDir, srcFolder, "lib");
3163
+ if (!import_fs24.default.existsSync(libPath)) {
3164
+ import_fs24.default.mkdirSync(libPath, { recursive: true });
2628
3165
  }
2629
- const libDestinationPath = import_path20.default.join(libPath, "email.ts");
2630
- import_fs20.default.copyFileSync(templatePath, libDestinationPath);
2631
- console.log(import_chalk21.default.green("\nCompleted installation successfully"));
2632
- console.log(import_chalk21.default.cyan("\nInstall Package:"));
3166
+ const libDestinationPath = import_path24.default.join(libPath, "email.ts");
3167
+ import_fs24.default.copyFileSync(templatePath, libDestinationPath);
3168
+ console.log(import_chalk25.default.green("\nCompleted installation successfully"));
3169
+ console.log(import_chalk25.default.cyan("\nInstall Package:"));
2633
3170
  console.log(
2634
- import_chalk21.default.white(
3171
+ import_chalk25.default.white(
2635
3172
  `\u2022 nodemailer
2636
3173
  \u2022 @react-email/components
2637
3174
  \u2022 @react-email/render`
2638
3175
  )
2639
3176
  );
2640
- console.log(import_chalk21.default.cyan("\nFiles created:"));
3177
+ console.log(import_chalk25.default.cyan("\nFiles created:"));
2641
3178
  console.log(
2642
- import_chalk21.default.white(
3179
+ import_chalk25.default.white(
2643
3180
  `${CreateFolder({ srcFolder, destFolder: "lib/email.ts" })}
2644
3181
  `
2645
3182
  )
2646
3183
  );
2647
3184
  } catch (error) {
2648
- console.log(import_chalk21.default.red(error));
3185
+ console.log(import_chalk25.default.red(error));
2649
3186
  }
2650
3187
  };
2651
3188
 
2652
3189
  // email/gmailRunTanstackStart.ts
2653
- var import_chalk22 = __toESM(require("chalk"), 1);
2654
- var import_path21 = __toESM(require("path"), 1);
2655
- var import_fs21 = __toESM(require("fs"), 1);
2656
- var import_url20 = require("url");
2657
- var import_meta20 = {};
3190
+ var import_chalk26 = __toESM(require("chalk"), 1);
3191
+ var import_path25 = __toESM(require("path"), 1);
3192
+ var import_fs25 = __toESM(require("fs"), 1);
3193
+ var import_url22 = require("url");
3194
+ var import_meta22 = {};
2658
3195
  var gmailRunTanstackStart = async () => {
2659
3196
  try {
2660
3197
  const projectDir = process.cwd();
2661
- const packageJsonPath = import_path21.default.join(projectDir, "package.json");
2662
- const packageJson2 = JSON.parse(import_fs21.default.readFileSync(packageJsonPath, "utf-8"));
2663
- const __filename = (0, import_url20.fileURLToPath)(import_meta20.url);
2664
- const __dirname = import_path21.default.dirname(__filename);
3198
+ const packageJsonPath = import_path25.default.join(projectDir, "package.json");
3199
+ const packageJson2 = JSON.parse(import_fs25.default.readFileSync(packageJsonPath, "utf-8"));
3200
+ const __filename = (0, import_url22.fileURLToPath)(import_meta22.url);
3201
+ const __dirname = import_path25.default.dirname(__filename);
2665
3202
  if (!packageJson2.dependencies?.nodemailer || !packageJson2.devDependencies?.["@types/nodemailer"]) {
2666
- console.log(import_chalk22.default.cyan("\n\u2699\uFE0F Installing nodemailer...\n"));
3203
+ console.log(import_chalk26.default.cyan("\n\u2699\uFE0F Installing nodemailer...\n"));
2667
3204
  packageManager("nodemailer");
2668
3205
  packageManager("@types/nodemailer", true);
2669
3206
  }
2670
3207
  if (!packageJson2.dependencies?.["@react-email/components"]) {
2671
- console.log(import_chalk22.default.cyan("\n\u2699\uFE0F Installing @react-email/components...\n"));
3208
+ console.log(import_chalk26.default.cyan("\n\u2699\uFE0F Installing @react-email/components...\n"));
2672
3209
  packageManager("@react-email/components");
2673
3210
  }
2674
3211
  if (!packageJson2.dependencies?.["@react-email/render"]) {
2675
- console.log(import_chalk22.default.cyan("\n\u2699\uFE0F Installing @react-email/render...\n"));
3212
+ console.log(import_chalk26.default.cyan("\n\u2699\uFE0F Installing @react-email/render...\n"));
2676
3213
  packageManager("@react-email/render");
2677
3214
  }
2678
- const envPath = import_path21.default.join(projectDir, ".env");
2679
- const envContent = import_fs21.default.readFileSync(envPath, "utf8");
3215
+ const envPath = import_path25.default.join(projectDir, ".env");
3216
+ const envContent = import_fs25.default.readFileSync(envPath, "utf8");
2680
3217
  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")) {
2681
- import_fs21.default.appendFileSync(envPath, `
3218
+ import_fs25.default.appendFileSync(envPath, `
2682
3219
 
2683
3220
  # Gmail API Key for sending emails`);
2684
- import_fs21.default.appendFileSync(envPath, `
3221
+ import_fs25.default.appendFileSync(envPath, `
2685
3222
  GMAIL_HOST=`);
2686
- import_fs21.default.appendFileSync(envPath, `
3223
+ import_fs25.default.appendFileSync(envPath, `
2687
3224
  GMAIL_PORT=`);
2688
- import_fs21.default.appendFileSync(envPath, `
3225
+ import_fs25.default.appendFileSync(envPath, `
2689
3226
  GMAIL_SERVICE=`);
2690
- import_fs21.default.appendFileSync(envPath, `
3227
+ import_fs25.default.appendFileSync(envPath, `
2691
3228
  GMAIL_MAIL=`);
2692
- import_fs21.default.appendFileSync(envPath, `
3229
+ import_fs25.default.appendFileSync(envPath, `
2693
3230
  GMAIL_NAME=`);
2694
- import_fs21.default.appendFileSync(envPath, `
3231
+ import_fs25.default.appendFileSync(envPath, `
2695
3232
  GMAIL_PASSWORD=`);
2696
3233
  }
2697
- const templatePath = import_path21.default.resolve(
3234
+ const templatePath = import_path25.default.resolve(
2698
3235
  __dirname,
2699
3236
  "./template/email/emailGmail.ts"
2700
3237
  );
2701
- const libPath = import_path21.default.join(projectDir, "src", "lib");
2702
- if (!import_fs21.default.existsSync(libPath)) {
2703
- import_fs21.default.mkdirSync(libPath, { recursive: true });
3238
+ const libPath = import_path25.default.join(projectDir, "src", "lib");
3239
+ if (!import_fs25.default.existsSync(libPath)) {
3240
+ import_fs25.default.mkdirSync(libPath, { recursive: true });
2704
3241
  }
2705
- const libDestinationPath = import_path21.default.join(libPath, "email.ts");
2706
- import_fs21.default.copyFileSync(templatePath, libDestinationPath);
2707
- console.log(import_chalk22.default.green("\nCompleted installation successfully"));
2708
- console.log(import_chalk22.default.cyan("\nInstall Package:"));
3242
+ const libDestinationPath = import_path25.default.join(libPath, "email.ts");
3243
+ import_fs25.default.copyFileSync(templatePath, libDestinationPath);
3244
+ console.log(import_chalk26.default.green("\nCompleted installation successfully"));
3245
+ console.log(import_chalk26.default.cyan("\nInstall Package:"));
2709
3246
  console.log(
2710
- import_chalk22.default.white(
3247
+ import_chalk26.default.white(
2711
3248
  `\u2022 nodemailer
2712
3249
  \u2022 @react-email/components
2713
3250
  \u2022 @react-email/render`
2714
3251
  )
2715
3252
  );
2716
- console.log(import_chalk22.default.cyan("\nFiles created:"));
2717
- console.log(import_chalk22.default.white("\u2022 src/lib/email.ts\n"));
3253
+ console.log(import_chalk26.default.cyan("\nFiles created:"));
3254
+ console.log(import_chalk26.default.white("\u2022 src/lib/email.ts\n"));
2718
3255
  } catch (error) {
2719
- console.log(import_chalk22.default.red(error));
3256
+ console.log(import_chalk26.default.red(error));
2720
3257
  }
2721
3258
  };
2722
3259
 
2723
3260
  // email/awsSesRun.ts
2724
- var import_chalk23 = __toESM(require("chalk"), 1);
2725
- var import_path22 = __toESM(require("path"), 1);
2726
- var import_fs22 = __toESM(require("fs"), 1);
2727
- var import_url21 = require("url");
2728
- var import_meta21 = {};
3261
+ var import_chalk27 = __toESM(require("chalk"), 1);
3262
+ var import_path26 = __toESM(require("path"), 1);
3263
+ var import_fs26 = __toESM(require("fs"), 1);
3264
+ var import_url23 = require("url");
3265
+ var import_meta23 = {};
2729
3266
  var awsSesRun = async () => {
2730
3267
  try {
2731
3268
  const projectDir = process.cwd();
2732
- const packageJsonPath = import_path22.default.join(projectDir, "package.json");
2733
- const packageJson2 = JSON.parse(import_fs22.default.readFileSync(packageJsonPath, "utf-8"));
2734
- const srcFolder = import_fs22.default.existsSync(import_path22.default.join(projectDir, "src")) ? "src" : "";
2735
- const __filename = (0, import_url21.fileURLToPath)(import_meta21.url);
2736
- const __dirname = import_path22.default.dirname(__filename);
3269
+ const packageJsonPath = import_path26.default.join(projectDir, "package.json");
3270
+ const packageJson2 = JSON.parse(import_fs26.default.readFileSync(packageJsonPath, "utf-8"));
3271
+ const srcFolder = import_fs26.default.existsSync(import_path26.default.join(projectDir, "src")) ? "src" : "";
3272
+ const __filename = (0, import_url23.fileURLToPath)(import_meta23.url);
3273
+ const __dirname = import_path26.default.dirname(__filename);
2737
3274
  if (!packageJson2.dependencies?.nodemailer || !packageJson2.devDependencies?.["@types/nodemailer"]) {
2738
- console.log(import_chalk23.default.cyan("\n\u2699\uFE0F Installing nodemailer...\n"));
3275
+ console.log(import_chalk27.default.cyan("\n\u2699\uFE0F Installing nodemailer...\n"));
2739
3276
  packageManager("nodemailer");
2740
3277
  packageManager("@types/nodemailer", true);
2741
3278
  }
2742
3279
  if (!packageJson2.dependencies?.["@react-email/components"]) {
2743
- console.log(import_chalk23.default.cyan("\n\u2699\uFE0F Installing @react-email/components...\n"));
3280
+ console.log(import_chalk27.default.cyan("\n\u2699\uFE0F Installing @react-email/components...\n"));
2744
3281
  packageManager("@react-email/components");
2745
3282
  }
2746
3283
  if (!packageJson2.dependencies?.["@react-email/render"]) {
2747
- console.log(import_chalk23.default.cyan("\n\u2699\uFE0F Installing @react-email/render...\n"));
3284
+ console.log(import_chalk27.default.cyan("\n\u2699\uFE0F Installing @react-email/render...\n"));
2748
3285
  packageManager("@react-email/render");
2749
3286
  }
2750
- const envPath = import_path22.default.join(projectDir, ".env");
2751
- const envContent = import_fs22.default.readFileSync(envPath, "utf8");
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")) {
2753
- import_fs22.default.appendFileSync(envPath, `
3287
+ const envPath = import_path26.default.join(projectDir, ".env");
3288
+ const envContent = import_fs26.default.readFileSync(envPath, "utf8");
3289
+ 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") && !envContent.includes("AWS_SES_FROM_NAME")) {
3290
+ import_fs26.default.appendFileSync(envPath, `
2754
3291
 
2755
3292
  # AWS SES API Key for sending emails`);
2756
- import_fs22.default.appendFileSync(envPath, `
3293
+ import_fs26.default.appendFileSync(envPath, `
2757
3294
  AWS_SES_HOST=`);
2758
- import_fs22.default.appendFileSync(envPath, `
3295
+ import_fs26.default.appendFileSync(envPath, `
2759
3296
  AWS_SES_PORT=`);
2760
- import_fs22.default.appendFileSync(envPath, `
3297
+ import_fs26.default.appendFileSync(envPath, `
2761
3298
  AWS_SES_SERVICE=`);
2762
- import_fs22.default.appendFileSync(envPath, `
3299
+ import_fs26.default.appendFileSync(envPath, `
2763
3300
  AWS_SES_USER=`);
2764
- import_fs22.default.appendFileSync(envPath, `
3301
+ import_fs26.default.appendFileSync(envPath, `
2765
3302
  AWS_SES_PASS=`);
2766
- import_fs22.default.appendFileSync(envPath, `
3303
+ import_fs26.default.appendFileSync(envPath, `
2767
3304
  AWS_SES_FROM=`);
3305
+ import_fs26.default.appendFileSync(envPath, `
3306
+ AWS_SES_FROM_NAME=`);
2768
3307
  }
2769
- const templatePath = import_path22.default.resolve(
3308
+ const templatePath = import_path26.default.resolve(
2770
3309
  __dirname,
2771
3310
  "./template/email/emailAwsSes.ts"
2772
3311
  );
2773
- const libPath = import_path22.default.join(projectDir, srcFolder, "lib");
2774
- if (!import_fs22.default.existsSync(libPath)) {
2775
- import_fs22.default.mkdirSync(libPath, { recursive: true });
2776
- }
2777
- const libDestinationPath = import_path22.default.join(libPath, "email.ts");
2778
- import_fs22.default.copyFileSync(templatePath, libDestinationPath);
2779
- console.log(import_chalk23.default.green("\nCompleted installation successfully"));
2780
- console.log(import_chalk23.default.cyan("\nInstall Package:"));
3312
+ const libPath = import_path26.default.join(projectDir, srcFolder, "lib");
3313
+ if (!import_fs26.default.existsSync(libPath)) {
3314
+ import_fs26.default.mkdirSync(libPath, { recursive: true });
3315
+ }
3316
+ const libDestinationPath = import_path26.default.join(libPath, "email.ts");
3317
+ import_fs26.default.copyFileSync(templatePath, libDestinationPath);
3318
+ console.log(import_chalk27.default.green("\nCompleted installation successfully"));
3319
+ console.log(import_chalk27.default.cyan("\nInstall Package:"));
2781
3320
  console.log(
2782
- import_chalk23.default.white(
3321
+ import_chalk27.default.white(
2783
3322
  `\u2022 nodemailer
2784
3323
  \u2022 @react-email/components
2785
3324
  \u2022 @react-email/render`
2786
3325
  )
2787
3326
  );
2788
- console.log(import_chalk23.default.cyan("\nFiles created:"));
3327
+ console.log(import_chalk27.default.cyan("\nFiles created:"));
2789
3328
  console.log(
2790
- import_chalk23.default.white(
3329
+ import_chalk27.default.white(
2791
3330
  `${CreateFolder({ srcFolder, destFolder: "lib/email.ts" })}
2792
3331
  `
2793
3332
  )
2794
3333
  );
2795
3334
  } catch (error) {
2796
- console.log(import_chalk23.default.red(error));
3335
+ console.log(import_chalk27.default.red(error));
2797
3336
  }
2798
3337
  };
2799
3338
 
2800
3339
  // email/awsSesRunTanstackStart.ts
2801
- var import_chalk24 = __toESM(require("chalk"), 1);
2802
- var import_path23 = __toESM(require("path"), 1);
2803
- var import_fs23 = __toESM(require("fs"), 1);
2804
- var import_url22 = require("url");
2805
- var import_meta22 = {};
3340
+ var import_chalk28 = __toESM(require("chalk"), 1);
3341
+ var import_path27 = __toESM(require("path"), 1);
3342
+ var import_fs27 = __toESM(require("fs"), 1);
3343
+ var import_url24 = require("url");
3344
+ var import_meta24 = {};
2806
3345
  var awsSesRunTanstackStart = async () => {
2807
3346
  try {
2808
3347
  const projectDir = process.cwd();
2809
- const packageJsonPath = import_path23.default.join(projectDir, "package.json");
2810
- const packageJson2 = JSON.parse(import_fs23.default.readFileSync(packageJsonPath, "utf-8"));
2811
- const __filename = (0, import_url22.fileURLToPath)(import_meta22.url);
2812
- const __dirname = import_path23.default.dirname(__filename);
3348
+ const packageJsonPath = import_path27.default.join(projectDir, "package.json");
3349
+ const packageJson2 = JSON.parse(import_fs27.default.readFileSync(packageJsonPath, "utf-8"));
3350
+ const __filename = (0, import_url24.fileURLToPath)(import_meta24.url);
3351
+ const __dirname = import_path27.default.dirname(__filename);
2813
3352
  if (!packageJson2.dependencies?.nodemailer || !packageJson2.devDependencies?.["@types/nodemailer"]) {
2814
- console.log(import_chalk24.default.cyan("\n\u2699\uFE0F Installing nodemailer...\n"));
3353
+ console.log(import_chalk28.default.cyan("\n\u2699\uFE0F Installing nodemailer...\n"));
2815
3354
  packageManager("nodemailer");
2816
3355
  packageManager("@types/nodemailer", true);
2817
3356
  }
2818
3357
  if (!packageJson2.dependencies?.["@react-email/components"]) {
2819
- console.log(import_chalk24.default.cyan("\n\u2699\uFE0F Installing @react-email/components...\n"));
3358
+ console.log(import_chalk28.default.cyan("\n\u2699\uFE0F Installing @react-email/components...\n"));
2820
3359
  packageManager("@react-email/components");
2821
3360
  }
2822
3361
  if (!packageJson2.dependencies?.["@react-email/render"]) {
2823
- console.log(import_chalk24.default.cyan("\n\u2699\uFE0F Installing @react-email/render...\n"));
3362
+ console.log(import_chalk28.default.cyan("\n\u2699\uFE0F Installing @react-email/render...\n"));
2824
3363
  packageManager("@react-email/render");
2825
3364
  }
2826
- const envPath = import_path23.default.join(projectDir, ".env");
2827
- const envContent = import_fs23.default.readFileSync(envPath, "utf8");
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")) {
2829
- import_fs23.default.appendFileSync(envPath, `
3365
+ const envPath = import_path27.default.join(projectDir, ".env");
3366
+ const envContent = import_fs27.default.readFileSync(envPath, "utf8");
3367
+ 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") && !envContent.includes("AWS_SES_FROM_NAME")) {
3368
+ import_fs27.default.appendFileSync(envPath, `
2830
3369
 
2831
3370
  # AWS SES API Key for sending emails`);
2832
- import_fs23.default.appendFileSync(envPath, `
3371
+ import_fs27.default.appendFileSync(envPath, `
2833
3372
  AWS_SES_HOST=`);
2834
- import_fs23.default.appendFileSync(envPath, `
3373
+ import_fs27.default.appendFileSync(envPath, `
2835
3374
  AWS_SES_PORT=`);
2836
- import_fs23.default.appendFileSync(envPath, `
3375
+ import_fs27.default.appendFileSync(envPath, `
2837
3376
  AWS_SES_SERVICE=`);
2838
- import_fs23.default.appendFileSync(envPath, `
3377
+ import_fs27.default.appendFileSync(envPath, `
2839
3378
  AWS_SES_USER=`);
2840
- import_fs23.default.appendFileSync(envPath, `
3379
+ import_fs27.default.appendFileSync(envPath, `
2841
3380
  AWS_SES_PASS=`);
2842
- import_fs23.default.appendFileSync(envPath, `
3381
+ import_fs27.default.appendFileSync(envPath, `
2843
3382
  AWS_SES_FROM=`);
3383
+ import_fs27.default.appendFileSync(envPath, `
3384
+ AWS_SES_FROM_NAME=`);
2844
3385
  }
2845
- const templatePath = import_path23.default.resolve(
3386
+ const templatePath = import_path27.default.resolve(
2846
3387
  __dirname,
2847
3388
  "./template/email/emailAwsSes.ts"
2848
3389
  );
2849
- const libPath = import_path23.default.join(projectDir, "src", "lib");
2850
- if (!import_fs23.default.existsSync(libPath)) {
2851
- import_fs23.default.mkdirSync(libPath, { recursive: true });
2852
- }
2853
- const libDestinationPath = import_path23.default.join(libPath, "email.ts");
2854
- import_fs23.default.copyFileSync(templatePath, libDestinationPath);
2855
- console.log(import_chalk24.default.green("\nCompleted installation successfully"));
2856
- console.log(import_chalk24.default.cyan("\nInstall Package:"));
3390
+ const libPath = import_path27.default.join(projectDir, "src", "lib");
3391
+ if (!import_fs27.default.existsSync(libPath)) {
3392
+ import_fs27.default.mkdirSync(libPath, { recursive: true });
3393
+ }
3394
+ const libDestinationPath = import_path27.default.join(libPath, "email.ts");
3395
+ import_fs27.default.copyFileSync(templatePath, libDestinationPath);
3396
+ console.log(import_chalk28.default.green("\nCompleted installation successfully"));
3397
+ console.log(import_chalk28.default.cyan("\nInstall Package:"));
2857
3398
  console.log(
2858
- import_chalk24.default.white(
3399
+ import_chalk28.default.white(
2859
3400
  `\u2022 nodemailer
2860
3401
  \u2022 @react-email/components
2861
3402
  \u2022 @react-email/render`
2862
3403
  )
2863
3404
  );
2864
- console.log(import_chalk24.default.cyan("\nFiles created:"));
2865
- console.log(import_chalk24.default.white("\u2022 src/lib/email.ts\n"));
3405
+ console.log(import_chalk28.default.cyan("\nFiles created:"));
3406
+ console.log(import_chalk28.default.white("\u2022 src/lib/email.ts\n"));
2866
3407
  } catch (error) {
2867
- console.log(import_chalk24.default.red(error));
3408
+ console.log(import_chalk28.default.red(error));
2868
3409
  }
2869
3410
  };
2870
3411
 
2871
3412
  // email/resendRun.ts
2872
- var import_chalk25 = __toESM(require("chalk"), 1);
2873
- var import_path24 = __toESM(require("path"), 1);
2874
- var import_fs24 = __toESM(require("fs"), 1);
2875
- var import_url23 = require("url");
2876
- var import_meta23 = {};
3413
+ var import_chalk29 = __toESM(require("chalk"), 1);
3414
+ var import_path28 = __toESM(require("path"), 1);
3415
+ var import_fs28 = __toESM(require("fs"), 1);
3416
+ var import_url25 = require("url");
3417
+ var import_meta25 = {};
2877
3418
  var resendRun = async () => {
2878
3419
  try {
2879
3420
  const projectDir = process.cwd();
2880
- const packageJsonPath = import_path24.default.join(projectDir, "package.json");
2881
- const packageJson2 = JSON.parse(import_fs24.default.readFileSync(packageJsonPath, "utf-8"));
2882
- const srcFolder = import_fs24.default.existsSync(import_path24.default.join(projectDir, "src")) ? "src" : "";
2883
- const __filename = (0, import_url23.fileURLToPath)(import_meta23.url);
2884
- const __dirname = import_path24.default.dirname(__filename);
3421
+ const packageJsonPath = import_path28.default.join(projectDir, "package.json");
3422
+ const packageJson2 = JSON.parse(import_fs28.default.readFileSync(packageJsonPath, "utf-8"));
3423
+ const srcFolder = import_fs28.default.existsSync(import_path28.default.join(projectDir, "src")) ? "src" : "";
3424
+ const __filename = (0, import_url25.fileURLToPath)(import_meta25.url);
3425
+ const __dirname = import_path28.default.dirname(__filename);
2885
3426
  if (!packageJson2.dependencies?.resend) {
2886
- console.log(import_chalk25.default.cyan("\n\u2699\uFE0F Installing Resend...\n"));
3427
+ console.log(import_chalk29.default.cyan("\n\u2699\uFE0F Installing Resend...\n"));
2887
3428
  packageManager("resend");
2888
3429
  }
2889
3430
  if (!packageJson2.dependencies?.["@react-email/components"]) {
2890
- console.log(import_chalk25.default.cyan("\n\u2699\uFE0F Installing @react-email/components...\n"));
3431
+ console.log(import_chalk29.default.cyan("\n\u2699\uFE0F Installing @react-email/components...\n"));
2891
3432
  packageManager("@react-email/components");
2892
3433
  }
2893
3434
  if (!packageJson2.dependencies?.["@react-email/render"]) {
2894
- console.log(import_chalk25.default.cyan("\n\u2699\uFE0F Installing @react-email/render...\n"));
3435
+ console.log(import_chalk29.default.cyan("\n\u2699\uFE0F Installing @react-email/render...\n"));
2895
3436
  packageManager("@react-email/render");
2896
3437
  }
2897
- const envPath = import_path24.default.join(projectDir, ".env");
2898
- const envContent = import_fs24.default.readFileSync(envPath, "utf8");
3438
+ const envPath = import_path28.default.join(projectDir, ".env");
3439
+ const envContent = import_fs28.default.readFileSync(envPath, "utf8");
2899
3440
  if (!envContent.includes("RESEND_API_KEY") && !envContent.includes("EMAIL_SENDER_NAME") && !envContent.includes("EMAIL_SENDER_ADDRESS")) {
2900
- import_fs24.default.appendFileSync(envPath, `
3441
+ import_fs28.default.appendFileSync(envPath, `
2901
3442
 
2902
3443
  # Resend API Key for sending emails`);
2903
- import_fs24.default.appendFileSync(envPath, `
3444
+ import_fs28.default.appendFileSync(envPath, `
2904
3445
  RESEND_API_KEY=`);
2905
- import_fs24.default.appendFileSync(envPath, `
3446
+ import_fs28.default.appendFileSync(envPath, `
2906
3447
  EMAIL_SENDER_NAME=Your Name`);
2907
- import_fs24.default.appendFileSync(envPath, `
3448
+ import_fs28.default.appendFileSync(envPath, `
2908
3449
  EMAIL_SENDER_ADDRESS=`);
2909
3450
  }
2910
- const templatePath = import_path24.default.resolve(
3451
+ const templatePath = import_path28.default.resolve(
2911
3452
  __dirname,
2912
3453
  "./template/email/emailResend.ts"
2913
3454
  );
2914
- const libPath = import_path24.default.join(projectDir, srcFolder, "lib");
2915
- if (!import_fs24.default.existsSync(libPath)) {
2916
- import_fs24.default.mkdirSync(libPath, { recursive: true });
2917
- }
2918
- const libDestinationPath = import_path24.default.join(libPath, "email.ts");
2919
- import_fs24.default.copyFileSync(templatePath, libDestinationPath);
2920
- console.log(import_chalk25.default.green("\nCompleted installation successfully"));
2921
- console.log(import_chalk25.default.cyan("\nInstall Package:"));
3455
+ const libPath = import_path28.default.join(projectDir, srcFolder, "lib");
3456
+ if (!import_fs28.default.existsSync(libPath)) {
3457
+ import_fs28.default.mkdirSync(libPath, { recursive: true });
3458
+ }
3459
+ const libDestinationPath = import_path28.default.join(libPath, "email.ts");
3460
+ import_fs28.default.copyFileSync(templatePath, libDestinationPath);
3461
+ console.log(import_chalk29.default.green("\nCompleted installation successfully"));
3462
+ console.log(import_chalk29.default.cyan("\nInstall Package:"));
2922
3463
  console.log(
2923
- import_chalk25.default.white(`\u2022 resend
3464
+ import_chalk29.default.white(`\u2022 resend
2924
3465
  \u2022 @react-email/components
2925
3466
  \u2022 @react-email/render`)
2926
3467
  );
2927
- console.log(import_chalk25.default.cyan("\nFiles created:"));
3468
+ console.log(import_chalk29.default.cyan("\nFiles created:"));
2928
3469
  console.log(
2929
- import_chalk25.default.white(
3470
+ import_chalk29.default.white(
2930
3471
  `${CreateFolder({ srcFolder, destFolder: "lib/email.ts" })}
2931
3472
  `
2932
3473
  )
2933
3474
  );
2934
3475
  } catch (error) {
2935
- console.log(import_chalk25.default.red(error));
3476
+ console.log(import_chalk29.default.red(error));
2936
3477
  }
2937
3478
  };
2938
3479
 
2939
3480
  // email/resendRunTanstackStart.ts
2940
- var import_chalk26 = __toESM(require("chalk"), 1);
2941
- var import_path25 = __toESM(require("path"), 1);
2942
- var import_fs25 = __toESM(require("fs"), 1);
2943
- var import_url24 = require("url");
2944
- var import_meta24 = {};
3481
+ var import_chalk30 = __toESM(require("chalk"), 1);
3482
+ var import_path29 = __toESM(require("path"), 1);
3483
+ var import_fs29 = __toESM(require("fs"), 1);
3484
+ var import_url26 = require("url");
3485
+ var import_meta26 = {};
2945
3486
  var resendRunTanstackStart = async () => {
2946
3487
  try {
2947
3488
  const projectDir = process.cwd();
2948
- const packageJsonPath = import_path25.default.join(projectDir, "package.json");
2949
- const packageJson2 = JSON.parse(import_fs25.default.readFileSync(packageJsonPath, "utf-8"));
2950
- const __filename = (0, import_url24.fileURLToPath)(import_meta24.url);
2951
- const __dirname = import_path25.default.dirname(__filename);
3489
+ const packageJsonPath = import_path29.default.join(projectDir, "package.json");
3490
+ const packageJson2 = JSON.parse(import_fs29.default.readFileSync(packageJsonPath, "utf-8"));
3491
+ const __filename = (0, import_url26.fileURLToPath)(import_meta26.url);
3492
+ const __dirname = import_path29.default.dirname(__filename);
2952
3493
  if (!packageJson2.dependencies?.resend) {
2953
- console.log(import_chalk26.default.cyan("\n\u2699\uFE0F Installing Resend...\n"));
3494
+ console.log(import_chalk30.default.cyan("\n\u2699\uFE0F Installing Resend...\n"));
2954
3495
  packageManager("resend");
2955
3496
  }
2956
3497
  if (!packageJson2.dependencies?.["@react-email/components"]) {
2957
- console.log(import_chalk26.default.cyan("\n\u2699\uFE0F Installing @react-email/components...\n"));
3498
+ console.log(import_chalk30.default.cyan("\n\u2699\uFE0F Installing @react-email/components...\n"));
2958
3499
  packageManager("@react-email/components");
2959
3500
  }
2960
- const envPath = import_path25.default.join(projectDir, ".env");
2961
- const envContent = import_fs25.default.readFileSync(envPath, "utf8");
3501
+ const envPath = import_path29.default.join(projectDir, ".env");
3502
+ const envContent = import_fs29.default.readFileSync(envPath, "utf8");
2962
3503
  if (!envContent.includes("RESEND_API_KEY") && !envContent.includes("EMAIL_SENDER_NAME") && !envContent.includes("EMAIL_SENDER_ADDRESS")) {
2963
- import_fs25.default.appendFileSync(envPath, `
3504
+ import_fs29.default.appendFileSync(envPath, `
2964
3505
 
2965
3506
  # Resend API Key for sending emails`);
2966
- import_fs25.default.appendFileSync(envPath, `
3507
+ import_fs29.default.appendFileSync(envPath, `
2967
3508
  RESEND_API_KEY=`);
2968
- import_fs25.default.appendFileSync(envPath, `
3509
+ import_fs29.default.appendFileSync(envPath, `
2969
3510
  EMAIL_SENDER_NAME=Your Name`);
2970
- import_fs25.default.appendFileSync(envPath, `
3511
+ import_fs29.default.appendFileSync(envPath, `
2971
3512
  EMAIL_SENDER_ADDRESS=`);
2972
3513
  }
2973
- const templatePath = import_path25.default.resolve(
3514
+ const templatePath = import_path29.default.resolve(
2974
3515
  __dirname,
2975
3516
  "./template/email/emailResend.ts"
2976
3517
  );
2977
- const libPath = import_path25.default.join(projectDir, "src", "lib");
2978
- if (!import_fs25.default.existsSync(libPath)) {
2979
- import_fs25.default.mkdirSync(libPath, { recursive: true });
2980
- }
2981
- const libDestinationPath = import_path25.default.join(libPath, "email.ts");
2982
- import_fs25.default.copyFileSync(templatePath, libDestinationPath);
2983
- console.log(import_chalk26.default.green("\nCompleted installation successfully"));
2984
- console.log(import_chalk26.default.cyan("\nInstall Package:"));
3518
+ const libPath = import_path29.default.join(projectDir, "src", "lib");
3519
+ if (!import_fs29.default.existsSync(libPath)) {
3520
+ import_fs29.default.mkdirSync(libPath, { recursive: true });
3521
+ }
3522
+ const libDestinationPath = import_path29.default.join(libPath, "email.ts");
3523
+ import_fs29.default.copyFileSync(templatePath, libDestinationPath);
3524
+ console.log(import_chalk30.default.green("\nCompleted installation successfully"));
3525
+ console.log(import_chalk30.default.cyan("\nInstall Package:"));
2985
3526
  console.log(
2986
- import_chalk26.default.white(`\u2022 resend
3527
+ import_chalk30.default.white(`\u2022 resend
2987
3528
  \u2022 @react-email/components
2988
3529
  \u2022 @react-email/render`)
2989
3530
  );
2990
- console.log(import_chalk26.default.cyan("\nFiles created:"));
2991
- console.log(import_chalk26.default.white("\u2022 src/lib/email.ts\n"));
3531
+ console.log(import_chalk30.default.cyan("\nFiles created:"));
3532
+ console.log(import_chalk30.default.white("\u2022 src/lib/email.ts\n"));
2992
3533
  } catch (error) {
2993
- console.log(import_chalk26.default.red(error));
3534
+ console.log(import_chalk30.default.red(error));
2994
3535
  }
2995
3536
  };
2996
3537
 
2997
3538
  // cli/email.ts
2998
- var import_chalk27 = __toESM(require("chalk"), 1);
3539
+ var import_chalk31 = __toESM(require("chalk"), 1);
2999
3540
  var email = async () => {
3000
3541
  const projectDir = process.cwd();
3001
3542
  const { framework, error } = await getFramework();
3002
3543
  if (error) {
3003
- console.log(import_chalk27.default.red(error));
3544
+ console.log(import_chalk31.default.red(error));
3004
3545
  return;
3005
3546
  }
3006
3547
  if (framework === "Next js") {
3007
- const srcFolder = import_fs26.default.existsSync(import_path26.default.join(projectDir, "src")) ? "src" : "";
3008
- const emailPath = import_path26.default.join(projectDir, srcFolder, "lib", "email.ts");
3009
- if (import_fs26.default.existsSync(emailPath)) {
3010
- const answers2 = await import_inquirer4.default.prompt([
3548
+ const srcFolder = import_fs30.default.existsSync(import_path30.default.join(projectDir, "src")) ? "src" : "";
3549
+ const emailPath = import_path30.default.join(projectDir, srcFolder, "lib", "email.ts");
3550
+ if (import_fs30.default.existsSync(emailPath)) {
3551
+ const answers2 = await import_inquirer5.default.prompt([
3011
3552
  {
3012
3553
  type: "confirm",
3013
3554
  name: "overwrite",
@@ -3021,13 +3562,13 @@ var email = async () => {
3021
3562
  }
3022
3563
  }
3023
3564
  if (framework === "tanstack start") {
3024
- const srcFolderTanstackState = import_path26.default.join(projectDir, "src");
3025
- const libPathTanstackState = import_path26.default.join(
3565
+ const srcFolderTanstackState = import_path30.default.join(projectDir, "src");
3566
+ const libPathTanstackState = import_path30.default.join(
3026
3567
  srcFolderTanstackState,
3027
3568
  "lib/email.ts"
3028
3569
  );
3029
- if (import_fs26.default.existsSync(libPathTanstackState)) {
3030
- const answers2 = await import_inquirer4.default.prompt([
3570
+ if (import_fs30.default.existsSync(libPathTanstackState)) {
3571
+ const answers2 = await import_inquirer5.default.prompt([
3031
3572
  {
3032
3573
  type: "confirm",
3033
3574
  name: "overwrite",
@@ -3040,9 +3581,9 @@ var email = async () => {
3040
3581
  }
3041
3582
  }
3042
3583
  }
3043
- const answers = await import_inquirer4.default.prompt([
3584
+ const answers = await import_inquirer5.default.prompt([
3044
3585
  {
3045
- type: "list",
3586
+ type: "select",
3046
3587
  name: "emailProvider",
3047
3588
  message: "Choose Your Email Provider:",
3048
3589
  choices: ["Gmail", "AWS SES", "Resend"]
@@ -3069,24 +3610,24 @@ var email = async () => {
3069
3610
  };
3070
3611
 
3071
3612
  // script/forgetNext.ts
3072
- var import_meta25 = {};
3613
+ var import_meta27 = {};
3073
3614
  var forgetNext = async () => {
3074
3615
  try {
3075
3616
  const projectDir = process.cwd();
3076
- const __filename = (0, import_url25.fileURLToPath)(import_meta25.url);
3077
- const __dirname = import_path27.default.dirname(__filename);
3078
- const srcPath = import_path27.default.join(projectDir, "src");
3079
- const folder = import_fs27.default.existsSync(srcPath) ? "src" : "";
3080
- const emailFilePath = import_path27.default.join(projectDir, folder, "lib", "email.ts");
3081
- if (!import_fs27.default.existsSync(emailFilePath)) {
3617
+ const __filename = (0, import_url27.fileURLToPath)(import_meta27.url);
3618
+ const __dirname = import_path31.default.dirname(__filename);
3619
+ const srcPath = import_path31.default.join(projectDir, "src");
3620
+ const folder = import_fs31.default.existsSync(srcPath) ? "src" : "";
3621
+ const emailFilePath = import_path31.default.join(projectDir, folder, "lib", "email.ts");
3622
+ if (!import_fs31.default.existsSync(emailFilePath)) {
3082
3623
  await email();
3083
3624
  }
3084
- const authFilePath = import_path27.default.join(projectDir, folder, "lib", "auth.ts");
3085
- if (!import_fs27.default.existsSync(authFilePath)) {
3086
- console.log(import_chalk28.default.red("auth.ts file not found."));
3625
+ const authFilePath = import_path31.default.join(projectDir, folder, "lib", "auth.ts");
3626
+ if (!import_fs31.default.existsSync(authFilePath)) {
3627
+ console.log(import_chalk32.default.red("auth.ts file not found."));
3087
3628
  return;
3088
3629
  }
3089
- let content = import_fs27.default.readFileSync(authFilePath, "utf8");
3630
+ let content = import_fs31.default.readFileSync(authFilePath, "utf8");
3090
3631
  const codeAdded = `sendResetPassword: async ({ user, url, token }) => {
3091
3632
  await sendEmail({
3092
3633
  email: user.email!,
@@ -3124,7 +3665,7 @@ var forgetNext = async () => {
3124
3665
  const after = content.substring(emailAndPasswordEnd);
3125
3666
  content = before + `${codeAdded}` + after;
3126
3667
  }
3127
- import_fs27.default.writeFileSync(authFilePath, content, "utf8");
3668
+ import_fs31.default.writeFileSync(authFilePath, content, "utf8");
3128
3669
  if (!content.includes("import { sendEmail }")) {
3129
3670
  const lastImportIndex = content.lastIndexOf("import");
3130
3671
  const nextLineAfterLastImport = content.indexOf("\n", lastImportIndex) + 1;
@@ -3133,7 +3674,7 @@ var forgetNext = async () => {
3133
3674
  const newImports = `import { sendEmail } from "./email";
3134
3675
  `;
3135
3676
  content = beforeImports + newImports + afterImports;
3136
- import_fs27.default.writeFileSync(authFilePath, content, "utf8");
3677
+ import_fs31.default.writeFileSync(authFilePath, content, "utf8");
3137
3678
  }
3138
3679
  if (!content.includes("import ForgotPasswordEmail from")) {
3139
3680
  const lastImportIndex = content.lastIndexOf("import");
@@ -3143,97 +3684,97 @@ var forgetNext = async () => {
3143
3684
  const newImports = `import ForgotPasswordEmail from "@/components/email/reset-password";
3144
3685
  `;
3145
3686
  content = beforeImports + newImports + afterImports;
3146
- import_fs27.default.writeFileSync(authFilePath, content, "utf8");
3687
+ import_fs31.default.writeFileSync(authFilePath, content, "utf8");
3147
3688
  }
3148
- const componentPath = import_path27.default.resolve(
3689
+ const componentPath = import_path31.default.resolve(
3149
3690
  __dirname,
3150
3691
  "./template/email/reset-password.tsx"
3151
3692
  );
3152
- const destinationPath = import_path27.default.join(
3693
+ const destinationPath = import_path31.default.join(
3153
3694
  projectDir,
3154
3695
  folder,
3155
3696
  "components",
3156
3697
  "email"
3157
3698
  );
3158
- if (!import_fs27.default.existsSync(destinationPath)) {
3159
- import_fs27.default.mkdirSync(destinationPath, { recursive: true });
3699
+ if (!import_fs31.default.existsSync(destinationPath)) {
3700
+ import_fs31.default.mkdirSync(destinationPath, { recursive: true });
3160
3701
  }
3161
- const emailDestinationPath = import_path27.default.join(
3702
+ const emailDestinationPath = import_path31.default.join(
3162
3703
  destinationPath,
3163
3704
  "reset-password.tsx"
3164
3705
  );
3165
- if (import_fs27.default.existsSync(componentPath)) {
3166
- import_fs27.default.copyFileSync(componentPath, emailDestinationPath);
3706
+ if (import_fs31.default.existsSync(componentPath)) {
3707
+ import_fs31.default.copyFileSync(componentPath, emailDestinationPath);
3167
3708
  }
3168
- const forgetComponentPath = import_path27.default.resolve(
3709
+ const forgetComponentPath = import_path31.default.resolve(
3169
3710
  __dirname,
3170
3711
  "./template/components/ForgetComponent.tsx"
3171
3712
  );
3172
- const componentsDestinationPath = import_path27.default.join(
3713
+ const componentsDestinationPath = import_path31.default.join(
3173
3714
  projectDir,
3174
3715
  folder,
3175
3716
  "components",
3176
3717
  "authverse"
3177
3718
  );
3178
- if (!import_fs27.default.existsSync(componentsDestinationPath)) {
3179
- import_fs27.default.mkdirSync(componentsDestinationPath, { recursive: true });
3719
+ if (!import_fs31.default.existsSync(componentsDestinationPath)) {
3720
+ import_fs31.default.mkdirSync(componentsDestinationPath, { recursive: true });
3180
3721
  }
3181
- const forgetDestinationPath = import_path27.default.join(
3722
+ const forgetDestinationPath = import_path31.default.join(
3182
3723
  componentsDestinationPath,
3183
3724
  "ForgetComponent.tsx"
3184
3725
  );
3185
- if (import_fs27.default.existsSync(forgetComponentPath)) {
3186
- import_fs27.default.copyFileSync(forgetComponentPath, forgetDestinationPath);
3726
+ if (import_fs31.default.existsSync(forgetComponentPath)) {
3727
+ import_fs31.default.copyFileSync(forgetComponentPath, forgetDestinationPath);
3187
3728
  }
3188
- const resetComponentPath = import_path27.default.resolve(
3729
+ const resetComponentPath = import_path31.default.resolve(
3189
3730
  __dirname,
3190
3731
  "./template/components/ResetComponent.tsx"
3191
3732
  );
3192
- const resetDestinationPath = import_path27.default.join(
3733
+ const resetDestinationPath = import_path31.default.join(
3193
3734
  componentsDestinationPath,
3194
3735
  "ResetComponent.tsx"
3195
3736
  );
3196
- if (import_fs27.default.existsSync(resetComponentPath)) {
3197
- import_fs27.default.copyFileSync(resetComponentPath, resetDestinationPath);
3737
+ if (import_fs31.default.existsSync(resetComponentPath)) {
3738
+ import_fs31.default.copyFileSync(resetComponentPath, resetDestinationPath);
3198
3739
  }
3199
- const authTemplatePath = import_path27.default.resolve(
3740
+ const authTemplatePath = import_path31.default.resolve(
3200
3741
  __dirname,
3201
3742
  "./template/app-auth-uiDesign"
3202
3743
  );
3203
- const appDestinationPath = import_path27.default.join(projectDir, folder, "app", "auth");
3204
- if (!import_fs27.default.existsSync(appDestinationPath)) {
3205
- import_fs27.default.mkdirSync(appDestinationPath, { recursive: true });
3744
+ const appDestinationPath = import_path31.default.join(projectDir, folder, "app", "auth");
3745
+ if (!import_fs31.default.existsSync(appDestinationPath)) {
3746
+ import_fs31.default.mkdirSync(appDestinationPath, { recursive: true });
3206
3747
  }
3207
- const forgetDestinationDir = import_path27.default.join(appDestinationPath, "forget");
3208
- if (!import_fs27.default.existsSync(forgetDestinationDir)) {
3209
- import_fs27.default.mkdirSync(forgetDestinationDir, { recursive: true });
3748
+ const forgetDestinationDir = import_path31.default.join(appDestinationPath, "forget");
3749
+ if (!import_fs31.default.existsSync(forgetDestinationDir)) {
3750
+ import_fs31.default.mkdirSync(forgetDestinationDir, { recursive: true });
3210
3751
  }
3211
- const forgetPageDestinationPath = import_path27.default.join(
3752
+ const forgetPageDestinationPath = import_path31.default.join(
3212
3753
  forgetDestinationDir,
3213
3754
  "page.tsx"
3214
3755
  );
3215
- import_fs27.default.copyFileSync(
3756
+ import_fs31.default.copyFileSync(
3216
3757
  `${authTemplatePath}/forget/page.tsx`,
3217
3758
  forgetPageDestinationPath
3218
3759
  );
3219
- const resetDestinationDir = import_path27.default.join(
3760
+ const resetDestinationDir = import_path31.default.join(
3220
3761
  appDestinationPath,
3221
3762
  "reset-password"
3222
3763
  );
3223
- if (!import_fs27.default.existsSync(resetDestinationDir)) {
3224
- import_fs27.default.mkdirSync(resetDestinationDir, { recursive: true });
3764
+ if (!import_fs31.default.existsSync(resetDestinationDir)) {
3765
+ import_fs31.default.mkdirSync(resetDestinationDir, { recursive: true });
3225
3766
  }
3226
- const resetPageDestinationPath = import_path27.default.join(
3767
+ const resetPageDestinationPath = import_path31.default.join(
3227
3768
  resetDestinationDir,
3228
3769
  "page.tsx"
3229
3770
  );
3230
- import_fs27.default.copyFileSync(
3771
+ import_fs31.default.copyFileSync(
3231
3772
  `${authTemplatePath}/reset-password/page.tsx`,
3232
3773
  resetPageDestinationPath
3233
3774
  );
3234
- console.log(import_chalk28.default.green("\nCompleted installation successfully"));
3775
+ console.log(import_chalk32.default.green("\nCompleted installation successfully"));
3235
3776
  console.log(
3236
- import_chalk28.default.white(
3777
+ import_chalk32.default.white(
3237
3778
  `${CreateFolder({ srcFolder: folder, destFolder: "components/authverse/ForgetComponent.tsx" })}
3238
3779
  ${CreateFolder({ srcFolder: folder, destFolder: "components/authverse/ResetComponent.tsx" })}
3239
3780
  ${CreateFolder({ srcFolder: folder, destFolder: "components/email/reset-password.tsx" })}
@@ -3244,36 +3785,36 @@ ${CreateFolder({ srcFolder: folder, destFolder: "app/auth/reset-password/page.ts
3244
3785
  );
3245
3786
  } else {
3246
3787
  console.log(
3247
- import_chalk28.default.red("Could not find emailAndPassword configuration in auth.ts")
3788
+ import_chalk32.default.red("Could not find emailAndPassword configuration in auth.ts")
3248
3789
  );
3249
3790
  }
3250
3791
  } catch (error) {
3251
- console.log(import_chalk28.default.red("Error adding sendResetPassword:"), error);
3792
+ console.log(import_chalk32.default.red("Error adding sendResetPassword:"), error);
3252
3793
  }
3253
3794
  };
3254
3795
 
3255
3796
  // script/forgetTanstack.ts
3256
- var import_chalk29 = __toESM(require("chalk"), 1);
3257
- var import_path28 = __toESM(require("path"), 1);
3258
- var import_url26 = require("url");
3259
- var import_fs28 = __toESM(require("fs"), 1);
3260
- var import_meta26 = {};
3797
+ var import_chalk33 = __toESM(require("chalk"), 1);
3798
+ var import_path32 = __toESM(require("path"), 1);
3799
+ var import_url28 = require("url");
3800
+ var import_fs32 = __toESM(require("fs"), 1);
3801
+ var import_meta28 = {};
3261
3802
  var forgetTanstack = async () => {
3262
3803
  try {
3263
3804
  const projectDir = process.cwd();
3264
- const __filename = (0, import_url26.fileURLToPath)(import_meta26.url);
3265
- const __dirname = import_path28.default.dirname(__filename);
3266
- const srcPath = import_path28.default.join(projectDir, "src");
3267
- const emailFilePath = import_path28.default.join(srcPath, "lib", "email.ts");
3268
- if (!import_fs28.default.existsSync(emailFilePath)) {
3805
+ const __filename = (0, import_url28.fileURLToPath)(import_meta28.url);
3806
+ const __dirname = import_path32.default.dirname(__filename);
3807
+ const srcPath = import_path32.default.join(projectDir, "src");
3808
+ const emailFilePath = import_path32.default.join(srcPath, "lib", "email.ts");
3809
+ if (!import_fs32.default.existsSync(emailFilePath)) {
3269
3810
  await email();
3270
3811
  }
3271
- const authFilePath = import_path28.default.join(srcPath, "lib", "auth.ts");
3272
- if (!import_fs28.default.existsSync(authFilePath)) {
3273
- console.log(import_chalk29.default.red("auth.ts file not found."));
3812
+ const authFilePath = import_path32.default.join(srcPath, "lib", "auth.ts");
3813
+ if (!import_fs32.default.existsSync(authFilePath)) {
3814
+ console.log(import_chalk33.default.red("auth.ts file not found."));
3274
3815
  return;
3275
3816
  }
3276
- let content = import_fs28.default.readFileSync(authFilePath, "utf8");
3817
+ let content = import_fs32.default.readFileSync(authFilePath, "utf8");
3277
3818
  const codeAdded = `sendResetPassword: async ({ user, url, token }) => {
3278
3819
  await sendEmail({
3279
3820
  email: user.email!,
@@ -3311,7 +3852,7 @@ var forgetTanstack = async () => {
3311
3852
  const after = content.substring(emailAndPasswordEnd);
3312
3853
  content = before + `${codeAdded}` + after;
3313
3854
  }
3314
- import_fs28.default.writeFileSync(authFilePath, content, "utf8");
3855
+ import_fs32.default.writeFileSync(authFilePath, content, "utf8");
3315
3856
  if (!content.includes("import { sendEmail }")) {
3316
3857
  const lastImportIndex = content.lastIndexOf("import");
3317
3858
  const nextLineAfterLastImport = content.indexOf("\n", lastImportIndex) + 1;
@@ -3320,7 +3861,7 @@ var forgetTanstack = async () => {
3320
3861
  const newImports = `import { sendEmail } from "./email";
3321
3862
  `;
3322
3863
  content = beforeImports + newImports + afterImports;
3323
- import_fs28.default.writeFileSync(authFilePath, content, "utf8");
3864
+ import_fs32.default.writeFileSync(authFilePath, content, "utf8");
3324
3865
  }
3325
3866
  if (!content.includes("import ForgotPasswordEmail from")) {
3326
3867
  const lastImportIndex = content.lastIndexOf("import");
@@ -3330,80 +3871,80 @@ var forgetTanstack = async () => {
3330
3871
  const newImports = `import ForgotPasswordEmail from "@/components/email/reset-password";
3331
3872
  `;
3332
3873
  content = beforeImports + newImports + afterImports;
3333
- import_fs28.default.writeFileSync(authFilePath, content, "utf8");
3874
+ import_fs32.default.writeFileSync(authFilePath, content, "utf8");
3334
3875
  }
3335
- const componentPath = import_path28.default.resolve(
3876
+ const componentPath = import_path32.default.resolve(
3336
3877
  __dirname,
3337
3878
  "./template/email/reset-password.tsx"
3338
3879
  );
3339
- const destinationPath = import_path28.default.join(srcPath, "components", "email");
3340
- if (!import_fs28.default.existsSync(destinationPath)) {
3341
- import_fs28.default.mkdirSync(destinationPath, { recursive: true });
3880
+ const destinationPath = import_path32.default.join(srcPath, "components", "email");
3881
+ if (!import_fs32.default.existsSync(destinationPath)) {
3882
+ import_fs32.default.mkdirSync(destinationPath, { recursive: true });
3342
3883
  }
3343
- const emailDestinationPath = import_path28.default.join(
3884
+ const emailDestinationPath = import_path32.default.join(
3344
3885
  destinationPath,
3345
3886
  "reset-password.tsx"
3346
3887
  );
3347
- if (import_fs28.default.existsSync(componentPath)) {
3348
- import_fs28.default.copyFileSync(componentPath, emailDestinationPath);
3888
+ if (import_fs32.default.existsSync(componentPath)) {
3889
+ import_fs32.default.copyFileSync(componentPath, emailDestinationPath);
3349
3890
  }
3350
- const forgetComponentPath = import_path28.default.resolve(
3891
+ const forgetComponentPath = import_path32.default.resolve(
3351
3892
  __dirname,
3352
3893
  "./template/TanstackStart/components/ForgetComponent.tsx"
3353
3894
  );
3354
- const componentsDestinationPath = import_path28.default.join(
3895
+ const componentsDestinationPath = import_path32.default.join(
3355
3896
  srcPath,
3356
3897
  "components",
3357
3898
  "authverse"
3358
3899
  );
3359
- if (!import_fs28.default.existsSync(componentsDestinationPath)) {
3360
- import_fs28.default.mkdirSync(componentsDestinationPath, { recursive: true });
3900
+ if (!import_fs32.default.existsSync(componentsDestinationPath)) {
3901
+ import_fs32.default.mkdirSync(componentsDestinationPath, { recursive: true });
3361
3902
  }
3362
- const forgetDestinationPath = import_path28.default.join(
3903
+ const forgetDestinationPath = import_path32.default.join(
3363
3904
  componentsDestinationPath,
3364
3905
  "ForgetComponent.tsx"
3365
3906
  );
3366
- if (import_fs28.default.existsSync(forgetComponentPath)) {
3367
- import_fs28.default.copyFileSync(forgetComponentPath, forgetDestinationPath);
3907
+ if (import_fs32.default.existsSync(forgetComponentPath)) {
3908
+ import_fs32.default.copyFileSync(forgetComponentPath, forgetDestinationPath);
3368
3909
  }
3369
- const resetComponentPath = import_path28.default.resolve(
3910
+ const resetComponentPath = import_path32.default.resolve(
3370
3911
  __dirname,
3371
3912
  "./template/TanstackStart/components/ResetComponent.tsx"
3372
3913
  );
3373
- const resetDestinationPath = import_path28.default.join(
3914
+ const resetDestinationPath = import_path32.default.join(
3374
3915
  componentsDestinationPath,
3375
3916
  "ResetComponent.tsx"
3376
3917
  );
3377
- if (import_fs28.default.existsSync(resetComponentPath)) {
3378
- import_fs28.default.copyFileSync(resetComponentPath, resetDestinationPath);
3918
+ if (import_fs32.default.existsSync(resetComponentPath)) {
3919
+ import_fs32.default.copyFileSync(resetComponentPath, resetDestinationPath);
3379
3920
  }
3380
- const authTemplatePath = import_path28.default.resolve(
3921
+ const authTemplatePath = import_path32.default.resolve(
3381
3922
  __dirname,
3382
3923
  "./template/TanstackStart/routes/auth"
3383
3924
  );
3384
- const routesDestinationPath = import_path28.default.join(srcPath, "routes", "auth");
3385
- if (!import_fs28.default.existsSync(routesDestinationPath)) {
3386
- import_fs28.default.mkdirSync(routesDestinationPath, { recursive: true });
3925
+ const routesDestinationPath = import_path32.default.join(srcPath, "routes", "auth");
3926
+ if (!import_fs32.default.existsSync(routesDestinationPath)) {
3927
+ import_fs32.default.mkdirSync(routesDestinationPath, { recursive: true });
3387
3928
  }
3388
- const forgetPageDestinationPath = import_path28.default.join(
3929
+ const forgetPageDestinationPath = import_path32.default.join(
3389
3930
  routesDestinationPath,
3390
3931
  "forget.tsx"
3391
3932
  );
3392
- import_fs28.default.copyFileSync(
3933
+ import_fs32.default.copyFileSync(
3393
3934
  `${authTemplatePath}/forget.tsx`,
3394
3935
  forgetPageDestinationPath
3395
3936
  );
3396
- const resetPageDestinationPath = import_path28.default.join(
3937
+ const resetPageDestinationPath = import_path32.default.join(
3397
3938
  routesDestinationPath,
3398
3939
  "reset-password.tsx"
3399
3940
  );
3400
- import_fs28.default.copyFileSync(
3941
+ import_fs32.default.copyFileSync(
3401
3942
  `${authTemplatePath}/reset-password.tsx`,
3402
3943
  resetPageDestinationPath
3403
3944
  );
3404
- console.log(import_chalk29.default.green("\nCompleted installation successfully"));
3945
+ console.log(import_chalk33.default.green("\nCompleted installation successfully"));
3405
3946
  console.log(
3406
- import_chalk29.default.white(
3947
+ import_chalk33.default.white(
3407
3948
  `\u2022 src/components/authverse/ForgetComponent.tsx
3408
3949
  \u2022 src/components/authverse/ResetComponent.tsx
3409
3950
  \u2022 src/components/email/reset-password.tsx
@@ -3414,20 +3955,20 @@ var forgetTanstack = async () => {
3414
3955
  );
3415
3956
  } else {
3416
3957
  console.log(
3417
- import_chalk29.default.red("Could not find emailAndPassword configuration in auth.ts")
3958
+ import_chalk33.default.red("Could not find emailAndPassword configuration in auth.ts")
3418
3959
  );
3419
3960
  }
3420
3961
  } catch (error) {
3421
- console.log(import_chalk29.default.red("Error adding sendResetPassword:"), error);
3962
+ console.log(import_chalk33.default.red("Error adding sendResetPassword:"), error);
3422
3963
  }
3423
3964
  };
3424
3965
 
3425
3966
  // cli/forget.ts
3426
- var import_chalk30 = __toESM(require("chalk"), 1);
3967
+ var import_chalk34 = __toESM(require("chalk"), 1);
3427
3968
  var forget = async () => {
3428
3969
  const { framework, error } = await getFramework();
3429
3970
  if (error) {
3430
- console.log(import_chalk30.default.red(error));
3971
+ console.log(import_chalk34.default.red(error));
3431
3972
  return;
3432
3973
  }
3433
3974
  if (framework === "Next js") {
@@ -3439,31 +3980,31 @@ var forget = async () => {
3439
3980
  };
3440
3981
 
3441
3982
  // cli/verification.ts
3442
- var import_chalk33 = __toESM(require("chalk"), 1);
3983
+ var import_chalk37 = __toESM(require("chalk"), 1);
3443
3984
 
3444
3985
  // script/verifyNext.ts
3445
- var import_chalk31 = __toESM(require("chalk"), 1);
3446
- var import_fs29 = __toESM(require("fs"), 1);
3447
- var import_path29 = __toESM(require("path"), 1);
3448
- var import_url27 = require("url");
3449
- var import_meta27 = {};
3986
+ var import_chalk35 = __toESM(require("chalk"), 1);
3987
+ var import_fs33 = __toESM(require("fs"), 1);
3988
+ var import_path33 = __toESM(require("path"), 1);
3989
+ var import_url29 = require("url");
3990
+ var import_meta29 = {};
3450
3991
  var verifyNext = async () => {
3451
3992
  try {
3452
3993
  const projectDir = process.cwd();
3453
- const __filename = (0, import_url27.fileURLToPath)(import_meta27.url);
3454
- const __dirname = import_path29.default.dirname(__filename);
3455
- const srcPath = import_path29.default.join(projectDir, "src");
3456
- const folder = import_fs29.default.existsSync(srcPath) ? "src" : "";
3457
- const emailFilePath = import_path29.default.join(projectDir, folder, "lib", "email.ts");
3458
- if (!import_fs29.default.existsSync(emailFilePath)) {
3994
+ const __filename = (0, import_url29.fileURLToPath)(import_meta29.url);
3995
+ const __dirname = import_path33.default.dirname(__filename);
3996
+ const srcPath = import_path33.default.join(projectDir, "src");
3997
+ const folder = import_fs33.default.existsSync(srcPath) ? "src" : "";
3998
+ const emailFilePath = import_path33.default.join(projectDir, folder, "lib", "email.ts");
3999
+ if (!import_fs33.default.existsSync(emailFilePath)) {
3459
4000
  await email();
3460
4001
  }
3461
- const authFilePath = import_path29.default.join(projectDir, folder, "lib", "auth.ts");
3462
- if (!import_fs29.default.existsSync(authFilePath)) {
3463
- console.log(import_chalk31.default.red("auth.ts file not found."));
4002
+ const authFilePath = import_path33.default.join(projectDir, folder, "lib", "auth.ts");
4003
+ if (!import_fs33.default.existsSync(authFilePath)) {
4004
+ console.log(import_chalk35.default.red("auth.ts file not found."));
3464
4005
  return;
3465
4006
  }
3466
- let content = import_fs29.default.readFileSync(authFilePath, "utf8");
4007
+ let content = import_fs33.default.readFileSync(authFilePath, "utf8");
3467
4008
  if (content.includes("emailAndPassword: {")) {
3468
4009
  const start = content.indexOf("emailAndPassword: {");
3469
4010
  let end = start;
@@ -3523,52 +4064,52 @@ var verifyNext = async () => {
3523
4064
  `;
3524
4065
  content = content.slice(0, nextLine) + imports + content.slice(nextLine);
3525
4066
  }
3526
- import_fs29.default.writeFileSync(authFilePath, content, "utf8");
3527
- const templatePath = import_path29.default.resolve(
4067
+ import_fs33.default.writeFileSync(authFilePath, content, "utf8");
4068
+ const templatePath = import_path33.default.resolve(
3528
4069
  __dirname,
3529
4070
  "./template/email/EmailVerification.tsx"
3530
4071
  );
3531
- const componentsDir = import_path29.default.join(projectDir, folder, "components", "email");
3532
- if (!import_fs29.default.existsSync(componentsDir)) {
3533
- import_fs29.default.mkdirSync(componentsDir, { recursive: true });
4072
+ const componentsDir = import_path33.default.join(projectDir, folder, "components", "email");
4073
+ if (!import_fs33.default.existsSync(componentsDir)) {
4074
+ import_fs33.default.mkdirSync(componentsDir, { recursive: true });
3534
4075
  }
3535
- const destFile = import_path29.default.join(componentsDir, "EmailVerification.tsx");
3536
- if (import_fs29.default.existsSync(templatePath) && !import_fs29.default.existsSync(destFile)) {
3537
- import_fs29.default.copyFileSync(templatePath, destFile);
4076
+ const destFile = import_path33.default.join(componentsDir, "EmailVerification.tsx");
4077
+ if (import_fs33.default.existsSync(templatePath) && !import_fs33.default.existsSync(destFile)) {
4078
+ import_fs33.default.copyFileSync(templatePath, destFile);
3538
4079
  }
3539
- console.log(import_chalk31.default.green("\nCompleted installation successfully"));
4080
+ console.log(import_chalk35.default.green("\nCompleted installation successfully"));
3540
4081
  console.log(
3541
- import_chalk31.default.white(
4082
+ import_chalk35.default.white(
3542
4083
  `${CreateFolder({ srcFolder: folder, destFolder: "components/email/EmailVerification.tsx" })}`
3543
4084
  )
3544
4085
  );
3545
4086
  } catch (error) {
3546
- console.log(import_chalk31.default.red(String(error)));
4087
+ console.log(import_chalk35.default.red(String(error)));
3547
4088
  }
3548
4089
  };
3549
4090
 
3550
4091
  // script/verifyTanstack.ts
3551
- var import_chalk32 = __toESM(require("chalk"), 1);
3552
- var import_fs30 = __toESM(require("fs"), 1);
3553
- var import_path30 = __toESM(require("path"), 1);
3554
- var import_url28 = require("url");
3555
- var import_meta28 = {};
4092
+ var import_chalk36 = __toESM(require("chalk"), 1);
4093
+ var import_fs34 = __toESM(require("fs"), 1);
4094
+ var import_path34 = __toESM(require("path"), 1);
4095
+ var import_url30 = require("url");
4096
+ var import_meta30 = {};
3556
4097
  var verifyTanstack = async () => {
3557
4098
  try {
3558
4099
  const projectDir = process.cwd();
3559
- const __filename = (0, import_url28.fileURLToPath)(import_meta28.url);
3560
- const __dirname = import_path30.default.dirname(__filename);
3561
- const srcPath = import_path30.default.join(projectDir, "src");
3562
- const emailFilePath = import_path30.default.join(srcPath, "lib", "email.ts");
3563
- if (!import_fs30.default.existsSync(emailFilePath)) {
4100
+ const __filename = (0, import_url30.fileURLToPath)(import_meta30.url);
4101
+ const __dirname = import_path34.default.dirname(__filename);
4102
+ const srcPath = import_path34.default.join(projectDir, "src");
4103
+ const emailFilePath = import_path34.default.join(srcPath, "lib", "email.ts");
4104
+ if (!import_fs34.default.existsSync(emailFilePath)) {
3564
4105
  await email();
3565
4106
  }
3566
- const authFilePath = import_path30.default.join(srcPath, "lib", "auth.ts");
3567
- if (!import_fs30.default.existsSync(authFilePath)) {
3568
- console.log(import_chalk32.default.red("auth.ts file not found."));
4107
+ const authFilePath = import_path34.default.join(srcPath, "lib", "auth.ts");
4108
+ if (!import_fs34.default.existsSync(authFilePath)) {
4109
+ console.log(import_chalk36.default.red("auth.ts file not found."));
3569
4110
  return;
3570
4111
  }
3571
- let content = import_fs30.default.readFileSync(authFilePath, "utf8");
4112
+ let content = import_fs34.default.readFileSync(authFilePath, "utf8");
3572
4113
  if (content.includes("emailAndPassword: {")) {
3573
4114
  const start = content.indexOf("emailAndPassword: {");
3574
4115
  let end = start;
@@ -3628,23 +4169,23 @@ var verifyTanstack = async () => {
3628
4169
  `;
3629
4170
  content = content.slice(0, nextLine) + imports + content.slice(nextLine);
3630
4171
  }
3631
- import_fs30.default.writeFileSync(authFilePath, content, "utf8");
3632
- const templatePath = import_path30.default.resolve(
4172
+ import_fs34.default.writeFileSync(authFilePath, content, "utf8");
4173
+ const templatePath = import_path34.default.resolve(
3633
4174
  __dirname,
3634
4175
  "./template/email/EmailVerification.tsx"
3635
4176
  );
3636
- const componentsDir = import_path30.default.join(srcPath, "components", "email");
3637
- if (!import_fs30.default.existsSync(componentsDir)) {
3638
- import_fs30.default.mkdirSync(componentsDir, { recursive: true });
4177
+ const componentsDir = import_path34.default.join(srcPath, "components", "email");
4178
+ if (!import_fs34.default.existsSync(componentsDir)) {
4179
+ import_fs34.default.mkdirSync(componentsDir, { recursive: true });
3639
4180
  }
3640
- const destFile = import_path30.default.join(componentsDir, "EmailVerification.tsx");
3641
- if (import_fs30.default.existsSync(templatePath) && !import_fs30.default.existsSync(destFile)) {
3642
- import_fs30.default.copyFileSync(templatePath, destFile);
4181
+ const destFile = import_path34.default.join(componentsDir, "EmailVerification.tsx");
4182
+ if (import_fs34.default.existsSync(templatePath) && !import_fs34.default.existsSync(destFile)) {
4183
+ import_fs34.default.copyFileSync(templatePath, destFile);
3643
4184
  }
3644
- console.log(import_chalk32.default.green("\nCompleted installation successfully"));
3645
- console.log(import_chalk32.default.white(`\u2022 src/components/email/EmailVerification.tsx`));
4185
+ console.log(import_chalk36.default.green("\nCompleted installation successfully"));
4186
+ console.log(import_chalk36.default.white(`\u2022 src/components/email/EmailVerification.tsx`));
3646
4187
  } catch (error) {
3647
- console.log(import_chalk32.default.red(String(error)));
4188
+ console.log(import_chalk36.default.red(String(error)));
3648
4189
  }
3649
4190
  };
3650
4191
 
@@ -3653,7 +4194,7 @@ var verification = async () => {
3653
4194
  try {
3654
4195
  const { framework, error } = await getFramework();
3655
4196
  if (error) {
3656
- console.log(import_chalk33.default.red(error));
4197
+ console.log(import_chalk37.default.red(error));
3657
4198
  return;
3658
4199
  }
3659
4200
  if (framework === "Next js") {
@@ -3663,17 +4204,17 @@ var verification = async () => {
3663
4204
  await verifyTanstack();
3664
4205
  }
3665
4206
  } catch (error) {
3666
- console.log(import_chalk33.default.red(error.message));
4207
+ console.log(import_chalk37.default.red(error.message));
3667
4208
  }
3668
4209
  };
3669
4210
 
3670
4211
  // cli/initCmd.ts
3671
- var import_chalk34 = __toESM(require("chalk"), 1);
4212
+ var import_chalk38 = __toESM(require("chalk"), 1);
3672
4213
  var initCmd = async (cmd) => {
3673
4214
  try {
3674
4215
  const { framework, error } = await getFramework();
3675
4216
  if (error) {
3676
- console.log(import_chalk34.default.red(error));
4217
+ console.log(import_chalk38.default.red(error));
3677
4218
  return;
3678
4219
  }
3679
4220
  if (framework === "Next js" && cmd.orm === "prisma") {
@@ -3703,12 +4244,12 @@ var initCmd = async (cmd) => {
3703
4244
  });
3704
4245
  }
3705
4246
  } catch (error) {
3706
- console.log(import_chalk34.default.red(error));
4247
+ console.log(import_chalk38.default.red(error));
3707
4248
  }
3708
4249
  };
3709
4250
 
3710
4251
  // index.ts
3711
- var packageJson = JSON.parse((0, import_fs31.readFileSync)("./package.json", "utf8"));
4252
+ var packageJson = JSON.parse((0, import_fs35.readFileSync)("./package.json", "utf8"));
3712
4253
  var program = new import_commander.Command();
3713
4254
  program.name("authverse").description("CLI tool for creating authverse projects").version(
3714
4255
  packageJson.version || "1.0.0",