nextjs-hackathon-stack 0.1.1 → 0.1.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.js
CHANGED
|
@@ -18,9 +18,6 @@ function printBanner() {
|
|
|
18
18
|
function success(msg) {
|
|
19
19
|
p.log.success(msg);
|
|
20
20
|
}
|
|
21
|
-
function info(msg) {
|
|
22
|
-
p.log.info(msg);
|
|
23
|
-
}
|
|
24
21
|
function outro2(msg) {
|
|
25
22
|
p.outro(pc.green(msg));
|
|
26
23
|
}
|
|
@@ -112,29 +109,29 @@ async function scaffold(projectName, skipInstall) {
|
|
|
112
109
|
p3.log.error(stderr || "npm install failed");
|
|
113
110
|
p3.log.info("You can install manually: cd " + projectName + " && npm install");
|
|
114
111
|
}
|
|
115
|
-
|
|
112
|
+
spinner2.start("Initializing shadcn/ui");
|
|
116
113
|
try {
|
|
117
|
-
execSync("npx shadcn@latest init --yes --defaults", {
|
|
114
|
+
execSync("npx shadcn@latest init --yes --defaults --force --silent", {
|
|
118
115
|
cwd: targetDir,
|
|
119
|
-
stdio: "
|
|
116
|
+
stdio: "pipe"
|
|
120
117
|
});
|
|
121
|
-
|
|
118
|
+
spinner2.stop("shadcn/ui initialized");
|
|
122
119
|
} catch {
|
|
123
|
-
|
|
120
|
+
spinner2.stop("shadcn/ui init failed \u2014 run manually: npx shadcn@latest init");
|
|
124
121
|
}
|
|
125
|
-
info("Adding shadcn/ui base components...");
|
|
126
122
|
const components = ["button", "input", "card", "form", "label"];
|
|
127
123
|
for (const component of components) {
|
|
124
|
+
spinner2.start(`Adding shadcn/ui component: ${component}`);
|
|
128
125
|
try {
|
|
129
|
-
execSync(`npx shadcn@latest add ${component} --yes`, {
|
|
126
|
+
execSync(`npx shadcn@latest add ${component} --yes --silent`, {
|
|
130
127
|
cwd: targetDir,
|
|
131
|
-
stdio: "
|
|
128
|
+
stdio: "pipe"
|
|
132
129
|
});
|
|
130
|
+
spinner2.stop(`Added shadcn/ui component: ${component}`);
|
|
133
131
|
} catch {
|
|
134
|
-
|
|
132
|
+
spinner2.stop(`Failed to add component: ${component}`);
|
|
135
133
|
}
|
|
136
134
|
}
|
|
137
|
-
success("shadcn/ui components added");
|
|
138
135
|
}
|
|
139
136
|
success(pc2.bold(`Project "${projectName}" created!`));
|
|
140
137
|
console.log(`
|
package/package.json
CHANGED
|
@@ -2,9 +2,14 @@ import { LoginForm } from "@/features/auth/components/login-form";
|
|
|
2
2
|
|
|
3
3
|
export default function LoginPage() {
|
|
4
4
|
return (
|
|
5
|
-
<main className="flex min-h-screen items-center justify-center">
|
|
6
|
-
<div className="w-full max-w-
|
|
7
|
-
<
|
|
5
|
+
<main className="flex min-h-screen items-center justify-center bg-muted/40 px-4">
|
|
6
|
+
<div className="w-full max-w-sm space-y-6">
|
|
7
|
+
<div className="text-center">
|
|
8
|
+
<h1 className="text-3xl font-bold tracking-tight">Welcome back</h1>
|
|
9
|
+
<p className="mt-2 text-sm text-muted-foreground">
|
|
10
|
+
Sign in to your account to continue
|
|
11
|
+
</p>
|
|
12
|
+
</div>
|
|
8
13
|
<LoginForm />
|
|
9
14
|
</div>
|
|
10
15
|
</main>
|
|
@@ -5,6 +5,10 @@ import { useForm } from "react-hook-form";
|
|
|
5
5
|
import { zodResolver } from "@hookform/resolvers/zod";
|
|
6
6
|
import { z } from "zod";
|
|
7
7
|
import { loginAction, type LoginActionState } from "../actions/login.action";
|
|
8
|
+
import { Button } from "@/components/ui/button";
|
|
9
|
+
import { Input } from "@/components/ui/input";
|
|
10
|
+
import { Label } from "@/components/ui/label";
|
|
11
|
+
import { Card, CardContent, CardHeader, CardTitle, CardDescription } from "@/components/ui/card";
|
|
8
12
|
|
|
9
13
|
const schema = z.object({
|
|
10
14
|
email: z.string().email("Invalid email"),
|
|
@@ -32,49 +36,52 @@ export function LoginForm() {
|
|
|
32
36
|
});
|
|
33
37
|
|
|
34
38
|
return (
|
|
35
|
-
<
|
|
36
|
-
|
|
37
|
-
<
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
39
|
+
<Card>
|
|
40
|
+
<CardHeader>
|
|
41
|
+
<CardTitle>Sign in</CardTitle>
|
|
42
|
+
<CardDescription>Enter your email and password below</CardDescription>
|
|
43
|
+
</CardHeader>
|
|
44
|
+
<CardContent>
|
|
45
|
+
<form onSubmit={onSubmit} data-testid="login-form" className="space-y-4">
|
|
46
|
+
{state.status === "error" && (
|
|
47
|
+
<p role="alert" className="rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive">
|
|
48
|
+
{state.message}
|
|
49
|
+
</p>
|
|
50
|
+
)}
|
|
51
|
+
|
|
52
|
+
<div className="space-y-1.5">
|
|
53
|
+
<Label htmlFor="email">Email</Label>
|
|
54
|
+
<Input
|
|
55
|
+
id="email"
|
|
56
|
+
type="email"
|
|
57
|
+
autoComplete="email"
|
|
58
|
+
placeholder="you@example.com"
|
|
59
|
+
{...register("email")}
|
|
60
|
+
/>
|
|
61
|
+
{errors.email && (
|
|
62
|
+
<p className="text-sm text-destructive">{errors.email.message}</p>
|
|
63
|
+
)}
|
|
64
|
+
</div>
|
|
65
|
+
|
|
66
|
+
<div className="space-y-1.5">
|
|
67
|
+
<Label htmlFor="password">Password</Label>
|
|
68
|
+
<Input
|
|
69
|
+
id="password"
|
|
70
|
+
type="password"
|
|
71
|
+
autoComplete="current-password"
|
|
72
|
+
placeholder="••••••••"
|
|
73
|
+
{...register("password")}
|
|
74
|
+
/>
|
|
75
|
+
{errors.password && (
|
|
76
|
+
<p className="text-sm text-destructive">{errors.password.message}</p>
|
|
77
|
+
)}
|
|
78
|
+
</div>
|
|
79
|
+
|
|
80
|
+
<Button type="submit" className="w-full" disabled={isPending}>
|
|
81
|
+
{isPending ? "Signing in…" : "Sign in"}
|
|
82
|
+
</Button>
|
|
83
|
+
</form>
|
|
84
|
+
</CardContent>
|
|
85
|
+
</Card>
|
|
79
86
|
);
|
|
80
87
|
}
|