authverse 1.1.3 → 1.1.4

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
@@ -119,8 +119,6 @@ var authUiRun = async ({ folder }) => {
119
119
  `${componentPath}/SingUpComponent.tsx`,
120
120
  SignUpDestinationPath
121
121
  );
122
- const LogoutDestinationPath = import_path.default.join(destinationPath, "Logout.tsx");
123
- import_fs.default.copyFileSync(`${componentPath}/Logout.tsx`, LogoutDestinationPath);
124
122
  const authTemplatePath = import_path.default.resolve(
125
123
  __dirname,
126
124
  "./template/app-auth-uiDesign"
@@ -315,16 +313,6 @@ BETTER_AUTH_URL=http://localhost:3000
315
313
  );
316
314
  }
317
315
  }
318
- const serverPath = import_path2.default.join(projectDir, srcFolder, "server");
319
- if (!import_fs2.default.existsSync(serverPath)) {
320
- import_fs2.default.mkdirSync(serverPath, { recursive: true });
321
- }
322
- const userTemplatePath = import_path2.default.resolve(
323
- __dirname,
324
- "./template/server/user.ts"
325
- );
326
- const userDestinationPath = import_path2.default.join(serverPath, "user.ts");
327
- import_fs2.default.copyFileSync(userTemplatePath, userDestinationPath);
328
316
  const routeTemplatePath = import_path2.default.resolve(
329
317
  __dirname,
330
318
  "./template/api/route.ts"
@@ -506,16 +494,6 @@ BETTER_AUTH_URL=http://localhost:3000
506
494
  );
507
495
  import_fs3.default.copyFileSync(drizzleConfigTemplatePath, drizzleConfigDestinationPath);
508
496
  }
509
- const serverPath = import_path3.default.join(projectDir, srcFolder, "server");
510
- if (!import_fs3.default.existsSync(serverPath)) {
511
- import_fs3.default.mkdirSync(serverPath, { recursive: true });
512
- }
513
- const userTemplatePath = import_path3.default.resolve(
514
- __dirname,
515
- "./template/server/user.ts"
516
- );
517
- const userDestinationPath = import_path3.default.join(serverPath, "user.ts");
518
- import_fs3.default.copyFileSync(userTemplatePath, userDestinationPath);
519
497
  const routeTemplatePath = import_path3.default.resolve(
520
498
  __dirname,
521
499
  "./template/api/route.ts"
@@ -2236,11 +2214,17 @@ var verifyNext = async () => {
2236
2214
  `;
2237
2215
  content = content.slice(0, insertAt + 2) + emailVerificationBlock + content.slice(insertAt + 2);
2238
2216
  }
2239
- if (!content.includes("EmailVerification")) {
2217
+ if (!content.includes("import EmailVerification")) {
2240
2218
  const lastImport = content.lastIndexOf("import");
2241
2219
  const nextLine = content.indexOf("\n", lastImport) + 1;
2242
2220
  const imports = `import EmailVerification from "@/components/email/EmailVerification";
2243
- import { sendEmail } from "./email";
2221
+ `;
2222
+ content = content.slice(0, nextLine) + imports + content.slice(nextLine);
2223
+ }
2224
+ if (!content.includes("import { sendEmail }")) {
2225
+ const lastImport = content.lastIndexOf("import");
2226
+ const nextLine = content.indexOf("\n", lastImport) + 1;
2227
+ const imports = `import { sendEmail } from "./email";
2244
2228
  `;
2245
2229
  content = content.slice(0, nextLine) + imports + content.slice(nextLine);
2246
2230
  }
@@ -2330,11 +2314,17 @@ var verifyTanstack = async () => {
2330
2314
  `;
2331
2315
  content = content.slice(0, insertAt + 2) + emailVerificationBlock + content.slice(insertAt + 2);
2332
2316
  }
2333
- if (!content.includes("EmailVerification")) {
2317
+ if (!content.includes("import EmailVerification")) {
2334
2318
  const lastImport = content.lastIndexOf("import");
2335
2319
  const nextLine = content.indexOf("\n", lastImport) + 1;
2336
2320
  const imports = `import EmailVerification from "@/components/email/EmailVerification";
2337
- import { sendEmail } from "./email";
2321
+ `;
2322
+ content = content.slice(0, nextLine) + imports + content.slice(nextLine);
2323
+ }
2324
+ if (!content.includes("import { sendEmail }")) {
2325
+ const lastImport = content.lastIndexOf("import");
2326
+ const nextLine = content.indexOf("\n", lastImport) + 1;
2327
+ const imports = `import { sendEmail } from "./email";
2338
2328
  `;
2339
2329
  content = content.slice(0, nextLine) + imports + content.slice(nextLine);
2340
2330
  }
package/dist/index.js CHANGED
@@ -96,8 +96,6 @@ var authUiRun = async ({ folder }) => {
96
96
  `${componentPath}/SingUpComponent.tsx`,
97
97
  SignUpDestinationPath
98
98
  );
99
- const LogoutDestinationPath = path.join(destinationPath, "Logout.tsx");
100
- fs.copyFileSync(`${componentPath}/Logout.tsx`, LogoutDestinationPath);
101
99
  const authTemplatePath = path.resolve(
102
100
  __dirname,
103
101
  "./template/app-auth-uiDesign"
@@ -291,16 +289,6 @@ BETTER_AUTH_URL=http://localhost:3000
291
289
  );
292
290
  }
293
291
  }
