authverse 1.1.5 → 1.1.6
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 +26 -22
- package/dist/index.js +26 -22
- package/dist/template/TanstackState/components/LoginComponent.tsx +4 -1
- package/dist/template/TanstackState/components/ResetComponent.tsx +6 -4
- package/dist/template/TanstackState/components/SingUpComponent.tsx +4 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -1042,16 +1042,16 @@ var initAnswer = async () => {
|
|
|
1042
1042
|
// index.ts
|
|
1043
1043
|
var import_fs23 = require("fs");
|
|
1044
1044
|
|
|
1045
|
-
// cli/
|
|
1045
|
+
// cli/oauth.ts
|
|
1046
1046
|
var import_chalk12 = __toESM(require("chalk"), 1);
|
|
1047
1047
|
|
|
1048
|
-
//
|
|
1048
|
+
// oauth/googleNext.ts
|
|
1049
1049
|
var import_chalk8 = __toESM(require("chalk"), 1);
|
|
1050
1050
|
var import_fs8 = __toESM(require("fs"), 1);
|
|
1051
1051
|
var import_path8 = __toESM(require("path"), 1);
|
|
1052
1052
|
var import_url7 = require("url");
|
|
1053
1053
|
var import_meta7 = {};
|
|
1054
|
-
var
|
|
1054
|
+
var googleNext = async () => {
|
|
1055
1055
|
try {
|
|
1056
1056
|
const __filename = (0, import_url7.fileURLToPath)(import_meta7.url);
|
|
1057
1057
|
const __dirname = import_path8.default.dirname(__filename);
|
|
@@ -1155,13 +1155,13 @@ GOOGLE_CLIENT_SECRET=
|
|
|
1155
1155
|
}
|
|
1156
1156
|
};
|
|
1157
1157
|
|
|
1158
|
-
//
|
|
1158
|
+
// oauth/githubNext.ts
|
|
1159
1159
|
var import_chalk9 = __toESM(require("chalk"), 1);
|
|
1160
1160
|
var import_fs9 = __toESM(require("fs"), 1);
|
|
1161
1161
|
var import_path9 = __toESM(require("path"), 1);
|
|
1162
1162
|
var import_url8 = require("url");
|
|
1163
1163
|
var import_meta8 = {};
|
|
1164
|
-
var
|
|
1164
|
+
var githubNext = async () => {
|
|
1165
1165
|
try {
|
|
1166
1166
|
const __filename = (0, import_url8.fileURLToPath)(import_meta8.url);
|
|
1167
1167
|
const __dirname = import_path9.default.dirname(__filename);
|
|
@@ -1265,13 +1265,13 @@ GITHUB_CLIENT_SECRET=
|
|
|
1265
1265
|
}
|
|
1266
1266
|
};
|
|
1267
1267
|
|
|
1268
|
-
//
|
|
1268
|
+
// oauth/googleTanstackState.ts
|
|
1269
1269
|
var import_chalk10 = __toESM(require("chalk"), 1);
|
|
1270
1270
|
var import_fs10 = __toESM(require("fs"), 1);
|
|
1271
1271
|
var import_path10 = __toESM(require("path"), 1);
|
|
1272
1272
|
var import_url9 = require("url");
|
|
1273
1273
|
var import_meta9 = {};
|
|
1274
|
-
var
|
|
1274
|
+
var googleTanstackState = async () => {
|
|
1275
1275
|
try {
|
|
1276
1276
|
const __filename = (0, import_url9.fileURLToPath)(import_meta9.url);
|
|
1277
1277
|
const __dirname = import_path10.default.dirname(__filename);
|
|
@@ -1369,13 +1369,13 @@ GOOGLE_CLIENT_SECRET=
|
|
|
1369
1369
|
}
|
|
1370
1370
|
};
|
|
1371
1371
|
|
|
1372
|
-
//
|
|
1372
|
+
// oauth/githubTanstackState.ts
|
|
1373
1373
|
var import_chalk11 = __toESM(require("chalk"), 1);
|
|
1374
1374
|
var import_fs11 = __toESM(require("fs"), 1);
|
|
1375
1375
|
var import_path11 = __toESM(require("path"), 1);
|
|
1376
1376
|
var import_url10 = require("url");
|
|
1377
1377
|
var import_meta10 = {};
|
|
1378
|
-
var
|
|
1378
|
+
var githubTanstackState = async () => {
|
|
1379
1379
|
try {
|
|
1380
1380
|
const __filename = (0, import_url10.fileURLToPath)(import_meta10.url);
|
|
1381
1381
|
const __dirname = import_path11.default.dirname(__filename);
|
|
@@ -1473,26 +1473,30 @@ GITHUB_CLIENT_SECRET=
|
|
|
1473
1473
|
}
|
|
1474
1474
|
};
|
|
1475
1475
|
|
|
1476
|
-
// cli/
|
|
1477
|
-
var
|
|
1476
|
+
// cli/oauth.ts
|
|
1477
|
+
var Oauth = async ({ oauth }) => {
|
|
1478
1478
|
try {
|
|
1479
1479
|
const { framework, error } = await getFramework();
|
|
1480
1480
|
if (error) {
|
|
1481
1481
|
console.log(import_chalk12.default.red(error));
|
|
1482
1482
|
return;
|
|
1483
1483
|
}
|
|
1484
|
-
if (framework === "Next js" &&
|
|
1485
|
-
await
|
|
1486
|
-
} else if (framework === "Next js" &&
|
|
1487
|
-
await
|
|
1484
|
+
if (framework === "Next js" && oauth == "google") {
|
|
1485
|
+
await googleNext();
|
|
1486
|
+
} else if (framework === "Next js" && oauth == "github") {
|
|
1487
|
+
await githubNext();
|
|
1488
1488
|
}
|
|
1489
|
-
if (framework === "tanstack state" &&
|
|
1490
|
-
await
|
|
1491
|
-
} else if (framework === "tanstack state" &&
|
|
1492
|
-
await
|
|
1489
|
+
if (framework === "tanstack state" && oauth == "google") {
|
|
1490
|
+
await googleTanstackState();
|
|
1491
|
+
} else if (framework === "tanstack state" && oauth == "github") {
|
|
1492
|
+
await githubTanstackState();
|
|
1493
|
+
}
|
|
1494
|
+
if (oauth !== "google" && oauth !== "github") {
|
|
1495
|
+
console.log(import_chalk12.default.red("Invalid oauth provider"));
|
|
1496
|
+
return;
|
|
1493
1497
|
}
|
|
1494
1498
|
} catch (error) {
|
|
1495
|
-
console.log(import_chalk12.default.red("Error adding
|
|
1499
|
+
console.log(import_chalk12.default.red("Error adding oauth:"), error);
|
|
1496
1500
|
}
|
|
1497
1501
|
};
|
|
1498
1502
|
|
|
@@ -2532,8 +2536,8 @@ program.command("init").description("Select project template and configuration")
|
|
|
2532
2536
|
await initCmd(cmd);
|
|
2533
2537
|
}
|
|
2534
2538
|
});
|
|
2535
|
-
program.command("add <
|
|
2536
|
-
await
|
|
2539
|
+
program.command("add <oauth>").description("Add a new authentication provider").action(async (oauth) => {
|
|
2540
|
+
await Oauth({ oauth });
|
|
2537
2541
|
});
|
|
2538
2542
|
program.command("forget").description("Forget stored configurations").action(async () => {
|
|
2539
2543
|
await forget();
|
package/dist/index.js
CHANGED
|
@@ -1014,15 +1014,15 @@ var initAnswer = async () => {
|
|
|
1014
1014
|
// index.ts
|
|
1015
1015
|
import { readFileSync } from "fs";
|
|
1016
1016
|
|
|
1017
|
-
// cli/
|
|
1017
|
+
// cli/oauth.ts
|
|
1018
1018
|
import chalk12 from "chalk";
|
|
1019
1019
|
|
|
1020
|
-
//
|
|
1020
|
+
// oauth/googleNext.ts
|
|
1021
1021
|
import chalk8 from "chalk";
|
|
1022
1022
|
import fs8 from "fs";
|
|
1023
1023
|
import path8 from "path";
|
|
1024
1024
|
import { fileURLToPath as fileURLToPath7 } from "url";
|
|
1025
|
-
var
|
|
1025
|
+
var googleNext = async () => {
|
|
1026
1026
|
try {
|
|
1027
1027
|
const __filename = fileURLToPath7(import.meta.url);
|
|
1028
1028
|
const __dirname = path8.dirname(__filename);
|
|
@@ -1126,12 +1126,12 @@ GOOGLE_CLIENT_SECRET=
|
|
|
1126
1126
|
}
|
|
1127
1127
|
};
|
|
1128
1128
|
|
|
1129
|
-
//
|
|
1129
|
+
// oauth/githubNext.ts
|
|
1130
1130
|
import chalk9 from "chalk";
|
|
1131
1131
|
import fs9 from "fs";
|
|
1132
1132
|
import path9 from "path";
|
|
1133
1133
|
import { fileURLToPath as fileURLToPath8 } from "url";
|
|
1134
|
-
var
|
|
1134
|
+
var githubNext = async () => {
|
|
1135
1135
|
try {
|
|
1136
1136
|
const __filename = fileURLToPath8(import.meta.url);
|
|
1137
1137
|
const __dirname = path9.dirname(__filename);
|
|
@@ -1235,12 +1235,12 @@ GITHUB_CLIENT_SECRET=
|
|
|
1235
1235
|
}
|
|
1236
1236
|
};
|
|
1237
1237
|
|
|
1238
|
-
//
|
|
1238
|
+
// oauth/googleTanstackState.ts
|
|
1239
1239
|
import chalk10 from "chalk";
|
|
1240
1240
|
import fs10 from "fs";
|
|
1241
1241
|
import path10 from "path";
|
|
1242
1242
|
import { fileURLToPath as fileURLToPath9 } from "url";
|
|
1243
|
-
var
|
|
1243
|
+
var googleTanstackState = async () => {
|
|
1244
1244
|
try {
|
|
1245
1245
|
const __filename = fileURLToPath9(import.meta.url);
|
|
1246
1246
|
const __dirname = path10.dirname(__filename);
|
|
@@ -1338,12 +1338,12 @@ GOOGLE_CLIENT_SECRET=
|
|
|
1338
1338
|
}
|
|
1339
1339
|
};
|
|
1340
1340
|
|
|
1341
|
-
//
|
|
1341
|
+
// oauth/githubTanstackState.ts
|
|
1342
1342
|
import chalk11 from "chalk";
|
|
1343
1343
|
import fs11 from "fs";
|
|
1344
1344
|
import path11 from "path";
|
|
1345
1345
|
import { fileURLToPath as fileURLToPath10 } from "url";
|
|
1346
|
-
var
|
|
1346
|
+
var githubTanstackState = async () => {
|
|
1347
1347
|
try {
|
|
1348
1348
|
const __filename = fileURLToPath10(import.meta.url);
|
|
1349
1349
|
const __dirname = path11.dirname(__filename);
|
|
@@ -1441,26 +1441,30 @@ GITHUB_CLIENT_SECRET=
|
|
|
1441
1441
|
}
|
|
1442
1442
|
};
|
|
1443
1443
|
|
|
1444
|
-
// cli/
|
|
1445
|
-
var
|
|
1444
|
+
// cli/oauth.ts
|
|
1445
|
+
var Oauth = async ({ oauth }) => {
|
|
1446
1446
|
try {
|
|
1447
1447
|
const { framework, error } = await getFramework();
|
|
1448
1448
|
if (error) {
|
|
1449
1449
|
console.log(chalk12.red(error));
|
|
1450
1450
|
return;
|
|
1451
1451
|
}
|
|
1452
|
-
if (framework === "Next js" &&
|
|
1453
|
-
await
|
|
1454
|
-
} else if (framework === "Next js" &&
|
|
1455
|
-
await
|
|
1452
|
+
if (framework === "Next js" && oauth == "google") {
|
|
1453
|
+
await googleNext();
|
|
1454
|
+
} else if (framework === "Next js" && oauth == "github") {
|
|
1455
|
+
await githubNext();
|
|
1456
1456
|
}
|
|
1457
|
-
if (framework === "tanstack state" &&
|
|
1458
|
-
await
|
|
1459
|
-
} else if (framework === "tanstack state" &&
|
|
1460
|
-
await
|
|
1457
|
+
if (framework === "tanstack state" && oauth == "google") {
|
|
1458
|
+
await googleTanstackState();
|
|
1459
|
+
} else if (framework === "tanstack state" && oauth == "github") {
|
|
1460
|
+
await githubTanstackState();
|
|
1461
|
+
}
|
|
1462
|
+
if (oauth !== "google" && oauth !== "github") {
|
|
1463
|
+
console.log(chalk12.red("Invalid oauth provider"));
|
|
1464
|
+
return;
|
|
1461
1465
|
}
|
|
1462
1466
|
} catch (error) {
|
|
1463
|
-
console.log(chalk12.red("Error adding
|
|
1467
|
+
console.log(chalk12.red("Error adding oauth:"), error);
|
|
1464
1468
|
}
|
|
1465
1469
|
};
|
|
1466
1470
|
|
|
@@ -2490,8 +2494,8 @@ program.command("init").description("Select project template and configuration")
|
|
|
2490
2494
|
await initCmd(cmd);
|
|
2491
2495
|
}
|
|
2492
2496
|
});
|
|
2493
|
-
program.command("add <
|
|
2494
|
-
await
|
|
2497
|
+
program.command("add <oauth>").description("Add a new authentication provider").action(async (oauth) => {
|
|
2498
|
+
await Oauth({ oauth });
|
|
2495
2499
|
});
|
|
2496
2500
|
program.command("forget").description("Forget stored configurations").action(async () => {
|
|
2497
2501
|
await forget();
|
|
@@ -20,6 +20,7 @@ import { Input } from "@/components/ui/input";
|
|
|
20
20
|
import { useState } from "react";
|
|
21
21
|
import { Link } from "@tanstack/react-router";
|
|
22
22
|
import { authClient } from "@/lib/auth-client";
|
|
23
|
+
import { useNavigate } from "@tanstack/react-router";
|
|
23
24
|
|
|
24
25
|
const formSchema = z.object({
|
|
25
26
|
email: z.string().email(),
|
|
@@ -30,6 +31,7 @@ const formSchema = z.object({
|
|
|
30
31
|
|
|
31
32
|
const LoginComponent = () => {
|
|
32
33
|
const [isLoading, setIsLoading] = useState(false);
|
|
34
|
+
const navigate = useNavigate();
|
|
33
35
|
|
|
34
36
|
const form = useForm({
|
|
35
37
|
defaultValues: {
|
|
@@ -50,12 +52,13 @@ const LoginComponent = () => {
|
|
|
50
52
|
{
|
|
51
53
|
onSuccess: () => {
|
|
52
54
|
toast.success("Login successful!");
|
|
55
|
+
navigate({ to: "/" });
|
|
53
56
|
},
|
|
54
57
|
onError: (error: any) => {
|
|
55
58
|
setIsLoading(false);
|
|
56
59
|
toast.error(error.error.message);
|
|
57
60
|
},
|
|
58
|
-
}
|
|
61
|
+
},
|
|
59
62
|
);
|
|
60
63
|
},
|
|
61
64
|
});
|
|
@@ -19,7 +19,8 @@ import {
|
|
|
19
19
|
import { Input } from "@/components/ui/input";
|
|
20
20
|
import { useState } from "react";
|
|
21
21
|
import { authClient } from "@/lib/auth-client";
|
|
22
|
-
import {
|
|
22
|
+
import { useSearch } from "@tanstack/react-router";
|
|
23
|
+
import { useNavigate } from "@tanstack/react-router";
|
|
23
24
|
|
|
24
25
|
const formSchema = z
|
|
25
26
|
.object({
|
|
@@ -36,6 +37,7 @@ const formSchema = z
|
|
|
36
37
|
const ResetComponent = () => {
|
|
37
38
|
const [isLoading, setIsLoading] = useState(false);
|
|
38
39
|
const { token } = useSearch({ from: "/auth/reset-password" });
|
|
40
|
+
const navigate = useNavigate();
|
|
39
41
|
|
|
40
42
|
const form = useForm({
|
|
41
43
|
defaultValues: {
|
|
@@ -55,15 +57,15 @@ const ResetComponent = () => {
|
|
|
55
57
|
{
|
|
56
58
|
onSuccess: () => {
|
|
57
59
|
toast.success(
|
|
58
|
-
"Password has been reset successfully. You can now log in with your new password."
|
|
60
|
+
"Password has been reset successfully. You can now log in with your new password.",
|
|
59
61
|
);
|
|
60
|
-
|
|
62
|
+
navigate({ to: "/" });
|
|
61
63
|
},
|
|
62
64
|
onError: (error: any) => {
|
|
63
65
|
setIsLoading(false);
|
|
64
66
|
toast.error(error.error.message);
|
|
65
67
|
},
|
|
66
|
-
}
|
|
68
|
+
},
|
|
67
69
|
);
|
|
68
70
|
},
|
|
69
71
|
});
|
|
@@ -20,6 +20,7 @@ import { Input } from "@/components/ui/input";
|
|
|
20
20
|
import { useState } from "react";
|
|
21
21
|
import { Link } from "@tanstack/react-router";
|
|
22
22
|
import { authClient } from "@/lib/auth-client";
|
|
23
|
+
import { useNavigate } from "@tanstack/react-router";
|
|
23
24
|
|
|
24
25
|
const formSchema = z.object({
|
|
25
26
|
name: z.string().min(3, {
|
|
@@ -33,6 +34,7 @@ const formSchema = z.object({
|
|
|
33
34
|
|
|
34
35
|
const SingUpComponent = () => {
|
|
35
36
|
const [isLoading, setIsLoading] = useState(false);
|
|
37
|
+
const navigate = useNavigate();
|
|
36
38
|
|
|
37
39
|
const form = useForm({
|
|
38
40
|
defaultValues: {
|
|
@@ -55,12 +57,13 @@ const SingUpComponent = () => {
|
|
|
55
57
|
{
|
|
56
58
|
onSuccess: () => {
|
|
57
59
|
toast.success("Sign up successful!");
|
|
60
|
+
navigate({ to: "/" });
|
|
58
61
|
},
|
|
59
62
|
onError: (error: any) => {
|
|
60
63
|
setIsLoading(false);
|
|
61
64
|
toast.error(error.error.message);
|
|
62
65
|
},
|
|
63
|
-
}
|
|
66
|
+
},
|
|
64
67
|
);
|
|
65
68
|
},
|
|
66
69
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "authverse",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.6",
|
|
4
4
|
"description": "Authverse Fast modern CLI to generate full auth systems with OAuth Prisma Drizzle better auth and ready-to-use ShadCN UI screens",
|
|
5
5
|
"repository": {
|
|
6
6
|
"url": "git+https://github.com/abdirahmanmahamoud/authverse.git",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@commitlint/cli": "^20.3.1",
|
|
53
53
|
"@commitlint/config-conventional": "^20.3.1",
|
|
54
|
-
"@types/node": "^25.2.
|
|
54
|
+
"@types/node": "^25.2.3",
|
|
55
55
|
"changelogithub": "^14.0.0",
|
|
56
56
|
"tsup": "^8.5.0",
|
|
57
57
|
"typescript": "^5.9.3"
|