authverse 1.1.7 → 1.1.8-beta.2
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 +384 -121
- package/dist/index.js +384 -121
- package/dist/template/proxy/proxy.ts +1 -1
- package/package.json +3 -3
- /package/dist/template/{TanstackState → TanstackStart}/components/AppleOAuthButton.tsx +0 -0
- /package/dist/template/{TanstackState → TanstackStart}/components/FacebookOAuthButton.tsx +0 -0
- /package/dist/template/{TanstackState → TanstackStart}/components/ForgetComponent.tsx +0 -0
- /package/dist/template/{TanstackState → TanstackStart}/components/GithubProviders.tsx +0 -0
- /package/dist/template/{TanstackState → TanstackStart}/components/GoogleOAuthButton.tsx +0 -0
- /package/dist/template/{TanstackState → TanstackStart}/components/LinkedInOAuthButton.tsx +0 -0
- /package/dist/template/{TanstackState → TanstackStart}/components/LoginComponent.tsx +0 -0
- /package/dist/template/{TanstackState → TanstackStart}/components/ResetComponent.tsx +0 -0
- /package/dist/template/{TanstackState → TanstackStart}/components/SingUpComponent.tsx +0 -0
- /package/dist/template/{TanstackState → TanstackStart}/components/TwitterOAuthButton.tsx +0 -0
- /package/dist/template/{TanstackState → TanstackStart}/lib/Mongodb/auth.ts +0 -0
- /package/dist/template/{TanstackState → TanstackStart}/lib/Mysql/auth.ts +0 -0
- /package/dist/template/{TanstackState → TanstackStart}/lib/Postgresql/auth.ts +0 -0
- /package/dist/template/{TanstackState → TanstackStart}/lib/auth-drizzle.ts +0 -0
- /package/dist/template/{TanstackState → TanstackStart}/middleware/auth.ts +0 -0
- /package/dist/template/{TanstackState → TanstackStart}/routes/$.ts +0 -0
- /package/dist/template/{TanstackState → TanstackStart}/routes/auth/forget.tsx +0 -0
- /package/dist/template/{TanstackState → TanstackStart}/routes/auth/login.tsx +0 -0
- /package/dist/template/{TanstackState → TanstackStart}/routes/auth/reset-password.tsx +0 -0
- /package/dist/template/{TanstackState → TanstackStart}/routes/auth/signup.tsx +0 -0
package/dist/index.js
CHANGED
|
@@ -61,6 +61,14 @@ var runCommand = (cmd) => {
|
|
|
61
61
|
}
|
|
62
62
|
};
|
|
63
63
|
|
|
64
|
+
// utils/CreateFolder.ts
|
|
65
|
+
var CreateFolder = ({
|
|
66
|
+
srcFolder,
|
|
67
|
+
destFolder
|
|
68
|
+
}) => {
|
|
69
|
+
return `\u2022 ${srcFolder === "" ? "" : srcFolder + "/"}${destFolder}`;
|
|
70
|
+
};
|
|
71
|
+
|
|
64
72
|
// script/authUi.ts
|
|
65
73
|
var shadcnComponents = [
|
|
66
74
|
"button.tsx",
|
|
@@ -74,7 +82,8 @@ var shadcnComponents = [
|
|
|
74
82
|
var authUiRun = async ({
|
|
75
83
|
folder,
|
|
76
84
|
packageJson: packageJson2,
|
|
77
|
-
cmd
|
|
85
|
+
cmd,
|
|
86
|
+
database
|
|
78
87
|
}) => {
|
|
79
88
|
try {
|
|
80
89
|
const projectDir = process.cwd();
|
|
@@ -175,7 +184,25 @@ ${layoutContent}`;
|
|
|
175
184
|
}
|
|
176
185
|
fs.writeFileSync(layoutPath, layoutContent, "utf-8");
|
|
177
186
|
}
|
|
178
|
-
console.log(chalk.green("\
|
|
187
|
+
console.log(chalk.green("\nCompleted installation successfully"));
|
|
188
|
+
console.log(chalk.cyan("\nInstall Package:"));
|
|
189
|
+
console.log(chalk.white(`\u2022 ${database} schema
|
|
190
|
+
\u2022 better-auth`));
|
|
191
|
+
console.log(chalk.cyan("\nFiles created:"));
|
|
192
|
+
console.log(
|
|
193
|
+
chalk.white(
|
|
194
|
+
`${CreateFolder({ srcFolder: folder, destFolder: "lib/auth.ts" })}
|
|
195
|
+
${CreateFolder({ srcFolder: folder, destFolder: "lib/auth-client.ts" })}
|
|
196
|
+
${CreateFolder({ srcFolder: folder, destFolder: "app/api/auth/[...all]/route.ts" })}
|
|
197
|
+
${CreateFolder({ srcFolder: folder, destFolder: "proxy.ts" })}
|
|
198
|
+
${CreateFolder({ srcFolder: folder, destFolder: "components/authverse/LoginComponent.tsx" })}
|
|
199
|
+
${CreateFolder({ srcFolder: folder, destFolder: "components/authverse/SingUpComponent.tsx" })}
|
|
200
|
+
${CreateFolder({ srcFolder: folder, destFolder: "app/auth/layout.tsx" })}
|
|
201
|
+
${CreateFolder({ srcFolder: folder, destFolder: "app/auth/login/page.tsx" })}
|
|
202
|
+
${CreateFolder({ srcFolder: folder, destFolder: "app/auth/signup/page.tsx" })}
|
|
203
|
+
`
|
|
204
|
+
)
|
|
205
|
+
);
|
|
179
206
|
} catch (error) {
|
|
180
207
|
console.log(chalk.red("\nauthUi setup failed:"), error);
|
|
181
208
|
}
|
|
@@ -371,12 +398,22 @@ BETTER_AUTH_URL=http://localhost:3000
|
|
|
371
398
|
await authUiRun({
|
|
372
399
|
folder: srcFolder,
|
|
373
400
|
packageJson: packageJson2,
|
|
374
|
-
cmd
|
|
401
|
+
cmd,
|
|
402
|
+
database: "prisma"
|
|
375
403
|
});
|
|
376
404
|
} else {
|
|
405
|
+
console.log(chalk2.green("\nCompleted installation successfully"));
|
|
406
|
+
console.log(chalk2.cyan("\nInstall Package:"));
|
|
407
|
+
console.log(chalk2.white(`\u2022 prisma ${database} schema
|
|
408
|
+
\u2022 better-auth`));
|
|
409
|
+
console.log(chalk2.cyan("\nFiles created:"));
|
|
377
410
|
console.log(
|
|
378
|
-
chalk2.
|
|
379
|
-
|
|
411
|
+
chalk2.white(
|
|
412
|
+
`${CreateFolder({ srcFolder, destFolder: "lib/auth.ts" })}
|
|
413
|
+
${CreateFolder({ srcFolder, destFolder: "lib/auth-client.ts" })}
|
|
414
|
+
${CreateFolder({ srcFolder, destFolder: "app/api/auth/[...all]/route.ts" })}
|
|
415
|
+
${CreateFolder({ srcFolder, destFolder: "proxy.ts" })}
|
|
416
|
+
`
|
|
380
417
|
)
|
|
381
418
|
);
|
|
382
419
|
}
|
|
@@ -542,12 +579,22 @@ BETTER_AUTH_URL=http://localhost:3000
|
|
|
542
579
|
await authUiRun({
|
|
543
580
|
folder: srcFolder,
|
|
544
581
|
packageJson: packageJson2,
|
|
545
|
-
cmd
|
|
582
|
+
cmd,
|
|
583
|
+
database: "drizzle"
|
|
546
584
|
});
|
|
547
585
|
} else {
|
|
586
|
+
console.log(chalk3.green("\nCompleted installation successfully"));
|
|
587
|
+
console.log(chalk3.cyan("\nInstall Package:"));
|
|
588
|
+
console.log(chalk3.white(`\u2022 drizzle schema
|
|
589
|
+
\u2022 better-auth`));
|
|
590
|
+
console.log(chalk3.cyan("\nFiles created:"));
|
|
548
591
|
console.log(
|
|
549
|
-
chalk3.
|
|
550
|
-
|
|
592
|
+
chalk3.white(
|
|
593
|
+
`${CreateFolder({ srcFolder, destFolder: "lib/auth.ts" })}
|
|
594
|
+
${CreateFolder({ srcFolder, destFolder: "lib/auth-client.ts" })}
|
|
595
|
+
${CreateFolder({ srcFolder, destFolder: "app/api/auth/[...all]/route.ts" })}
|
|
596
|
+
${CreateFolder({ srcFolder, destFolder: "proxy.ts" })}
|
|
597
|
+
`
|
|
551
598
|
)
|
|
552
599
|
);
|
|
553
600
|
}
|
|
@@ -556,7 +603,7 @@ BETTER_AUTH_URL=http://localhost:3000
|
|
|
556
603
|
}
|
|
557
604
|
};
|
|
558
605
|
|
|
559
|
-
// script/
|
|
606
|
+
// script/prismaRunTanstackStart.ts
|
|
560
607
|
import chalk5 from "chalk";
|
|
561
608
|
import path5 from "path";
|
|
562
609
|
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
@@ -578,7 +625,8 @@ var shadcnComponents2 = [
|
|
|
578
625
|
];
|
|
579
626
|
var authUiTanstackState = async ({
|
|
580
627
|
packageJson: packageJson2,
|
|
581
|
-
cmd
|
|
628
|
+
cmd,
|
|
629
|
+
database
|
|
582
630
|
}) => {
|
|
583
631
|
try {
|
|
584
632
|
const projectDir = process.cwd();
|
|
@@ -610,7 +658,7 @@ var authUiTanstackState = async ({
|
|
|
610
658
|
const srcPath = path4.join(projectDir, "src");
|
|
611
659
|
const componentPath = path4.resolve(
|
|
612
660
|
__dirname,
|
|
613
|
-
"./template/
|
|
661
|
+
"./template/TanstackStart/components"
|
|
614
662
|
);
|
|
615
663
|
const authversePathComponents = path4.join(
|
|
616
664
|
srcPath,
|
|
@@ -634,7 +682,7 @@ var authUiTanstackState = async ({
|
|
|
634
682
|
}
|
|
635
683
|
const templateRoutesPage = path4.resolve(
|
|
636
684
|
__dirname,
|
|
637
|
-
"./template/
|
|
685
|
+
"./template/TanstackStart/routes/auth"
|
|
638
686
|
);
|
|
639
687
|
fs4.copyFileSync(
|
|
640
688
|
`${templateRoutesPage}/login.tsx`,
|
|
@@ -659,14 +707,32 @@ ${rootContent}`;
|
|
|
659
707
|
}
|
|
660
708
|
fs4.writeFileSync(rootPath, rootContent, "utf-8");
|
|
661
709
|
}
|
|
662
|
-
console.log(chalk4.green("\
|
|
710
|
+
console.log(chalk4.green("\nCompleted installation successfully"));
|
|
711
|
+
console.log(chalk4.cyan("\nInstall Package:"));
|
|
712
|
+
console.log(chalk4.white(`\u2022 ${database} schema
|
|
713
|
+
\u2022 better-auth`));
|
|
714
|
+
console.log(chalk4.cyan("\nFiles created:"));
|
|
715
|
+
console.log(
|
|
716
|
+
chalk4.white(
|
|
717
|
+
`\u2022 src/lib/auth.ts
|
|
718
|
+
\u2022 src/lib/auth-client.ts
|
|
719
|
+
\u2022 src/app/api/auth/[...all]/route.ts
|
|
720
|
+
\u2022 src/proxy.ts
|
|
721
|
+
\u2022 src/components/authverse/LoginComponent.tsx
|
|
722
|
+
\u2022 src/components/authverse/SingUpComponent.tsx
|
|
723
|
+
\u2022 src/app/auth/layout.tsx
|
|
724
|
+
\u2022 src/app/auth/login/page.tsx
|
|
725
|
+
\u2022 src/app/auth/signup/page.tsx
|
|
726
|
+
`
|
|
727
|
+
)
|
|
728
|
+
);
|
|
663
729
|
} catch (error) {
|
|
664
730
|
console.log(chalk4.red("Auth Ui Tanstack State Error: ", error));
|
|
665
731
|
}
|
|
666
732
|
};
|
|
667
733
|
|
|
668
|
-
// script/
|
|
669
|
-
var
|
|
734
|
+
// script/prismaRunTanstackStart.ts
|
|
735
|
+
var prismaRunTanstackStart = async ({
|
|
670
736
|
authUi,
|
|
671
737
|
database,
|
|
672
738
|
cmd
|
|
@@ -750,7 +816,7 @@ BETTER_AUTH_URL=http://localhost:3000
|
|
|
750
816
|
}
|
|
751
817
|
const authTemplatePath = path5.resolve(
|
|
752
818
|
__dirname,
|
|
753
|
-
`./template/
|
|
819
|
+
`./template/TanstackStart/lib/${database}/auth.ts`
|
|
754
820
|
);
|
|
755
821
|
const authDestinationPath = path5.join(libPath, "auth.ts");
|
|
756
822
|
fs5.copyFileSync(authTemplatePath, authDestinationPath);
|
|
@@ -766,13 +832,13 @@ BETTER_AUTH_URL=http://localhost:3000
|
|
|
766
832
|
}
|
|
767
833
|
const authMiddlewareTemplatePath = path5.resolve(
|
|
768
834
|
__dirname,
|
|
769
|
-
`./template/
|
|
835
|
+
`./template/TanstackStart/middleware/auth.ts`
|
|
770
836
|
);
|
|
771
837
|
const authMiddlewareDestinationPath = path5.join(middlewarePath, "auth.ts");
|
|
772
838
|
fs5.copyFileSync(authMiddlewareTemplatePath, authMiddlewareDestinationPath);
|
|
773
839
|
const fileRouteTemplatePath = path5.resolve(
|
|
774
840
|
__dirname,
|
|
775
|
-
`./template/
|
|
841
|
+
`./template/TanstackStart/routes/$.ts`
|
|
776
842
|
);
|
|
777
843
|
const fileRouteDestinationPath = path5.join(
|
|
778
844
|
srcPath,
|
|
@@ -788,12 +854,22 @@ BETTER_AUTH_URL=http://localhost:3000
|
|
|
788
854
|
if (authUi) {
|
|
789
855
|
await authUiTanstackState({
|
|
790
856
|
packageJson: packageJson2,
|
|
791
|
-
cmd
|
|
857
|
+
cmd,
|
|
858
|
+
database: "prisma"
|
|
792
859
|
});
|
|
793
860
|
} else {
|
|
861
|
+
console.log(chalk5.green("\nCompleted installation successfully"));
|
|
862
|
+
console.log(chalk5.cyan("\nInstall Package:"));
|
|
863
|
+
console.log(chalk5.white(`\u2022 prisma ${database} schema
|
|
864
|
+
\u2022 better-auth`));
|
|
865
|
+
console.log(chalk5.cyan("\nFiles created:"));
|
|
794
866
|
console.log(
|
|
795
|
-
chalk5.
|
|
796
|
-
|
|
867
|
+
chalk5.white(
|
|
868
|
+
`\u2022 src/lib/auth.ts
|
|
869
|
+
\u2022 src/lib/auth-client.ts
|
|
870
|
+
\u2022 src/app/api/auth/[...all]/route.ts
|
|
871
|
+
\u2022 src/proxy.ts
|
|
872
|
+
`
|
|
797
873
|
)
|
|
798
874
|
);
|
|
799
875
|
}
|
|
@@ -802,12 +878,12 @@ BETTER_AUTH_URL=http://localhost:3000
|
|
|
802
878
|
}
|
|
803
879
|
};
|
|
804
880
|
|
|
805
|
-
// script/
|
|
881
|
+
// script/drizzleRunTanstackStart.ts
|
|
806
882
|
import chalk6 from "chalk";
|
|
807
883
|
import path6 from "path";
|
|
808
884
|
import fs6 from "fs";
|
|
809
885
|
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
810
|
-
var
|
|
886
|
+
var drizzleRunTanstackStart = async ({
|
|
811
887
|
authUi,
|
|
812
888
|
cmd
|
|
813
889
|
}) => {
|
|
@@ -849,7 +925,7 @@ BETTER_AUTH_URL=http://localhost:3000
|
|
|
849
925
|
}
|
|
850
926
|
const authTemplatePath = path6.resolve(
|
|
851
927
|
__dirname,
|
|
852
|
-
"./template/
|
|
928
|
+
"./template/TanstackStart/lib/auth-drizzle.ts"
|
|
853
929
|
);
|
|
854
930
|
const authDestinationPath = path6.join(libPath, "auth.ts");
|
|
855
931
|
fs6.copyFileSync(authTemplatePath, authDestinationPath);
|
|
@@ -883,13 +959,13 @@ BETTER_AUTH_URL=http://localhost:3000
|
|
|
883
959
|
}
|
|
884
960
|
const authMiddlewareTemplatePath = path6.resolve(
|
|
885
961
|
__dirname,
|
|
886
|
-
`./template/
|
|
962
|
+
`./template/TanstackStart/middleware/auth.ts`
|
|
887
963
|
);
|
|
888
964
|
const authMiddlewareDestinationPath = path6.join(middlewarePath, "auth.ts");
|
|
889
965
|
fs6.copyFileSync(authMiddlewareTemplatePath, authMiddlewareDestinationPath);
|
|
890
966
|
const fileRouteTemplatePath = path6.resolve(
|
|
891
967
|
__dirname,
|
|
892
|
-
`./template/
|
|
968
|
+
`./template/TanstackStart/routes/$.ts`
|
|
893
969
|
);
|
|
894
970
|
const fileRouteDestinationPath = path6.join(
|
|
895
971
|
srcPath,
|
|
@@ -905,12 +981,22 @@ BETTER_AUTH_URL=http://localhost:3000
|
|
|
905
981
|
if (authUi) {
|
|
906
982
|
await authUiTanstackState({
|
|
907
983
|
packageJson: packageJson2,
|
|
908
|
-
cmd
|
|
984
|
+
cmd,
|
|
985
|
+
database: "drizzle"
|
|
909
986
|
});
|
|
910
987
|
} else {
|
|
988
|
+
console.log(chalk6.green("\nCompleted installation successfully"));
|
|
989
|
+
console.log(chalk6.cyan("\nInstall Package:"));
|
|
990
|
+
console.log(chalk6.white(`\u2022 drizzle schema
|
|
991
|
+
\u2022 better-auth`));
|
|
992
|
+
console.log(chalk6.cyan("\nFiles created:"));
|
|
911
993
|
console.log(
|
|
912
|
-
chalk6.
|
|
913
|
-
|
|
994
|
+
chalk6.white(
|
|
995
|
+
`\u2022 src/lib/auth.ts
|
|
996
|
+
\u2022 src/lib/auth-client.ts
|
|
997
|
+
\u2022 src/app/api/auth/[...all]/route.ts
|
|
998
|
+
\u2022 src/proxy.ts
|
|
999
|
+
`
|
|
914
1000
|
)
|
|
915
1001
|
);
|
|
916
1002
|
}
|
|
@@ -943,7 +1029,7 @@ var getFramework = async () => {
|
|
|
943
1029
|
const hasTanstackState = packageJson2?.devDependencies?.["@tanstack/devtools-vite"] || packageJson2?.devDependencies?.["@tanstack/eslint-config"] || packageJson2?.devDependencies?.["@tanstack/react-start"];
|
|
944
1030
|
if (hasTanstackState) {
|
|
945
1031
|
return {
|
|
946
|
-
framework: "tanstack
|
|
1032
|
+
framework: "tanstack start",
|
|
947
1033
|
error: null
|
|
948
1034
|
};
|
|
949
1035
|
}
|
|
@@ -996,15 +1082,15 @@ var initAnswer = async () => {
|
|
|
996
1082
|
cmd: false
|
|
997
1083
|
});
|
|
998
1084
|
}
|
|
999
|
-
if (framework === "tanstack
|
|
1000
|
-
await
|
|
1085
|
+
if (framework === "tanstack start" && answers.orm === "Prisma") {
|
|
1086
|
+
await prismaRunTanstackStart({
|
|
1001
1087
|
authUi: answers.authUi,
|
|
1002
1088
|
database: answers.database,
|
|
1003
1089
|
cmd: false
|
|
1004
1090
|
});
|
|
1005
1091
|
}
|
|
1006
|
-
if (framework === "tanstack
|
|
1007
|
-
await
|
|
1092
|
+
if (framework === "tanstack start" && answers.orm === "Drizzle") {
|
|
1093
|
+
await drizzleRunTanstackStart({
|
|
1008
1094
|
authUi: answers.authUi,
|
|
1009
1095
|
cmd: false
|
|
1010
1096
|
});
|
|
@@ -1120,7 +1206,13 @@ GOOGLE_CLIENT_SECRET=
|
|
|
1120
1206
|
if (fs8.existsSync(componentTemplate)) {
|
|
1121
1207
|
fs8.copyFileSync(componentTemplate, componentDest);
|
|
1122
1208
|
}
|
|
1123
|
-
console.log(chalk8.green("Google provider added & merged successfully"));
|
|
1209
|
+
console.log(chalk8.green("Google provider added & merged successfully\n"));
|
|
1210
|
+
console.log(
|
|
1211
|
+
chalk8.white(
|
|
1212
|
+
`${CreateFolder({ srcFolder: folder, destFolder: "components/authverse/GoogleOAuthButton.tsx" })}
|
|
1213
|
+
`
|
|
1214
|
+
)
|
|
1215
|
+
);
|
|
1124
1216
|
} catch (error) {
|
|
1125
1217
|
console.log(chalk8.red("googleRun error:"), error);
|
|
1126
1218
|
}
|
|
@@ -1229,18 +1321,24 @@ GITHUB_CLIENT_SECRET=
|
|
|
1229
1321
|
if (fs9.existsSync(componentTemplate)) {
|
|
1230
1322
|
fs9.copyFileSync(componentTemplate, componentDest);
|
|
1231
1323
|
}
|
|
1232
|
-
console.log(chalk9.green("GitHub provider added & merged successfully"));
|
|
1324
|
+
console.log(chalk9.green("GitHub provider added & merged successfully\n"));
|
|
1325
|
+
console.log(
|
|
1326
|
+
chalk9.white(
|
|
1327
|
+
`${CreateFolder({ srcFolder: folder, destFolder: "components/authverse/GithubOAuthButton.tsx" })}
|
|
1328
|
+
`
|
|
1329
|
+
)
|
|
1330
|
+
);
|
|
1233
1331
|
} catch (error) {
|
|
1234
1332
|
console.log(chalk9.red("githubRun error:"), error);
|
|
1235
1333
|
}
|
|
1236
1334
|
};
|
|
1237
1335
|
|
|
1238
|
-
// oauth/
|
|
1336
|
+
// oauth/googleTanstackStart.ts
|
|
1239
1337
|
import chalk10 from "chalk";
|
|
1240
1338
|
import fs10 from "fs";
|
|
1241
1339
|
import path10 from "path";
|
|
1242
1340
|
import { fileURLToPath as fileURLToPath9 } from "url";
|
|
1243
|
-
var
|
|
1341
|
+
var googleTanstackStart = async () => {
|
|
1244
1342
|
try {
|
|
1245
1343
|
const __filename = fileURLToPath9(import.meta.url);
|
|
1246
1344
|
const __dirname = path10.dirname(__filename);
|
|
@@ -1322,7 +1420,7 @@ GOOGLE_CLIENT_SECRET=
|
|
|
1322
1420
|
}
|
|
1323
1421
|
const componentTemplate = path10.resolve(
|
|
1324
1422
|
__dirname,
|
|
1325
|
-
"./template/
|
|
1423
|
+
"./template/TanstackStart/components/GoogleOAuthButton.tsx"
|
|
1326
1424
|
);
|
|
1327
1425
|
const componentsDir = path10.join(srcPath, "components", "authverse");
|
|
1328
1426
|
if (!fs10.existsSync(componentsDir)) {
|
|
@@ -1332,18 +1430,21 @@ GOOGLE_CLIENT_SECRET=
|
|
|
1332
1430
|
if (fs10.existsSync(componentTemplate)) {
|
|
1333
1431
|
fs10.copyFileSync(componentTemplate, componentDest);
|
|
1334
1432
|
}
|
|
1335
|
-
console.log(chalk10.green("Google provider added & merged successfully"));
|
|
1433
|
+
console.log(chalk10.green("Google provider added & merged successfully\n"));
|
|
1434
|
+
console.log(
|
|
1435
|
+
chalk10.white("\u2022 src/components/authverse/GoogleOAuthButton.tsx")
|
|
1436
|
+
);
|
|
1336
1437
|
} catch (error) {
|
|
1337
1438
|
console.log(chalk10.red("googleRunTanstackState error:"), error);
|
|
1338
1439
|
}
|
|
1339
1440
|
};
|
|
1340
1441
|
|
|
1341
|
-
// oauth/
|
|
1442
|
+
// oauth/githubTanstackStart.ts
|
|
1342
1443
|
import chalk11 from "chalk";
|
|
1343
1444
|
import fs11 from "fs";
|
|
1344
1445
|
import path11 from "path";
|
|
1345
1446
|
import { fileURLToPath as fileURLToPath10 } from "url";
|
|
1346
|
-
var
|
|
1447
|
+
var githubTanstackStart = async () => {
|
|
1347
1448
|
try {
|
|
1348
1449
|
const __filename = fileURLToPath10(import.meta.url);
|
|
1349
1450
|
const __dirname = path11.dirname(__filename);
|
|
@@ -1425,7 +1526,7 @@ GITHUB_CLIENT_SECRET=
|
|
|
1425
1526
|
}
|
|
1426
1527
|
const componentTemplate = path11.resolve(
|
|
1427
1528
|
__dirname,
|
|
1428
|
-
"./template/
|
|
1529
|
+
"./template/TanstackStart/components/GithubOAuthButton.tsx"
|
|
1429
1530
|
);
|
|
1430
1531
|
const componentsDir = path11.join(srcPath, "components", "authverse");
|
|
1431
1532
|
if (!fs11.existsSync(componentsDir)) {
|
|
@@ -1435,7 +1536,10 @@ GITHUB_CLIENT_SECRET=
|
|
|
1435
1536
|
if (fs11.existsSync(componentTemplate)) {
|
|
1436
1537
|
fs11.copyFileSync(componentTemplate, componentDest);
|
|
1437
1538
|
}
|
|
1438
|
-
console.log(chalk11.green("Github provider added & merged successfully"));
|
|
1539
|
+
console.log(chalk11.green("Github provider added & merged successfully\n"));
|
|
1540
|
+
console.log(
|
|
1541
|
+
chalk11.white("\u2022 src/components/authverse/GithubOAuthButton.tsx")
|
|
1542
|
+
);
|
|
1439
1543
|
} catch (error) {
|
|
1440
1544
|
console.log(chalk11.red("githubRunTanstackState error:"), error);
|
|
1441
1545
|
}
|
|
@@ -1544,18 +1648,24 @@ FACEBOOK_CLIENT_SECRET=
|
|
|
1544
1648
|
if (fs12.existsSync(componentTemplate)) {
|
|
1545
1649
|
fs12.copyFileSync(componentTemplate, componentDest);
|
|
1546
1650
|
}
|
|
1547
|
-
console.log(chalk12.green("Facebook provider added & merged successfully"));
|
|
1651
|
+
console.log(chalk12.green("Facebook provider added & merged successfully\n"));
|
|
1652
|
+
console.log(
|
|
1653
|
+
chalk12.white(
|
|
1654
|
+
`${CreateFolder({ srcFolder: folder, destFolder: "components/authverse/FacebookOAuthButton.tsx" })}
|
|
1655
|
+
`
|
|
1656
|
+
)
|
|
1657
|
+
);
|
|
1548
1658
|
} catch (error) {
|
|
1549
1659
|
console.log(chalk12.red("facebookRun error:"), error);
|
|
1550
1660
|
}
|
|
1551
1661
|
};
|
|
1552
1662
|
|
|
1553
|
-
// oauth/
|
|
1663
|
+
// oauth/facebookTanstackStart.ts
|
|
1554
1664
|
import chalk13 from "chalk";
|
|
1555
1665
|
import fs13 from "fs";
|
|
1556
1666
|
import path13 from "path";
|
|
1557
1667
|
import { fileURLToPath as fileURLToPath12 } from "url";
|
|
1558
|
-
var
|
|
1668
|
+
var facebookTanstackStart = async () => {
|
|
1559
1669
|
try {
|
|
1560
1670
|
const __filename = fileURLToPath12(import.meta.url);
|
|
1561
1671
|
const __dirname = path13.dirname(__filename);
|
|
@@ -1637,7 +1747,7 @@ FACEBOOK_CLIENT_SECRET=
|
|
|
1637
1747
|
}
|
|
1638
1748
|
const componentTemplate = path13.resolve(
|
|
1639
1749
|
__dirname,
|
|
1640
|
-
"./template/
|
|
1750
|
+
"./template/TanstackStart/components/FacebookOAuthButton.tsx"
|
|
1641
1751
|
);
|
|
1642
1752
|
const componentsDir = path13.join(srcPath, "components", "authverse");
|
|
1643
1753
|
if (!fs13.existsSync(componentsDir)) {
|
|
@@ -1647,7 +1757,10 @@ FACEBOOK_CLIENT_SECRET=
|
|
|
1647
1757
|
if (fs13.existsSync(componentTemplate)) {
|
|
1648
1758
|
fs13.copyFileSync(componentTemplate, componentDest);
|
|
1649
1759
|
}
|
|
1650
|
-
console.log(chalk13.green("Facebook provider added & merged successfully"));
|
|
1760
|
+
console.log(chalk13.green("Facebook provider added & merged successfully\n"));
|
|
1761
|
+
console.log(
|
|
1762
|
+
chalk13.white("\u2022 src/components/authverse/FacebookOAuthButton.tsx")
|
|
1763
|
+
);
|
|
1651
1764
|
} catch (error) {
|
|
1652
1765
|
console.log(chalk13.red("facebookRunTanstackState error:"), error);
|
|
1653
1766
|
}
|
|
@@ -1756,18 +1869,24 @@ LINKEDIN_CLIENT_SECRET=
|
|
|
1756
1869
|
if (fs14.existsSync(componentTemplate)) {
|
|
1757
1870
|
fs14.copyFileSync(componentTemplate, componentDest);
|
|
1758
1871
|
}
|
|
1759
|
-
console.log(chalk14.green("LinkedIn provider added & merged successfully"));
|
|
1872
|
+
console.log(chalk14.green("LinkedIn provider added & merged successfully\n"));
|
|
1873
|
+
console.log(
|
|
1874
|
+
chalk14.white(
|
|
1875
|
+
`${CreateFolder({ srcFolder: folder, destFolder: "components/authverse/LinkedInOAuthButton.tsx" })}
|
|
1876
|
+
`
|
|
1877
|
+
)
|
|
1878
|
+
);
|
|
1760
1879
|
} catch (error) {
|
|
1761
1880
|
console.log(chalk14.red("LinkedIn error:"), error);
|
|
1762
1881
|
}
|
|
1763
1882
|
};
|
|
1764
1883
|
|
|
1765
|
-
// oauth/
|
|
1884
|
+
// oauth/LinkedInTanstackStart.ts
|
|
1766
1885
|
import chalk15 from "chalk";
|
|
1767
1886
|
import fs15 from "fs";
|
|
1768
1887
|
import path15 from "path";
|
|
1769
1888
|
import { fileURLToPath as fileURLToPath14 } from "url";
|
|
1770
|
-
var
|
|
1889
|
+
var LinkedInTanstackStart = async () => {
|
|
1771
1890
|
try {
|
|
1772
1891
|
const __filename = fileURLToPath14(import.meta.url);
|
|
1773
1892
|
const __dirname = path15.dirname(__filename);
|
|
@@ -1849,7 +1968,7 @@ LINKEDIN_CLIENT_SECRET=
|
|
|
1849
1968
|
}
|
|
1850
1969
|
const componentTemplate = path15.resolve(
|
|
1851
1970
|
__dirname,
|
|
1852
|
-
"./template/
|
|
1971
|
+
"./template/TanstackStart/components/LinkedInOAuthButton.tsx"
|
|
1853
1972
|
);
|
|
1854
1973
|
const componentsDir = path15.join(srcPath, "components", "authverse");
|
|
1855
1974
|
if (!fs15.existsSync(componentsDir)) {
|
|
@@ -1859,7 +1978,10 @@ LINKEDIN_CLIENT_SECRET=
|
|
|
1859
1978
|
if (fs15.existsSync(componentTemplate)) {
|
|
1860
1979
|
fs15.copyFileSync(componentTemplate, componentDest);
|
|
1861
1980
|
}
|
|
1862
|
-
console.log(chalk15.green("LinkedIn provider added & merged successfully"));
|
|
1981
|
+
console.log(chalk15.green("LinkedIn provider added & merged successfully\n"));
|
|
1982
|
+
console.log(
|
|
1983
|
+
chalk15.white("\u2022 src/components/authverse/LinkedInOAuthButton.tsx")
|
|
1984
|
+
);
|
|
1863
1985
|
} catch (error) {
|
|
1864
1986
|
console.log(chalk15.red("LinkedInTanstackState error:"), error);
|
|
1865
1987
|
}
|
|
@@ -1968,18 +2090,24 @@ TWITTER_CLIENT_SECRET=
|
|
|
1968
2090
|
if (fs16.existsSync(componentTemplate)) {
|
|
1969
2091
|
fs16.copyFileSync(componentTemplate, componentDest);
|
|
1970
2092
|
}
|
|
1971
|
-
console.log(chalk16.green("
|
|
2093
|
+
console.log(chalk16.green("Twitter provider added & merged successfully\n"));
|
|
2094
|
+
console.log(
|
|
2095
|
+
chalk16.white(
|
|
2096
|
+
`${CreateFolder({ srcFolder: folder, destFolder: "components/authverse/TwitterOAuthButton.tsx" })}
|
|
2097
|
+
`
|
|
2098
|
+
)
|
|
2099
|
+
);
|
|
1972
2100
|
} catch (error) {
|
|
1973
2101
|
console.log(chalk16.red("twitter error:"), error);
|
|
1974
2102
|
}
|
|
1975
2103
|
};
|
|
1976
2104
|
|
|
1977
|
-
// oauth/
|
|
2105
|
+
// oauth/twitterTanstackStart.ts
|
|
1978
2106
|
import chalk17 from "chalk";
|
|
1979
2107
|
import fs17 from "fs";
|
|
1980
2108
|
import path17 from "path";
|
|
1981
2109
|
import { fileURLToPath as fileURLToPath16 } from "url";
|
|
1982
|
-
var
|
|
2110
|
+
var twitterTanstackStart = async () => {
|
|
1983
2111
|
try {
|
|
1984
2112
|
const __filename = fileURLToPath16(import.meta.url);
|
|
1985
2113
|
const __dirname = path17.dirname(__filename);
|
|
@@ -2061,7 +2189,7 @@ TWITTER_CLIENT_SECRET=
|
|
|
2061
2189
|
}
|
|
2062
2190
|
const componentTemplate = path17.resolve(
|
|
2063
2191
|
__dirname,
|
|
2064
|
-
"./template/
|
|
2192
|
+
"./template/TanstackStart/components/twitterOAuthButton.tsx"
|
|
2065
2193
|
);
|
|
2066
2194
|
const componentsDir = path17.join(srcPath, "components", "authverse");
|
|
2067
2195
|
if (!fs17.existsSync(componentsDir)) {
|
|
@@ -2071,7 +2199,10 @@ TWITTER_CLIENT_SECRET=
|
|
|
2071
2199
|
if (fs17.existsSync(componentTemplate)) {
|
|
2072
2200
|
fs17.copyFileSync(componentTemplate, componentDest);
|
|
2073
2201
|
}
|
|
2074
|
-
console.log(chalk17.green("twitter provider added & merged successfully"));
|
|
2202
|
+
console.log(chalk17.green("twitter provider added & merged successfully\n"));
|
|
2203
|
+
console.log(
|
|
2204
|
+
chalk17.white("\u2022 src/components/authverse/twitterOAuthButton.tsx")
|
|
2205
|
+
);
|
|
2075
2206
|
} catch (error) {
|
|
2076
2207
|
console.log(chalk17.red("twitter tanstack state error:"), error);
|
|
2077
2208
|
}
|
|
@@ -2197,18 +2328,24 @@ APPLE_BUNDLE_ID=
|
|
|
2197
2328
|
if (fs18.existsSync(componentTemplate)) {
|
|
2198
2329
|
fs18.copyFileSync(componentTemplate, componentDest);
|
|
2199
2330
|
}
|
|
2200
|
-
console.log(chalk18.green("Apple provider added & merged successfully"));
|
|
2331
|
+
console.log(chalk18.green("Apple provider added & merged successfully\n"));
|
|
2332
|
+
console.log(
|
|
2333
|
+
chalk18.white(
|
|
2334
|
+
`${CreateFolder({ srcFolder: folder, destFolder: "components/authverse/AppleOAuthButton.tsx" })}
|
|
2335
|
+
`
|
|
2336
|
+
)
|
|
2337
|
+
);
|
|
2201
2338
|
} catch (error) {
|
|
2202
2339
|
console.log(chalk18.red("apple next error:"), error);
|
|
2203
2340
|
}
|
|
2204
2341
|
};
|
|
2205
2342
|
|
|
2206
|
-
// oauth/
|
|
2343
|
+
// oauth/AppleTanstackStart.ts
|
|
2207
2344
|
import chalk19 from "chalk";
|
|
2208
2345
|
import fs19 from "fs";
|
|
2209
2346
|
import path19 from "path";
|
|
2210
2347
|
import { fileURLToPath as fileURLToPath18 } from "url";
|
|
2211
|
-
var
|
|
2348
|
+
var AppleTanstackStart = async () => {
|
|
2212
2349
|
try {
|
|
2213
2350
|
const __filename = fileURLToPath18(import.meta.url);
|
|
2214
2351
|
const __dirname = path19.dirname(__filename);
|
|
@@ -2307,7 +2444,7 @@ APPLE_BUNDLE_ID=
|
|
|
2307
2444
|
}
|
|
2308
2445
|
const componentTemplate = path19.resolve(
|
|
2309
2446
|
__dirname,
|
|
2310
|
-
"./template/
|
|
2447
|
+
"./template/TanstackStart/components/AppleOAuthButton.tsx"
|
|
2311
2448
|
);
|
|
2312
2449
|
const componentsDir = path19.join(srcPath, "components", "authverse");
|
|
2313
2450
|
if (!fs19.existsSync(componentsDir)) {
|
|
@@ -2317,7 +2454,8 @@ APPLE_BUNDLE_ID=
|
|
|
2317
2454
|
if (fs19.existsSync(componentTemplate)) {
|
|
2318
2455
|
fs19.copyFileSync(componentTemplate, componentDest);
|
|
2319
2456
|
}
|
|
2320
|
-
console.log(chalk19.green("Apple provider added & merged successfully"));
|
|
2457
|
+
console.log(chalk19.green("Apple provider added & merged successfully\n"));
|
|
2458
|
+
console.log(chalk19.white("\u2022 src/components/authverse/AppleOAuthButton.tsx"));
|
|
2321
2459
|
} catch (error) {
|
|
2322
2460
|
console.log(chalk19.red("apple tanstack state error:"), error);
|
|
2323
2461
|
}
|
|
@@ -2336,30 +2474,30 @@ var Oauth = async ({ oauth }) => {
|
|
|
2336
2474
|
} else if (framework === "Next js" && oauth == "github") {
|
|
2337
2475
|
await githubNext();
|
|
2338
2476
|
}
|
|
2339
|
-
if (framework === "tanstack
|
|
2340
|
-
await
|
|
2341
|
-
} else if (framework === "tanstack
|
|
2342
|
-
await
|
|
2477
|
+
if (framework === "tanstack start" && oauth == "google") {
|
|
2478
|
+
await googleTanstackStart();
|
|
2479
|
+
} else if (framework === "tanstack start" && oauth == "github") {
|
|
2480
|
+
await githubTanstackStart();
|
|
2343
2481
|
}
|
|
2344
2482
|
if (framework === "Next js" && oauth == "facebook") {
|
|
2345
2483
|
await facebookNext();
|
|
2346
|
-
} else if (framework === "tanstack
|
|
2347
|
-
await
|
|
2484
|
+
} else if (framework === "tanstack start" && oauth == "facebook") {
|
|
2485
|
+
await facebookTanstackStart();
|
|
2348
2486
|
}
|
|
2349
2487
|
if (framework === "Next js" && oauth === "LinkedIn") {
|
|
2350
2488
|
await LinkedInNext();
|
|
2351
|
-
} else if (framework === "tanstack
|
|
2352
|
-
await
|
|
2489
|
+
} else if (framework === "tanstack start" && oauth === "LinkedIn") {
|
|
2490
|
+
await LinkedInTanstackStart();
|
|
2353
2491
|
}
|
|
2354
2492
|
if (framework === "Next js" && oauth === "twitter") {
|
|
2355
2493
|
await twitterNext();
|
|
2356
|
-
} else if (framework === "tanstack
|
|
2357
|
-
await
|
|
2494
|
+
} else if (framework === "tanstack start" && oauth === "twitter") {
|
|
2495
|
+
await twitterTanstackStart();
|
|
2358
2496
|
}
|
|
2359
2497
|
if (framework === "Next js" && oauth === "apple") {
|
|
2360
2498
|
await AppleNext();
|
|
2361
|
-
} else if (framework === "tanstack
|
|
2362
|
-
await
|
|
2499
|
+
} else if (framework === "tanstack start" && oauth === "apple") {
|
|
2500
|
+
await AppleTanstackStart();
|
|
2363
2501
|
}
|
|
2364
2502
|
if (oauth !== "google" && oauth !== "github" && oauth !== "facebook" && oauth !== "LinkedIn" && oauth !== "twitter" && oauth !== "apple") {
|
|
2365
2503
|
console.log(chalk20.red("Invalid oauth provider"));
|
|
@@ -2403,6 +2541,10 @@ var gmailRun = async () => {
|
|
|
2403
2541
|
console.log(chalk21.cyan("\n\u2699\uFE0F Installing @react-email/components...\n"));
|
|
2404
2542
|
packageManager("@react-email/components");
|
|
2405
2543
|
}
|
|
2544
|
+
if (!packageJson2.dependencies?.["@react-email/render"]) {
|
|
2545
|
+
console.log(chalk21.cyan("\n\u2699\uFE0F Installing @react-email/render...\n"));
|
|
2546
|
+
packageManager("@react-email/render");
|
|
2547
|
+
}
|
|
2406
2548
|
const envPath = path20.join(projectDir, ".env");
|
|
2407
2549
|
const envContent = fs20.readFileSync(envPath, "utf8");
|
|
2408
2550
|
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")) {
|
|
@@ -2432,17 +2574,33 @@ GMAIL_PASSWORD=`);
|
|
|
2432
2574
|
}
|
|
2433
2575
|
const libDestinationPath = path20.join(libPath, "email.ts");
|
|
2434
2576
|
fs20.copyFileSync(templatePath, libDestinationPath);
|
|
2577
|
+
console.log(chalk21.green("\nCompleted installation successfully"));
|
|
2578
|
+
console.log(chalk21.cyan("\nInstall Package:"));
|
|
2579
|
+
console.log(
|
|
2580
|
+
chalk21.white(
|
|
2581
|
+
`\u2022 nodemailer
|
|
2582
|
+
\u2022 @react-email/components
|
|
2583
|
+
\u2022 @react-email/render`
|
|
2584
|
+
)
|
|
2585
|
+
);
|
|
2586
|
+
console.log(chalk21.cyan("\nFiles created:"));
|
|
2587
|
+
console.log(
|
|
2588
|
+
chalk21.white(
|
|
2589
|
+
`${CreateFolder({ srcFolder, destFolder: "lib/email.ts" })}
|
|
2590
|
+
`
|
|
2591
|
+
)
|
|
2592
|
+
);
|
|
2435
2593
|
} catch (error) {
|
|
2436
2594
|
console.log(chalk21.red(error));
|
|
2437
2595
|
}
|
|
2438
2596
|
};
|
|
2439
2597
|
|
|
2440
|
-
// email/
|
|
2598
|
+
// email/gmailRunTanstackStart.ts
|
|
2441
2599
|
import chalk22 from "chalk";
|
|
2442
2600
|
import path21 from "path";
|
|
2443
2601
|
import fs21 from "fs";
|
|
2444
2602
|
import { fileURLToPath as fileURLToPath20 } from "url";
|
|
2445
|
-
var
|
|
2603
|
+
var gmailRunTanstackStart = async () => {
|
|
2446
2604
|
try {
|
|
2447
2605
|
const projectDir = process.cwd();
|
|
2448
2606
|
const packageJsonPath = path21.join(projectDir, "package.json");
|
|
@@ -2458,6 +2616,10 @@ var gmailRunTanstackState = async () => {
|
|
|
2458
2616
|
console.log(chalk22.cyan("\n\u2699\uFE0F Installing @react-email/components...\n"));
|
|
2459
2617
|
packageManager("@react-email/components");
|
|
2460
2618
|
}
|
|
2619
|
+
if (!packageJson2.dependencies?.["@react-email/render"]) {
|
|
2620
|
+
console.log(chalk22.cyan("\n\u2699\uFE0F Installing @react-email/render...\n"));
|
|
2621
|
+
packageManager("@react-email/render");
|
|
2622
|
+
}
|
|
2461
2623
|
const envPath = path21.join(projectDir, ".env");
|
|
2462
2624
|
const envContent = fs21.readFileSync(envPath, "utf8");
|
|
2463
2625
|
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")) {
|
|
@@ -2487,6 +2649,17 @@ GMAIL_PASSWORD=`);
|
|
|
2487
2649
|
}
|
|
2488
2650
|
const libDestinationPath = path21.join(libPath, "email.ts");
|
|
2489
2651
|
fs21.copyFileSync(templatePath, libDestinationPath);
|
|
2652
|
+
console.log(chalk22.green("\nCompleted installation successfully"));
|
|
2653
|
+
console.log(chalk22.cyan("\nInstall Package:"));
|
|
2654
|
+
console.log(
|
|
2655
|
+
chalk22.white(
|
|
2656
|
+
`\u2022 nodemailer
|
|
2657
|
+
\u2022 @react-email/components
|
|
2658
|
+
\u2022 @react-email/render`
|
|
2659
|
+
)
|
|
2660
|
+
);
|
|
2661
|
+
console.log(chalk22.cyan("\nFiles created:"));
|
|
2662
|
+
console.log(chalk22.white("\u2022 src/lib/email.ts\n"));
|
|
2490
2663
|
} catch (error) {
|
|
2491
2664
|
console.log(chalk22.red(error));
|
|
2492
2665
|
}
|
|
@@ -2514,6 +2687,10 @@ var awsSesRun = async () => {
|
|
|
2514
2687
|
console.log(chalk23.cyan("\n\u2699\uFE0F Installing @react-email/components...\n"));
|
|
2515
2688
|
packageManager("@react-email/components");
|
|
2516
2689
|
}
|
|
2690
|
+
if (!packageJson2.dependencies?.["@react-email/render"]) {
|
|
2691
|
+
console.log(chalk23.cyan("\n\u2699\uFE0F Installing @react-email/render...\n"));
|
|
2692
|
+
packageManager("@react-email/render");
|
|
2693
|
+
}
|
|
2517
2694
|
const envPath = path22.join(projectDir, ".env");
|
|
2518
2695
|
const envContent = fs22.readFileSync(envPath, "utf8");
|
|
2519
2696
|
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")) {
|
|
@@ -2543,17 +2720,33 @@ AWS_SES_FROM=`);
|
|
|
2543
2720
|
}
|
|
2544
2721
|
const libDestinationPath = path22.join(libPath, "email.ts");
|
|
2545
2722
|
fs22.copyFileSync(templatePath, libDestinationPath);
|
|
2723
|
+
console.log(chalk23.green("\nCompleted installation successfully"));
|
|
2724
|
+
console.log(chalk23.cyan("\nInstall Package:"));
|
|
2725
|
+
console.log(
|
|
2726
|
+
chalk23.white(
|
|
2727
|
+
`\u2022 nodemailer
|
|
2728
|
+
\u2022 @react-email/components
|
|
2729
|
+
\u2022 @react-email/render`
|
|
2730
|
+
)
|
|
2731
|
+
);
|
|
2732
|
+
console.log(chalk23.cyan("\nFiles created:"));
|
|
2733
|
+
console.log(
|
|
2734
|
+
chalk23.white(
|
|
2735
|
+
`${CreateFolder({ srcFolder, destFolder: "lib/email.ts" })}
|
|
2736
|
+
`
|
|
2737
|
+
)
|
|
2738
|
+
);
|
|
2546
2739
|
} catch (error) {
|
|
2547
2740
|
console.log(chalk23.red(error));
|
|
2548
2741
|
}
|
|
2549
2742
|
};
|
|
2550
2743
|
|
|
2551
|
-
// email/
|
|
2744
|
+
// email/awsSesRunTanstackStart.ts
|
|
2552
2745
|
import chalk24 from "chalk";
|
|
2553
2746
|
import path23 from "path";
|
|
2554
2747
|
import fs23 from "fs";
|
|
2555
2748
|
import { fileURLToPath as fileURLToPath22 } from "url";
|
|
2556
|
-
var
|
|
2749
|
+
var awsSesRunTanstackStart = async () => {
|
|
2557
2750
|
try {
|
|
2558
2751
|
const projectDir = process.cwd();
|
|
2559
2752
|
const packageJsonPath = path23.join(projectDir, "package.json");
|
|
@@ -2569,6 +2762,10 @@ var awsSesRunTanstackState = async () => {
|
|
|
2569
2762
|
console.log(chalk24.cyan("\n\u2699\uFE0F Installing @react-email/components...\n"));
|
|
2570
2763
|
packageManager("@react-email/components");
|
|
2571
2764
|
}
|
|
2765
|
+
if (!packageJson2.dependencies?.["@react-email/render"]) {
|
|
2766
|
+
console.log(chalk24.cyan("\n\u2699\uFE0F Installing @react-email/render...\n"));
|
|
2767
|
+
packageManager("@react-email/render");
|
|
2768
|
+
}
|
|
2572
2769
|
const envPath = path23.join(projectDir, ".env");
|
|
2573
2770
|
const envContent = fs23.readFileSync(envPath, "utf8");
|
|
2574
2771
|
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")) {
|
|
@@ -2598,6 +2795,17 @@ AWS_SES_FROM=`);
|
|
|
2598
2795
|
}
|
|
2599
2796
|
const libDestinationPath = path23.join(libPath, "email.ts");
|
|
2600
2797
|
fs23.copyFileSync(templatePath, libDestinationPath);
|
|
2798
|
+
console.log(chalk24.green("\nCompleted installation successfully"));
|
|
2799
|
+
console.log(chalk24.cyan("\nInstall Package:"));
|
|
2800
|
+
console.log(
|
|
2801
|
+
chalk24.white(
|
|
2802
|
+
`\u2022 nodemailer
|
|
2803
|
+
\u2022 @react-email/components
|
|
2804
|
+
\u2022 @react-email/render`
|
|
2805
|
+
)
|
|
2806
|
+
);
|
|
2807
|
+
console.log(chalk24.cyan("\nFiles created:"));
|
|
2808
|
+
console.log(chalk24.white("\u2022 src/lib/email.ts\n"));
|
|
2601
2809
|
} catch (error) {
|
|
2602
2810
|
console.log(chalk24.red(error));
|
|
2603
2811
|
}
|
|
@@ -2624,6 +2832,10 @@ var resendRun = async () => {
|
|
|
2624
2832
|
console.log(chalk25.cyan("\n\u2699\uFE0F Installing @react-email/components...\n"));
|
|
2625
2833
|
packageManager("@react-email/components");
|
|
2626
2834
|
}
|
|
2835
|
+
if (!packageJson2.dependencies?.["@react-email/render"]) {
|
|
2836
|
+
console.log(chalk25.cyan("\n\u2699\uFE0F Installing @react-email/render...\n"));
|
|
2837
|
+
packageManager("@react-email/render");
|
|
2838
|
+
}
|
|
2627
2839
|
const envPath = path24.join(projectDir, ".env");
|
|
2628
2840
|
const envContent = fs24.readFileSync(envPath, "utf8");
|
|
2629
2841
|
if (!envContent.includes("RESEND_API_KEY") && !envContent.includes("EMAIL_SENDER_NAME") && !envContent.includes("EMAIL_SENDER_ADDRESS")) {
|
|
@@ -2647,17 +2859,31 @@ EMAIL_SENDER_ADDRESS=`);
|
|
|
2647
2859
|
}
|
|
2648
2860
|
const libDestinationPath = path24.join(libPath, "email.ts");
|
|
2649
2861
|
fs24.copyFileSync(templatePath, libDestinationPath);
|
|
2862
|
+
console.log(chalk25.green("\nCompleted installation successfully"));
|
|
2863
|
+
console.log(chalk25.cyan("\nInstall Package:"));
|
|
2864
|
+
console.log(
|
|
2865
|
+
chalk25.white(`\u2022 resend
|
|
2866
|
+
\u2022 @react-email/components
|
|
2867
|
+
\u2022 @react-email/render`)
|
|
2868
|
+
);
|
|
2869
|
+
console.log(chalk25.cyan("\nFiles created:"));
|
|
2870
|
+
console.log(
|
|
2871
|
+
chalk25.white(
|
|
2872
|
+
`${CreateFolder({ srcFolder, destFolder: "lib/email.ts" })}
|
|
2873
|
+
`
|
|
2874
|
+
)
|
|
2875
|
+
);
|
|
2650
2876
|
} catch (error) {
|
|
2651
2877
|
console.log(chalk25.red(error));
|
|
2652
2878
|
}
|
|
2653
2879
|
};
|
|
2654
2880
|
|
|
2655
|
-
// email/
|
|
2881
|
+
// email/resendRunTanstackStart.ts
|
|
2656
2882
|
import chalk26 from "chalk";
|
|
2657
2883
|
import path25 from "path";
|
|
2658
2884
|
import fs25 from "fs";
|
|
2659
2885
|
import { fileURLToPath as fileURLToPath24 } from "url";
|
|
2660
|
-
var
|
|
2886
|
+
var resendRunTanstackStart = async () => {
|
|
2661
2887
|
try {
|
|
2662
2888
|
const projectDir = process.cwd();
|
|
2663
2889
|
const packageJsonPath = path25.join(projectDir, "package.json");
|
|
@@ -2695,6 +2921,15 @@ EMAIL_SENDER_ADDRESS=`);
|
|
|
2695
2921
|
}
|
|
2696
2922
|
const libDestinationPath = path25.join(libPath, "email.ts");
|
|
2697
2923
|
fs25.copyFileSync(templatePath, libDestinationPath);
|
|
2924
|
+
console.log(chalk26.green("\nCompleted installation successfully"));
|
|
2925
|
+
console.log(chalk26.cyan("\nInstall Package:"));
|
|
2926
|
+
console.log(
|
|
2927
|
+
chalk26.white(`\u2022 resend
|
|
2928
|
+
\u2022 @react-email/components
|
|
2929
|
+
\u2022 @react-email/render`)
|
|
2930
|
+
);
|
|
2931
|
+
console.log(chalk26.cyan("\nFiles created:"));
|
|
2932
|
+
console.log(chalk26.white("\u2022 src/lib/email.ts\n"));
|
|
2698
2933
|
} catch (error) {
|
|
2699
2934
|
console.log(chalk26.red(error));
|
|
2700
2935
|
}
|
|
@@ -2726,7 +2961,7 @@ var email = async () => {
|
|
|
2726
2961
|
}
|
|
2727
2962
|
}
|
|
2728
2963
|
}
|
|
2729
|
-
if (framework === "tanstack
|
|
2964
|
+
if (framework === "tanstack start") {
|
|
2730
2965
|
const srcFolderTanstackState = path26.join(projectDir, "src");
|
|
2731
2966
|
const libPathTanstackState = path26.join(
|
|
2732
2967
|
srcFolderTanstackState,
|
|
@@ -2757,20 +2992,20 @@ var email = async () => {
|
|
|
2757
2992
|
if (answers.emailProvider === "Gmail" && framework === "Next js") {
|
|
2758
2993
|
await gmailRun();
|
|
2759
2994
|
}
|
|
2760
|
-
if (answers.emailProvider === "Gmail" && framework === "tanstack
|
|
2761
|
-
await
|
|
2995
|
+
if (answers.emailProvider === "Gmail" && framework === "tanstack start") {
|
|
2996
|
+
await gmailRunTanstackStart();
|
|
2762
2997
|
}
|
|
2763
2998
|
if (answers.emailProvider === "AWS SES" && framework === "Next js") {
|
|
2764
2999
|
await awsSesRun();
|
|
2765
3000
|
}
|
|
2766
|
-
if (answers.emailProvider === "AWS SES" && framework === "tanstack
|
|
2767
|
-
await
|
|
3001
|
+
if (answers.emailProvider === "AWS SES" && framework === "tanstack start") {
|
|
3002
|
+
await awsSesRunTanstackStart();
|
|
2768
3003
|
}
|
|
2769
3004
|
if (answers.emailProvider === "Resend" && framework === "Next js") {
|
|
2770
3005
|
await resendRun();
|
|
2771
3006
|
}
|
|
2772
|
-
if (answers.emailProvider === "Resend" && framework === "tanstack
|
|
2773
|
-
await
|
|
3007
|
+
if (answers.emailProvider === "Resend" && framework === "tanstack start") {
|
|
3008
|
+
await resendRunTanstackStart();
|
|
2774
3009
|
}
|
|
2775
3010
|
};
|
|
2776
3011
|
|
|
@@ -2792,7 +3027,7 @@ var forgetNext = async () => {
|
|
|
2792
3027
|
return;
|
|
2793
3028
|
}
|
|
2794
3029
|
let content = fs27.readFileSync(authFilePath, "utf8");
|
|
2795
|
-
const codeAdded = `
|
|
3030
|
+
const codeAdded = `sendResetPassword: async ({ user, url, token }) => {
|
|
2796
3031
|
await sendEmail({
|
|
2797
3032
|
email: user.email!,
|
|
2798
3033
|
subject: "Reset your password",
|
|
@@ -2824,25 +3059,28 @@ var forgetNext = async () => {
|
|
|
2824
3059
|
emailAndPasswordStart,
|
|
2825
3060
|
emailAndPasswordEnd
|
|
2826
3061
|
);
|
|
2827
|
-
if (emailAndPasswordContent.includes("sendResetPassword:")) {
|
|
2828
|
-
content = content.replace(
|
|
2829
|
-
/sendResetPassword:\s*async\s*\([^)]*\)[^{]*\{[^}]*\}[^,]*/,
|
|
2830
|
-
codeAdded
|
|
2831
|
-
);
|
|
2832
|
-
} else {
|
|
3062
|
+
if (!emailAndPasswordContent.includes("sendResetPassword:")) {
|
|
2833
3063
|
const before = content.substring(0, emailAndPasswordEnd);
|
|
2834
3064
|
const after = content.substring(emailAndPasswordEnd);
|
|
2835
|
-
content = before + `
|
|
2836
|
-
${codeAdded}` + after;
|
|
3065
|
+
content = before + `${codeAdded}` + after;
|
|
2837
3066
|
}
|
|
2838
3067
|
fs27.writeFileSync(authFilePath, content, "utf8");
|
|
2839
3068
|
if (!content.includes("import { sendEmail }")) {
|
|
3069
|
+
const lastImportIndex = content.lastIndexOf("import");
|
|
3070
|
+
const nextLineAfterLastImport = content.indexOf("\n", lastImportIndex) + 1;
|
|
3071
|
+
const beforeImports = content.substring(0, nextLineAfterLastImport);
|
|
3072
|
+
const afterImports = content.substring(nextLineAfterLastImport);
|
|
3073
|
+
const newImports = `import { sendEmail } from "./email";
|
|
3074
|
+
`;
|
|
3075
|
+
content = beforeImports + newImports + afterImports;
|
|
3076
|
+
fs27.writeFileSync(authFilePath, content, "utf8");
|
|
3077
|
+
}
|
|
3078
|
+
if (!content.includes("import ForgotPasswordEmail from")) {
|
|
2840
3079
|
const lastImportIndex = content.lastIndexOf("import");
|
|
2841
3080
|
const nextLineAfterLastImport = content.indexOf("\n", lastImportIndex) + 1;
|
|
2842
3081
|
const beforeImports = content.substring(0, nextLineAfterLastImport);
|
|
2843
3082
|
const afterImports = content.substring(nextLineAfterLastImport);
|
|
2844
3083
|
const newImports = `import ForgotPasswordEmail from "@/components/email/reset-password";
|
|
2845
|
-
import { sendEmail } from "./email";
|
|
2846
3084
|
`;
|
|
2847
3085
|
content = beforeImports + newImports + afterImports;
|
|
2848
3086
|
fs27.writeFileSync(authFilePath, content, "utf8");
|
|
@@ -2933,8 +3171,16 @@ import { sendEmail } from "./email";
|
|
|
2933
3171
|
`${authTemplatePath}/reset-password/page.tsx`,
|
|
2934
3172
|
resetPageDestinationPath
|
|
2935
3173
|
);
|
|
3174
|
+
console.log(chalk28.green("\nCompleted installation successfully"));
|
|
2936
3175
|
console.log(
|
|
2937
|
-
chalk28.
|
|
3176
|
+
chalk28.white(
|
|
3177
|
+
`${CreateFolder({ srcFolder: folder, destFolder: "components/authverse/ForgetComponent.tsx" })}
|
|
3178
|
+
${CreateFolder({ srcFolder: folder, destFolder: "components/authverse/ResetComponent.tsx" })}
|
|
3179
|
+
${CreateFolder({ srcFolder: folder, destFolder: "components/email/reset-password.tsx" })}
|
|
3180
|
+
${CreateFolder({ srcFolder: folder, destFolder: "app/auth/forget/page.tsx" })}
|
|
3181
|
+
${CreateFolder({ srcFolder: folder, destFolder: "app/auth/reset-password/page.tsx" })}
|
|
3182
|
+
`
|
|
3183
|
+
)
|
|
2938
3184
|
);
|
|
2939
3185
|
} else {
|
|
2940
3186
|
console.log(
|
|
@@ -2999,25 +3245,28 @@ var forgetTanstack = async () => {
|
|
|
2999
3245
|
emailAndPasswordStart,
|
|
3000
3246
|
emailAndPasswordEnd
|
|
3001
3247
|
);
|
|
3002
|
-
if (emailAndPasswordContent.includes("sendResetPassword:")) {
|
|
3003
|
-
content = content.replace(
|
|
3004
|
-
/sendResetPassword:\s*async\s*\([^)]*\)[^{]*\{[^}]*\}[^,]*/,
|
|
3005
|
-
codeAdded
|
|
3006
|
-
);
|
|
3007
|
-
} else {
|
|
3248
|
+
if (!emailAndPasswordContent.includes("sendResetPassword:")) {
|
|
3008
3249
|
const before = content.substring(0, emailAndPasswordEnd);
|
|
3009
3250
|
const after = content.substring(emailAndPasswordEnd);
|
|
3010
|
-
content = before + `
|
|
3011
|
-
${codeAdded}` + after;
|
|
3251
|
+
content = before + `${codeAdded}` + after;
|
|
3012
3252
|
}
|
|
3013
3253
|
fs28.writeFileSync(authFilePath, content, "utf8");
|
|
3014
3254
|
if (!content.includes("import { sendEmail }")) {
|
|
3255
|
+
const lastImportIndex = content.lastIndexOf("import");
|
|
3256
|
+
const nextLineAfterLastImport = content.indexOf("\n", lastImportIndex) + 1;
|
|
3257
|
+
const beforeImports = content.substring(0, nextLineAfterLastImport);
|
|
3258
|
+
const afterImports = content.substring(nextLineAfterLastImport);
|
|
3259
|
+
const newImports = `import { sendEmail } from "./email";
|
|
3260
|
+
`;
|
|
3261
|
+
content = beforeImports + newImports + afterImports;
|
|
3262
|
+
fs28.writeFileSync(authFilePath, content, "utf8");
|
|
3263
|
+
}
|
|
3264
|
+
if (!content.includes("import ForgotPasswordEmail from")) {
|
|
3015
3265
|
const lastImportIndex = content.lastIndexOf("import");
|
|
3016
3266
|
const nextLineAfterLastImport = content.indexOf("\n", lastImportIndex) + 1;
|
|
3017
3267
|
const beforeImports = content.substring(0, nextLineAfterLastImport);
|
|
3018
3268
|
const afterImports = content.substring(nextLineAfterLastImport);
|
|
3019
3269
|
const newImports = `import ForgotPasswordEmail from "@/components/email/reset-password";
|
|
3020
|
-
import { sendEmail } from "./email";
|
|
3021
3270
|
`;
|
|
3022
3271
|
content = beforeImports + newImports + afterImports;
|
|
3023
3272
|
fs28.writeFileSync(authFilePath, content, "utf8");
|
|
@@ -3039,7 +3288,7 @@ import { sendEmail } from "./email";
|
|
|
3039
3288
|
}
|
|
3040
3289
|
const forgetComponentPath = path28.resolve(
|
|
3041
3290
|
__dirname,
|
|
3042
|
-
"./template/
|
|
3291
|
+
"./template/TanstackStart/components/ForgetComponent.tsx"
|
|
3043
3292
|
);
|
|
3044
3293
|
const componentsDestinationPath = path28.join(
|
|
3045
3294
|
srcPath,
|
|
@@ -3058,7 +3307,7 @@ import { sendEmail } from "./email";
|
|
|
3058
3307
|
}
|
|
3059
3308
|
const resetComponentPath = path28.resolve(
|
|
3060
3309
|
__dirname,
|
|
3061
|
-
"./template/
|
|
3310
|
+
"./template/TanstackStart/components/ResetComponent.tsx"
|
|
3062
3311
|
);
|
|
3063
3312
|
const resetDestinationPath = path28.join(
|
|
3064
3313
|
componentsDestinationPath,
|
|
@@ -3069,7 +3318,7 @@ import { sendEmail } from "./email";
|
|
|
3069
3318
|
}
|
|
3070
3319
|
const authTemplatePath = path28.resolve(
|
|
3071
3320
|
__dirname,
|
|
3072
|
-
"./template/
|
|
3321
|
+
"./template/TanstackStart/routes/auth"
|
|
3073
3322
|
);
|
|
3074
3323
|
const routesDestinationPath = path28.join(srcPath, "routes", "auth");
|
|
3075
3324
|
if (!fs28.existsSync(routesDestinationPath)) {
|
|
@@ -3091,8 +3340,16 @@ import { sendEmail } from "./email";
|
|
|
3091
3340
|
`${authTemplatePath}/reset-password.tsx`,
|
|
3092
3341
|
resetPageDestinationPath
|
|
3093
3342
|
);
|
|
3343
|
+
console.log(chalk29.green("\nCompleted installation successfully"));
|
|
3094
3344
|
console.log(
|
|
3095
|
-
chalk29.
|
|
3345
|
+
chalk29.white(
|
|
3346
|
+
`\u2022 src/components/authverse/ForgetComponent.tsx
|
|
3347
|
+
\u2022 src/components/authverse/ResetComponent.tsx
|
|
3348
|
+
\u2022 src/components/email/reset-password.tsx
|
|
3349
|
+
\u2022 src/routes/auth/forget.tsx
|
|
3350
|
+
\u2022 src/routes/auth/reset-password.tsx
|
|
3351
|
+
`
|
|
3352
|
+
)
|
|
3096
3353
|
);
|
|
3097
3354
|
} else {
|
|
3098
3355
|
console.log(
|
|
@@ -3115,7 +3372,7 @@ var forget = async () => {
|
|
|
3115
3372
|
if (framework === "Next js") {
|
|
3116
3373
|
return forgetNext();
|
|
3117
3374
|
}
|
|
3118
|
-
if (framework === "tanstack
|
|
3375
|
+
if (framework === "tanstack start") {
|
|
3119
3376
|
return forgetTanstack();
|
|
3120
3377
|
}
|
|
3121
3378
|
};
|
|
@@ -3217,7 +3474,12 @@ var verifyNext = async () => {
|
|
|
3217
3474
|
if (fs29.existsSync(templatePath) && !fs29.existsSync(destFile)) {
|
|
3218
3475
|
fs29.copyFileSync(templatePath, destFile);
|
|
3219
3476
|
}
|
|
3220
|
-
console.log(chalk31.green("
|
|
3477
|
+
console.log(chalk31.green("\nCompleted installation successfully"));
|
|
3478
|
+
console.log(
|
|
3479
|
+
chalk31.white(
|
|
3480
|
+
`${CreateFolder({ srcFolder: folder, destFolder: "components/email/EmailVerification.tsx" })}`
|
|
3481
|
+
)
|
|
3482
|
+
);
|
|
3221
3483
|
} catch (error) {
|
|
3222
3484
|
console.log(chalk31.red(String(error)));
|
|
3223
3485
|
}
|
|
@@ -3316,7 +3578,8 @@ var verifyTanstack = async () => {
|
|
|
3316
3578
|
if (fs30.existsSync(templatePath) && !fs30.existsSync(destFile)) {
|
|
3317
3579
|
fs30.copyFileSync(templatePath, destFile);
|
|
3318
3580
|
}
|
|
3319
|
-
console.log(chalk32.green("
|
|
3581
|
+
console.log(chalk32.green("\nCompleted installation successfully"));
|
|
3582
|
+
console.log(chalk32.white(`\u2022 src/components/email/EmailVerification.tsx`));
|
|
3320
3583
|
} catch (error) {
|
|
3321
3584
|
console.log(chalk32.red(String(error)));
|
|
3322
3585
|
}
|
|
@@ -3333,7 +3596,7 @@ var verification = async () => {
|
|
|
3333
3596
|
if (framework === "Next js") {
|
|
3334
3597
|
await verifyNext();
|
|
3335
3598
|
}
|
|
3336
|
-
if (framework === "tanstack
|
|
3599
|
+
if (framework === "tanstack start") {
|
|
3337
3600
|
await verifyTanstack();
|
|
3338
3601
|
}
|
|
3339
3602
|
} catch (error) {
|
|
@@ -3363,15 +3626,15 @@ var initCmd = async (cmd) => {
|
|
|
3363
3626
|
cmd: true
|
|
3364
3627
|
});
|
|
3365
3628
|
}
|
|
3366
|
-
if (framework === "tanstack
|
|
3367
|
-
await
|
|
3629
|
+
if (framework === "tanstack start" && cmd.orm === "prisma") {
|
|
3630
|
+
await prismaRunTanstackStart({
|
|
3368
3631
|
authUi: cmd.authUi === "yes" ? true : false,
|
|
3369
3632
|
database: cmd.db,
|
|
3370
3633
|
cmd: true
|
|
3371
3634
|
});
|
|
3372
3635
|
}
|
|
3373
|
-
if (framework === "tanstack
|
|
3374
|
-
await
|
|
3636
|
+
if (framework === "tanstack start" && cmd.orm === "drizzle") {
|
|
3637
|
+
await drizzleRunTanstackStart({
|
|
3375
3638
|
authUi: cmd.authUi === "yes" ? true : false,
|
|
3376
3639
|
cmd: true
|
|
3377
3640
|
});
|