294
- const serverPath = path2.join(projectDir, srcFolder, "server");
295
- if (!fs2.existsSync(serverPath)) {
296
- fs2.mkdirSync(serverPath, { recursive: true });
297
- }
298
- const userTemplatePath = path2.resolve(
299
- __dirname,
300
- "./template/server/user.ts"
301
- );
302
- const userDestinationPath = path2.join(serverPath, "user.ts");
303
- fs2.copyFileSync(userTemplatePath, userDestinationPath);
304
292
  const routeTemplatePath = path2.resolve(
305
293
  __dirname,
306
294
  "./template/api/route.ts"
@@ -481,16 +469,6 @@ BETTER_AUTH_URL=http://localhost:3000
481
469
  );
482
470
  fs3.copyFileSync(drizzleConfigTemplatePath, drizzleConfigDestinationPath);
483
471
  }
484
- const serverPath = path3.join(projectDir, srcFolder, "server");
485
- if (!fs3.existsSync(serverPath)) {
486
- fs3.mkdirSync(serverPath, { recursive: true });
487
- }
488
- const userTemplatePath = path3.resolve(
489
- __dirname,
490
- "./template/server/user.ts"
491
- );
492
- const userDestinationPath = path3.join(serverPath, "user.ts");
493
- fs3.copyFileSync(userTemplatePath, userDestinationPath);
494
472
  const routeTemplatePath = path3.resolve(
495
473
  __dirname,
496
474
  "./template/api/route.ts"
@@ -2195,11 +2173,17 @@ var verifyNext = async () => {
2195
2173
  `;
2196
2174
  content = content.slice(0, insertAt + 2) + emailVerificationBlock + content.slice(insertAt + 2);
2197
2175
  }
2198
- if (!content.includes("EmailVerification")) {
2176
+ if (!content.includes("import EmailVerification")) {
2199
2177
  const lastImport = content.lastIndexOf("import");
2200
2178
  const nextLine = content.indexOf("\n", lastImport) + 1;
2201
2179
  const imports = `import EmailVerification from "@/components/email/EmailVerification";
2202
- import { sendEmail } from "./email";
2180
+ `;
2181
+ content = content.slice(0, nextLine) + imports + content.slice(nextLine);
2182
+ }
2183
+ if (!content.includes("import { sendEmail }")) {
2184
+ const lastImport = content.lastIndexOf("import");
2185
+ const nextLine = content.indexOf("\n", lastImport) + 1;
2186
+ const imports = `import { sendEmail } from "./email";
2203
2187
  `;
2204
2188
  content = content.slice(0, nextLine) + imports + content.slice(nextLine);
2205
2189
  }
@@ -2288,11 +2272,17 @@ var verifyTanstack = async () => {
2288
2272
  `;
2289
2273
  content = content.slice(0, insertAt + 2) + emailVerificationBlock + content.slice(insertAt + 2);
2290
2274
  }
2291
- if (!content.includes("EmailVerification")) {
2275
+ if (!content.includes("import EmailVerification")) {
2292
2276
  const lastImport = content.lastIndexOf("import");
2293
2277
  const nextLine = content.indexOf("\n", lastImport) + 1;
2294
2278
  const imports = `import EmailVerification from "@/components/email/EmailVerification";
2295
- import { sendEmail } from "./email";
2279
+ `;
2280
+ content = content.slice(0, nextLine) + imports + content.slice(nextLine);
2281
+ }
2282
+ if (!content.includes("import { sendEmail }")) {
2283
+ const lastImport = content.lastIndexOf("import");
2284
+ const nextLine = content.indexOf("\n", lastImport) + 1;
2285
+ const imports = `import { sendEmail } from "./email";
2296
2286
  `;
2297
2287
  content = content.slice(0, nextLine) + imports + content.slice(nextLine);
2298
2288
  }
@@ -1,5 +1,4 @@
1
1
  import { useForm } from "@tanstack/react-form";
2
- // import { Controller } from "@tanstack/react-form";
3
2
  import { toast } from "sonner";
4
3
  import * as z from "zod";
5
4
  import { Button } from "@/components/ui/button";
@@ -4,7 +4,6 @@ import { Controller, useForm } from "react-hook-form";
4
4
  import { toast } from "sonner";
5
5
  import * as z from "zod";
6
6
  import { zodResolver } from "@hookform/resolvers/zod";
7
-
8
7
  import { Button } from "@/components/ui/button";
9
8
  import {
10
9
  Card,
@@ -23,8 +22,8 @@ import {
23
22
  import { Input } from "@/components/ui/input";
24
23
  import Link from "next/link";
25
24
  import { useState } from "react";
26
- import { signIn } from "@/server/user";
27
25
  import { useRouter } from "next/navigation";
26
+ import { authClient } from "@/lib/auth-client";
28
27
 
29
28
  const formSchema = z.object({
30
29
  email: z.string().email(),
@@ -47,20 +46,24 @@ const LoginComponent = () => {
47
46
 
48
47
  const onSubmit = async (data: z.infer<typeof formSchema>) => {
49
48
  setIsLoading(true);
50
- try {
51
- const { success, message } = await signIn(data.email, data.password);
52
-
53
- if (success === true) {
54
- router.push("/");
55
- toast.success(message);
56
- } else {
57
- toast.error(message);
49
+ await authClient.signIn.email(
50
+ {
51
+ email: data.email,
52
+ password: data.password,
53
+ callbackURL: "/",
54
+ },
55
+ {
56
+ onSuccess: (data) => {
57
+ toast.success("Login successful!");
58
+ setIsLoading(false);
59
+ router.push("/");
60
+ },
61
+ onError: (error: any) => {
62
+ setIsLoading(false);
63
+ toast.error(error.error.message);
64
+ },
58
65
  }
59
- setIsLoading(false);
60
- } catch (error: any) {
61
- toast.error(error.message);
62
- setIsLoading(false);
63
- }
66
+ );
64
67
  };
65
68
 
66
69
  return (
@@ -4,7 +4,6 @@ import { Controller, useForm } from "react-hook-form";
4
4
  import { toast } from "sonner";
5
5
  import * as z from "zod";
6
6
  import { zodResolver } from "@hookform/resolvers/zod";
7
-
8
7
  import { Button } from "@/components/ui/button";
9
8
  import {
10
9
  Card,
@@ -23,14 +22,14 @@ import {
23
22
  import { Input } from "@/components/ui/input";
24
23
  import Link from "next/link";
25
24
  import { useState } from "react";
26
- import { signUp } from "@/server/user";
27
25
  import { useRouter } from "next/navigation";
26
+ import { authClient } from "@/lib/auth-client";
28
27
 
29
28
  const formSchema = z.object({
30
29
  name: z.string().min(3, {
31
30
  message: "Name must be at least 3 characters",
32
31
  }),
33
- email: z.string().email(),
32
+ email: z.email(),
34
33
  password: z.string().min(8, {
35
34
  message: "Password must be at least 8 characters",
36
35
  }),
@@ -51,24 +50,25 @@ const SingUpComponent = () => {
51
50
 
52
51
  const onSubmit = async (data: z.infer<typeof formSchema>) => {
53
52
  setIsLoading(true);
54
- try {
55
- const { success, message } = await signUp(
56
- data.name,
57
- data.email,
58
- data.password
59
- );
60
-
61
- if (success === true) {
62
- router.push("/");
63
- toast.success(message);
64
- } else {
65
- toast.error(message);
53
+ await authClient.signUp.email(
54
+ {
55
+ name: data.name,
56
+ email: data.email,
57
+ password: data.password,
58
+ callbackURL: "/",
59
+ },
60
+ {
61
+ onSuccess: () => {
62
+ toast.success("Sign up successful!");
63
+ setIsLoading(false);
64
+ router.push("/");
65
+ },
66
+ onError: (error: any) => {
67
+ setIsLoading(false);
68
+ toast.error(error.error.message);
69
+ },
66
70
  }
67
- setIsLoading(false);
68
- } catch (error: any) {
69
- toast.error(error.message);
70
- setIsLoading(false);
71
- }
71
+ );
72
72
  };
73
73
 
74
74
  return (
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "authverse",
3
- "version": "1.1.3",
3
+ "version": "1.1.4",
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",
@@ -56,7 +56,7 @@
56
56
  "@semantic-release/github": "^12.0.2",
57
57
  "@semantic-release/npm": "^13.1.2",
58
58
  "@semantic-release/release-notes-generator": "^14.1.0",
59
- "@types/node": "^25.0.6",
59
+ "@types/node": "^25.0.8",
60
60
  "conventional-changelog-conventionalcommits": "^9.1.0",
61
61
  "semantic-release": "^25.0.2",
62
62
  "tsup": "^8.5.0",
@@ -1,21 +0,0 @@
1
- "use client";
2
- import { Button } from "@/components/ui/button";
3
- import { authClient } from "@/lib/auth-client";
4
- import { LogOutIcon } from "lucide-react";
5
- import { useRouter } from "next/navigation";
6
-
7
- const Logout = () => {
8
- const router = useRouter();
9
- const handleLogout = async () => {
10
- await authClient.signOut();
11
- router.push("/auth/login");
12
- };
13
- return (
14
- <Button variant="outline" onClick={handleLogout}>
15
- <LogOutIcon className="mr-1 h-4 w-4" />
16
- Logout
17
- </Button>
18
- );
19
- };
20
-
21
- export default Logout;
@@ -1,49 +0,0 @@
1
- "use server";
2
- import { auth } from "@/lib/auth";
3
-
4
- export const signIn = async (email: string, password: string) => {
5
- try {
6
- await auth.api.signInEmail({
7
- body: {
8
- email,
9
- password,
10
- },
11
- });
12
-
13
- return {
14
- success: true,
15
- message: "Login successfully.",
16
- };
17
- } catch (error) {
18
- const e = error as Error;
19
-
20
- return {
21
- success: false,
22
- message: e.message || "An unknown error occurred.",
23
- };
24
- }
25
- };
26
-
27
- export const signUp = async (name: string, email: string, password: string) => {
28
- try {
29
- await auth.api.signUpEmail({
30
- body: {
31
- name,
32
- email,
33
- password,
34
- },
35
- });
36
-
37
- return {
38
- success: true,
39
- message: "Signed up successfully.",
40
- };
41
- } catch (error) {
42
- const e = error as Error;
43
-
44
- return {
45
- success: false,
46
- message: e.message || "An unknown error occurred.",
47
- };
48
- }
49
- };