@springmicro/cli 0.7.0 → 0.7.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.
@@ -1,271 +1,271 @@
1
1
  const contact = {
2
2
  name: 'Contact',
3
- tsx: `import { zodResolver } from "@hookform/resolvers/zod";
4
- import { useForm } from "react-hook-form";
5
- import { z } from "zod";
6
- import { Button } from "@/components/ui/button";
7
- import { toast } from "sonner";
8
- import {
9
- Form,
10
- FormControl,
11
- FormDescription,
12
- FormField,
13
- FormItem,
14
- FormLabel,
15
- FormMessage,
16
- } from "@/components/ui/form";
17
- import { Input } from "@/components/ui/input";
18
- import { Textarea } from "@/components/ui/textarea"; // Assume you have a Textarea component
19
-
20
- const formSchema = z.object({
21
- name: z.string().min(1, {
22
- message: "Name is required.",
23
- }),
24
- email: z.string().email({
25
- message: "Invalid email address.",
26
- }),
27
- message: z.string().min(1, {
28
- message: "Message is required.",
29
- }),
30
- });
31
-
32
- export function ContactForm() {
33
- // 1. Define your form.
34
- const form = useForm<z.infer<typeof formSchema>>({
35
- resolver: zodResolver(formSchema),
36
- defaultValues: {
37
- name: "",
38
- email: "",
39
- message: "",
40
- },
41
- });
42
-
43
- // 2. Define a submit handler.
44
- async function onSubmit(values: z.infer<typeof formSchema>) {
45
- // Do something with the form values.
46
- console.log(values);
47
- const res = await fetch("/api/forms/contact", {
48
- method: "POST",
49
- body: JSON.stringify(values),
50
- headers: { "Content-Type": "application/json" },
51
- });
52
- if (res.ok) {
53
- // success toast
54
- toast("Form submitted!");
55
- } else {
56
- // error toast
57
- toast("Error submitting form, refresh and try again.");
58
- }
59
- }
60
-
61
- return (
62
- <Form {...form}>
63
- <form onSubmit={form.handleSubmit(onSubmit)} className="space-y-8">
64
- <FormField
65
- control={form.control}
66
- name="name"
67
- render={({ field }) => (
68
- <FormItem>
69
- <FormLabel>Name</FormLabel>
70
- <FormControl>
71
- <Input placeholder="Your Name" {...field} />
72
- </FormControl>
73
- <FormMessage />
74
- </FormItem>
75
- )}
76
- />
77
- <FormField
78
- control={form.control}
79
- name="email"
80
- render={({ field }) => (
81
- <FormItem>
82
- <FormLabel>Email</FormLabel>
83
- <FormControl>
84
- <Input
85
- type="email"
86
- placeholder="your.email@example.com"
87
- {...field}
88
- />
89
- </FormControl>
90
- <FormMessage />
91
- </FormItem>
92
- )}
93
- />
94
- <FormField
95
- control={form.control}
96
- name="message"
97
- render={({ field }) => (
98
- <FormItem>
99
- <FormLabel>Message</FormLabel>
100
- <FormControl>
101
- <Textarea rows={4} placeholder="Your message" {...field} />
102
- </FormControl>
103
- <FormMessage />
104
- </FormItem>
105
- )}
106
- />
107
- <Button type="submit">Submit</Button>
108
- </form>
109
- </Form>
110
- );
111
- }
112
-
3
+ tsx: `import { zodResolver } from "@hookform/resolvers/zod";
4
+ import { useForm } from "react-hook-form";
5
+ import { z } from "zod";
6
+ import { Button } from "@/components/ui/button";
7
+ import { toast } from "sonner";
8
+ import {
9
+ Form,
10
+ FormControl,
11
+ FormDescription,
12
+ FormField,
13
+ FormItem,
14
+ FormLabel,
15
+ FormMessage,
16
+ } from "@/components/ui/form";
17
+ import { Input } from "@/components/ui/input";
18
+ import { Textarea } from "@/components/ui/textarea"; // Assume you have a Textarea component
19
+
20
+ const formSchema = z.object({
21
+ name: z.string().min(1, {
22
+ message: "Name is required.",
23
+ }),
24
+ email: z.string().email({
25
+ message: "Invalid email address.",
26
+ }),
27
+ message: z.string().min(1, {
28
+ message: "Message is required.",
29
+ }),
30
+ });
31
+
32
+ export function ContactForm() {
33
+ // 1. Define your form.
34
+ const form = useForm<z.infer<typeof formSchema>>({
35
+ resolver: zodResolver(formSchema),
36
+ defaultValues: {
37
+ name: "",
38
+ email: "",
39
+ message: "",
40
+ },
41
+ });
42
+
43
+ // 2. Define a submit handler.
44
+ async function onSubmit(values: z.infer<typeof formSchema>) {
45
+ // Do something with the form values.
46
+ console.log(values);
47
+ const res = await fetch("/api/forms/contact", {
48
+ method: "POST",
49
+ body: JSON.stringify(values),
50
+ headers: { "Content-Type": "application/json" },
51
+ });
52
+ if (res.ok) {
53
+ // success toast
54
+ toast("Form submitted!");
55
+ } else {
56
+ // error toast
57
+ toast("Error submitting form, refresh and try again.");
58
+ }
59
+ }
60
+
61
+ return (
62
+ <Form {...form}>
63
+ <form onSubmit={form.handleSubmit(onSubmit)} className="space-y-8">
64
+ <FormField
65
+ control={form.control}
66
+ name="name"
67
+ render={({ field }) => (
68
+ <FormItem>
69
+ <FormLabel>Name</FormLabel>
70
+ <FormControl>
71
+ <Input placeholder="Your Name" {...field} />
72
+ </FormControl>
73
+ <FormMessage />
74
+ </FormItem>
75
+ )}
76
+ />
77
+ <FormField
78
+ control={form.control}
79
+ name="email"
80
+ render={({ field }) => (
81
+ <FormItem>
82
+ <FormLabel>Email</FormLabel>
83
+ <FormControl>
84
+ <Input
85
+ type="email"
86
+ placeholder="your.email@example.com"
87
+ {...field}
88
+ />
89
+ </FormControl>
90
+ <FormMessage />
91
+ </FormItem>
92
+ )}
93
+ />
94
+ <FormField
95
+ control={form.control}
96
+ name="message"
97
+ render={({ field }) => (
98
+ <FormItem>
99
+ <FormLabel>Message</FormLabel>
100
+ <FormControl>
101
+ <Textarea rows={4} placeholder="Your message" {...field} />
102
+ </FormControl>
103
+ <FormMessage />
104
+ </FormItem>
105
+ )}
106
+ />
107
+ <Button type="submit">Submit</Button>
108
+ </form>
109
+ </Form>
110
+ );
111
+ }
112
+
113
113
  `,
114
- api: `import { emailOnlySGJSON } from "@springmicro/forms";
115
- import type { APIRoute } from "astro";
116
-
117
- export const POST: APIRoute = async ({ params, request }) => {
118
- const subject = "Contact Form Submission";
119
- const json = await request.json();
120
- const to: string[] = [json.email];
121
- const cc: string[] = [];
122
- const bcc: string[] = [];
123
-
124
- const res = await emailOnlySGJSON(
125
- import.meta.env.SENDGRID_API_KEY,
126
- subject,
127
- json,
128
- to,
129
- cc,
130
- bcc
131
- );
132
- return res;
133
- };
114
+ api: `import { emailOnlySGJSON } from "@springmicro/forms";
115
+ import type { APIRoute } from "astro";
116
+
117
+ export const POST: APIRoute = async ({ params, request }) => {
118
+ const subject = "Contact Form Submission";
119
+ const json = await request.json();
120
+ const to: string[] = [json.email];
121
+ const cc: string[] = [];
122
+ const bcc: string[] = [];
123
+
124
+ const res = await emailOnlySGJSON(
125
+ import.meta.env.SENDGRID_API_KEY,
126
+ subject,
127
+ json,
128
+ to,
129
+ cc,
130
+ bcc
131
+ );
132
+ return res;
133
+ };
134
134
  `,
135
135
  };
136
136
  const quote = {
137
137
  name: 'Quote',
138
- tsx: `import { zodResolver } from "@hookform/resolvers/zod";
139
- import { useForm } from "react-hook-form";
140
- import { z } from "zod";
141
- import { Button } from "@/components/ui/button";
142
- import { toast } from "sonner";
143
- import {
144
- Form,
145
- FormControl,
146
- FormDescription,
147
- FormField,
148
- FormItem,
149
- FormLabel,
150
- FormMessage,
151
- } from "@/components/ui/form";
152
- import { Input } from "@/components/ui/input";
153
- import { Textarea } from "@/components/ui/textarea"; // Assume you have a Textarea component
154
-
155
- const formSchema = z.object({
156
- name: z.string().min(1, {
157
- message: "Name is required.",
158
- }),
159
- email: z.string().email({
160
- message: "Invalid email address.",
161
- }),
162
- message: z.string().min(1, {
163
- message: "Message is required.",
164
- }),
165
- });
166
-
167
- export function QuoteForm() {
168
- // 1. Define your form.
169
- const form = useForm<z.infer<typeof formSchema>>({
170
- resolver: zodResolver(formSchema),
171
- defaultValues: {
172
- name: "",
173
- email: "",
174
- message: "",
175
- },
176
- });
177
-
178
- // 2. Define a submit handler.
179
- async function onSubmit(values: z.infer<typeof formSchema>) {
180
- // Do something with the form values.
181
- console.log(values);
182
- const res = await fetch("/api/forms/quote", {
183
- method: "POST",
184
- body: JSON.stringify(values),
185
- headers: { "Content-Type": "application/json" },
186
- });
187
- if (res.ok) {
188
- // success toast
189
- toast("Form submitted!");
190
- } else {
191
- // error toast
192
- toast("Error submitting form, refresh and try again.");
193
- }
194
- }
195
-
196
- return (
197
- <Form {...form}>
198
- <form onSubmit={form.handleSubmit(onSubmit)} className="space-y-8">
199
- <FormField
200
- control={form.control}
201
- name="name"
202
- render={({ field }) => (
203
- <FormItem>
204
- <FormLabel>Name</FormLabel>
205
- <FormControl>
206
- <Input placeholder="Your Name" {...field} />
207
- </FormControl>
208
- <FormMessage />
209
- </FormItem>
210
- )}
211
- />
212
- <FormField
213
- control={form.control}
214
- name="email"
215
- render={({ field }) => (
216
- <FormItem>
217
- <FormLabel>Email</FormLabel>
218
- <FormControl>
219
- <Input
220
- type="email"
221
- placeholder="your.email@example.com"
222
- {...field}
223
- />
224
- </FormControl>
225
- <FormMessage />
226
- </FormItem>
227
- )}
228
- />
229
- <FormField
230
- control={form.control}
231
- name="message"
232
- render={({ field }) => (
233
- <FormItem>
234
- <FormLabel>Message</FormLabel>
235
- <FormControl>
236
- <Textarea rows={4} placeholder="Your message" {...field} />
237
- </FormControl>
238
- <FormMessage />
239
- </FormItem>
240
- )}
241
- />
242
- <Button type="submit">Submit</Button>
243
- </form>
244
- </Form>
245
- );
246
- }
247
-
138
+ tsx: `import { zodResolver } from "@hookform/resolvers/zod";
139
+ import { useForm } from "react-hook-form";
140
+ import { z } from "zod";
141
+ import { Button } from "@/components/ui/button";
142
+ import { toast } from "sonner";
143
+ import {
144
+ Form,
145
+ FormControl,
146
+ FormDescription,
147
+ FormField,
148
+ FormItem,
149
+ FormLabel,
150
+ FormMessage,
151
+ } from "@/components/ui/form";
152
+ import { Input } from "@/components/ui/input";
153
+ import { Textarea } from "@/components/ui/textarea"; // Assume you have a Textarea component
154
+
155
+ const formSchema = z.object({
156
+ name: z.string().min(1, {
157
+ message: "Name is required.",
158
+ }),
159
+ email: z.string().email({
160
+ message: "Invalid email address.",
161
+ }),
162
+ message: z.string().min(1, {
163
+ message: "Message is required.",
164
+ }),
165
+ });
166
+
167
+ export function QuoteForm() {
168
+ // 1. Define your form.
169
+ const form = useForm<z.infer<typeof formSchema>>({
170
+ resolver: zodResolver(formSchema),
171
+ defaultValues: {
172
+ name: "",
173
+ email: "",
174
+ message: "",
175
+ },
176
+ });
177
+
178
+ // 2. Define a submit handler.
179
+ async function onSubmit(values: z.infer<typeof formSchema>) {
180
+ // Do something with the form values.
181
+ console.log(values);
182
+ const res = await fetch("/api/forms/quote", {
183
+ method: "POST",
184
+ body: JSON.stringify(values),
185
+ headers: { "Content-Type": "application/json" },
186
+ });
187
+ if (res.ok) {
188
+ // success toast
189
+ toast("Form submitted!");
190
+ } else {
191
+ // error toast
192
+ toast("Error submitting form, refresh and try again.");
193
+ }
194
+ }
195
+
196
+ return (
197
+ <Form {...form}>
198
+ <form onSubmit={form.handleSubmit(onSubmit)} className="space-y-8">
199
+ <FormField
200
+ control={form.control}
201
+ name="name"
202
+ render={({ field }) => (
203
+ <FormItem>
204
+ <FormLabel>Name</FormLabel>
205
+ <FormControl>
206
+ <Input placeholder="Your Name" {...field} />
207
+ </FormControl>
208
+ <FormMessage />
209
+ </FormItem>
210
+ )}
211
+ />
212
+ <FormField
213
+ control={form.control}
214
+ name="email"
215
+ render={({ field }) => (
216
+ <FormItem>
217
+ <FormLabel>Email</FormLabel>
218
+ <FormControl>
219
+ <Input
220
+ type="email"
221
+ placeholder="your.email@example.com"
222
+ {...field}
223
+ />
224
+ </FormControl>
225
+ <FormMessage />
226
+ </FormItem>
227
+ )}
228
+ />
229
+ <FormField
230
+ control={form.control}
231
+ name="message"
232
+ render={({ field }) => (
233
+ <FormItem>
234
+ <FormLabel>Message</FormLabel>
235
+ <FormControl>
236
+ <Textarea rows={4} placeholder="Your message" {...field} />
237
+ </FormControl>
238
+ <FormMessage />
239
+ </FormItem>
240
+ )}
241
+ />
242
+ <Button type="submit">Submit</Button>
243
+ </form>
244
+ </Form>
245
+ );
246
+ }
247
+
248
248
  `,
249
- api: `import { emailOnlySGJSON } from "@springmicro/forms";
250
- import type { APIRoute } from "astro";
251
-
252
- export const POST: APIRoute = async ({ params, request }) => {
253
- const subject = "Request a Quote Submission";
254
- const json = await request.json();
255
- const to: string[] = [json.email];
256
- const cc: string[] = [];
257
- const bcc: string[] = [];
258
-
259
- const res = await emailOnlySGJSON(
260
- import.meta.env.SENDGRID_API_KEY,
261
- subject,
262
- json,
263
- to,
264
- cc,
265
- bcc
266
- );
267
- return res;
268
- };
249
+ api: `import { emailOnlySGJSON } from "@springmicro/forms";
250
+ import type { APIRoute } from "astro";
251
+
252
+ export const POST: APIRoute = async ({ params, request }) => {
253
+ const subject = "Request a Quote Submission";
254
+ const json = await request.json();
255
+ const to: string[] = [json.email];
256
+ const cc: string[] = [];
257
+ const bcc: string[] = [];
258
+
259
+ const res = await emailOnlySGJSON(
260
+ import.meta.env.SENDGRID_API_KEY,
261
+ subject,
262
+ json,
263
+ to,
264
+ cc,
265
+ bcc
266
+ );
267
+ return res;
268
+ };
269
269
  `,
270
270
  };
271
271
  export default {
package/dist/index.d.ts CHANGED
File without changes
package/dist/index.js CHANGED
File without changes
File without changes
package/dist/log/index.js CHANGED
File without changes
@@ -1,34 +1,34 @@
1
- @echo off
2
- setlocal
3
-
4
- :: Check if a project name was provided
5
- if "%~1"=="" (
6
- echo Usage: %0 projectName
7
- exit /b 1
8
- )
9
-
10
- set projectName=%~1
11
-
12
- :: Create a new Astro project with the specified template and options
13
- pnpm create astro %projectName% -- --template blog --install --typescript relaxed --git -y
14
- if errorlevel 1 exit /b %errorlevel%
15
-
16
- cd %projectName%
17
-
18
- :: Add React to the Astro project
19
- pnpx astro add react -y
20
- if errorlevel 1 exit /b %errorlevel%
21
-
22
- :: Add Tailwind CSS to the Astro project
23
- pnpx astro add tailwind -y
24
- if errorlevel 1 exit /b %errorlevel%
25
-
26
- :: Install additional packages for shadcn-ui + icon libraries
27
- pnpm install tailwindcss-animate class-variance-authority clsx tailwind-merge lucide-react react-icons
28
- if errorlevel 1 exit /b %errorlevel%
29
-
30
- :: Install dev packages
31
- pnpm install -D @tailwindcss/typography
32
- if errorlevel 1 exit /b %errorlevel%
33
-
34
- endlocal
1
+ @echo off
2
+ setlocal
3
+
4
+ :: Check if a project name was provided
5
+ if "%~1"=="" (
6
+ echo Usage: %0 projectName
7
+ exit /b 1
8
+ )
9
+
10
+ set projectName=%~1
11
+
12
+ :: Create a new Astro project with the specified template and options
13
+ pnpm create astro %projectName% -- --template blog --install --typescript relaxed --git -y
14
+ if errorlevel 1 exit /b %errorlevel%
15
+
16
+ cd %projectName%
17
+
18
+ :: Add React to the Astro project
19
+ pnpx astro add react -y
20
+ if errorlevel 1 exit /b %errorlevel%
21
+
22
+ :: Add Tailwind CSS to the Astro project
23
+ pnpx astro add tailwind -y
24
+ if errorlevel 1 exit /b %errorlevel%
25
+
26
+ :: Install additional packages for shadcn-ui + icon libraries
27
+ pnpm install tailwindcss-animate class-variance-authority clsx tailwind-merge lucide-react react-icons
28
+ if errorlevel 1 exit /b %errorlevel%
29
+
30
+ :: Install dev packages
31
+ pnpm install -D @tailwindcss/typography
32
+ if errorlevel 1 exit /b %errorlevel%
33
+
34
+ endlocal
@@ -1,9 +1,9 @@
1
- projectName=$1
2
- pnpm create astro $projectName -- --template blog --install --typescript relaxed --git -y
3
- cd $projectName
4
- pnpx astro add react -y
5
- pnpx astro add tailwind -y
6
- # shadcn-ui
7
- # https://ui.shadcn.com/docs/installation/manual
8
- pnpm install tailwindcss-animate class-variance-authority clsx tailwind-merge lucide-react react-icons
9
- pnpm install -D @tailwindcss/typography
1
+ projectName=$1
2
+ pnpm create astro $projectName -- --template blog --install --typescript relaxed --git -y
3
+ cd $projectName
4
+ pnpx astro add react -y
5
+ pnpx astro add tailwind -y
6
+ # shadcn-ui
7
+ # https://ui.shadcn.com/docs/installation/manual
8
+ pnpm install tailwindcss-animate class-variance-authority clsx tailwind-merge lucide-react react-icons
9
+ pnpm install -D @tailwindcss/typography
@@ -1,5 +1,5 @@
1
- @echo off
2
-
3
- REM Use PowerShell to simulate yes command and pipe to pnpm
4
- powershell -Command "while ($true) { Write-Output 'y' }" | pnpm run astro add auth-astro
1
+ @echo off
2
+
3
+ REM Use PowerShell to simulate yes command and pipe to pnpm
4
+ powershell -Command "while ($true) { Write-Output 'y' }" | pnpm run astro add auth-astro
5
5
  pnpm add @springmicro/auth
@@ -1,4 +1,4 @@
1
- # https://github.com/nowaythatworked/auth-astro?tab=readme-ov-file#installation
2
- # https://unix.stackexchange.com/a/512368
3
- yes | pnpm run astro add auth-astro
1
+ # https://github.com/nowaythatworked/auth-astro?tab=readme-ov-file#installation
2
+ # https://unix.stackexchange.com/a/512368
3
+ yes | pnpm run astro add auth-astro
4
4
  pnpm add @springmicro/auth
@@ -1,10 +1,10 @@
1
- @echo off
2
-
3
- REM Use PowerShell to simulate 'yes no' command and pipe to pnpm
4
- powershell -Command "while ($true) { Write-Output 'n' }" | pnpm dlx shadcn@latest add form
5
- powershell -Command "while ($true) { Write-Output 'n' }" | pnpm dlx shadcn@latest add button
6
- powershell -Command "while ($true) { Write-Output 'n' }" | pnpm dlx shadcn@latest add textarea
7
- powershell -Command "while ($true) { Write-Output 'n' }" | pnpm dlx shadcn@latest add label
8
- powershell -Command "while ($true) { Write-Output 'n' }" | pnpm dlx shadcn@latest add input
9
- powershell -Command "while ($true) { Write-Output 'n' }" | pnpm dlx shadcn@latest add sonner
10
- pnpm add @springmicro/forms
1
+ @echo off
2
+
3
+ REM Use PowerShell to simulate 'yes no' command and pipe to pnpm
4
+ powershell -Command "while ($true) { Write-Output 'n' }" | pnpm dlx shadcn@latest add form
5
+ powershell -Command "while ($true) { Write-Output 'n' }" | pnpm dlx shadcn@latest add button
6
+ powershell -Command "while ($true) { Write-Output 'n' }" | pnpm dlx shadcn@latest add textarea
7
+ powershell -Command "while ($true) { Write-Output 'n' }" | pnpm dlx shadcn@latest add label
8
+ powershell -Command "while ($true) { Write-Output 'n' }" | pnpm dlx shadcn@latest add input
9
+ powershell -Command "while ($true) { Write-Output 'n' }" | pnpm dlx shadcn@latest add sonner
10
+ pnpm add @springmicro/forms