@springmicro/cli 0.7.5 → 0.7.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/README.md +5 -5
- package/dist/data/astro/index.js +235 -235
- package/dist/data/form/index.js +260 -260
- package/dist/scripts/forms.bat +10 -10
- package/dist/scripts/forms.sh +8 -8
- package/oclif.manifest.json +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -21,7 +21,7 @@ $ npm install -g @springmicro/cli
|
|
|
21
21
|
$ springmicro COMMAND
|
|
22
22
|
running command...
|
|
23
23
|
$ springmicro (--version)
|
|
24
|
-
@springmicro/cli/0.7.
|
|
24
|
+
@springmicro/cli/0.7.6 win32-x64 node-v22.11.0
|
|
25
25
|
$ springmicro --help [COMMAND]
|
|
26
26
|
USAGE
|
|
27
27
|
$ springmicro COMMAND
|
|
@@ -63,7 +63,7 @@ EXAMPLES
|
|
|
63
63
|
$ springmicro add auth
|
|
64
64
|
```
|
|
65
65
|
|
|
66
|
-
_See code: [src/commands/add/auth.ts](https://github.com/SpringMicro1/springmicrohost-js/blob/v0.7.
|
|
66
|
+
_See code: [src/commands/add/auth.ts](https://github.com/SpringMicro1/springmicrohost-js/blob/v0.7.6/src/commands/add/auth.ts)_
|
|
67
67
|
|
|
68
68
|
## `springmicro add form`
|
|
69
69
|
|
|
@@ -83,7 +83,7 @@ EXAMPLES
|
|
|
83
83
|
$ springmicro add form
|
|
84
84
|
```
|
|
85
85
|
|
|
86
|
-
_See code: [src/commands/add/form.ts](https://github.com/SpringMicro1/springmicrohost-js/blob/v0.7.
|
|
86
|
+
_See code: [src/commands/add/form.ts](https://github.com/SpringMicro1/springmicrohost-js/blob/v0.7.6/src/commands/add/form.ts)_
|
|
87
87
|
|
|
88
88
|
## `springmicro help [COMMAND]`
|
|
89
89
|
|
|
@@ -126,7 +126,7 @@ EXAMPLES
|
|
|
126
126
|
$ springmicro init astro -n example
|
|
127
127
|
```
|
|
128
128
|
|
|
129
|
-
_See code: [src/commands/init/index.ts](https://github.com/SpringMicro1/springmicrohost-js/blob/v0.7.
|
|
129
|
+
_See code: [src/commands/init/index.ts](https://github.com/SpringMicro1/springmicrohost-js/blob/v0.7.6/src/commands/init/index.ts)_
|
|
130
130
|
|
|
131
131
|
## `springmicro init astro`
|
|
132
132
|
|
|
@@ -146,7 +146,7 @@ EXAMPLES
|
|
|
146
146
|
$ springmicro init astro -n <project-name>
|
|
147
147
|
```
|
|
148
148
|
|
|
149
|
-
_See code: [src/commands/init/astro.ts](https://github.com/SpringMicro1/springmicrohost-js/blob/v0.7.
|
|
149
|
+
_See code: [src/commands/init/astro.ts](https://github.com/SpringMicro1/springmicrohost-js/blob/v0.7.6/src/commands/init/astro.ts)_
|
|
150
150
|
|
|
151
151
|
## `springmicro plugins`
|
|
152
152
|
|
package/dist/data/astro/index.js
CHANGED
|
@@ -1,254 +1,254 @@
|
|
|
1
1
|
// some file content from https://ui.shadcn.com/docs/installation/manual
|
|
2
2
|
// unless otherwise specified
|
|
3
3
|
// site last accessed 6/6/2024
|
|
4
|
-
export const tailwindConfigMjs = `const { fontFamily } = require("tailwindcss/defaultTheme")
|
|
5
|
-
|
|
6
|
-
/** @type {import('tailwindcss').Config} */
|
|
7
|
-
module.exports = {
|
|
8
|
-
darkMode: ["class"],
|
|
9
|
-
content: ["./src/**/*.{ts,tsx,astro}"],
|
|
10
|
-
theme: {
|
|
11
|
-
container: {
|
|
12
|
-
center: true,
|
|
13
|
-
padding: "2rem",
|
|
14
|
-
screens: {
|
|
15
|
-
"2xl": "1400px",
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
extend: {
|
|
19
|
-
colors: {
|
|
20
|
-
border: "hsl(var(--border))",
|
|
21
|
-
input: "hsl(var(--input))",
|
|
22
|
-
ring: "hsl(var(--ring))",
|
|
23
|
-
background: "hsl(var(--background))",
|
|
24
|
-
foreground: "hsl(var(--foreground))",
|
|
25
|
-
primary: {
|
|
26
|
-
DEFAULT: "hsl(var(--primary))",
|
|
27
|
-
foreground: "hsl(var(--primary-foreground))",
|
|
28
|
-
},
|
|
29
|
-
secondary: {
|
|
30
|
-
DEFAULT: "hsl(var(--secondary))",
|
|
31
|
-
foreground: "hsl(var(--secondary-foreground))",
|
|
32
|
-
},
|
|
33
|
-
destructive: {
|
|
34
|
-
DEFAULT: "hsl(var(--destructive))",
|
|
35
|
-
foreground: "hsl(var(--destructive-foreground))",
|
|
36
|
-
},
|
|
37
|
-
muted: {
|
|
38
|
-
DEFAULT: "hsl(var(--muted))",
|
|
39
|
-
foreground: "hsl(var(--muted-foreground))",
|
|
40
|
-
},
|
|
41
|
-
accent: {
|
|
42
|
-
DEFAULT: "hsl(var(--accent))",
|
|
43
|
-
foreground: "hsl(var(--accent-foreground))",
|
|
44
|
-
},
|
|
45
|
-
popover: {
|
|
46
|
-
DEFAULT: "hsl(var(--popover))",
|
|
47
|
-
foreground: "hsl(var(--popover-foreground))",
|
|
48
|
-
},
|
|
49
|
-
card: {
|
|
50
|
-
DEFAULT: "hsl(var(--card))",
|
|
51
|
-
foreground: "hsl(var(--card-foreground))",
|
|
52
|
-
},
|
|
53
|
-
},
|
|
54
|
-
borderRadius: {
|
|
55
|
-
lg: \`var(--radius)\`,
|
|
56
|
-
md: \`calc(var(--radius) - 2px)\`,
|
|
57
|
-
sm: "calc(var(--radius) - 4px)",
|
|
58
|
-
},
|
|
59
|
-
fontFamily: {
|
|
60
|
-
sans: ["var(--font-sans)", ...fontFamily.sans],
|
|
61
|
-
},
|
|
62
|
-
keyframes: {
|
|
63
|
-
"accordion-down": {
|
|
64
|
-
from: { height: "0" },
|
|
65
|
-
to: { height: "var(--radix-accordion-content-height)" },
|
|
66
|
-
},
|
|
67
|
-
"accordion-up": {
|
|
68
|
-
from: { height: "var(--radix-accordion-content-height)" },
|
|
69
|
-
to: { height: "0" },
|
|
70
|
-
},
|
|
71
|
-
},
|
|
72
|
-
animation: {
|
|
73
|
-
"accordion-down": "accordion-down 0.2s ease-out",
|
|
74
|
-
"accordion-up": "accordion-up 0.2s ease-out",
|
|
75
|
-
},
|
|
76
|
-
},
|
|
77
|
-
},
|
|
78
|
-
plugins: [require("@tailwindcss/typography"), require("tailwindcss-animate")],
|
|
4
|
+
export const tailwindConfigMjs = `const { fontFamily } = require("tailwindcss/defaultTheme")
|
|
5
|
+
|
|
6
|
+
/** @type {import('tailwindcss').Config} */
|
|
7
|
+
module.exports = {
|
|
8
|
+
darkMode: ["class"],
|
|
9
|
+
content: ["./src/**/*.{ts,tsx,astro}"],
|
|
10
|
+
theme: {
|
|
11
|
+
container: {
|
|
12
|
+
center: true,
|
|
13
|
+
padding: "2rem",
|
|
14
|
+
screens: {
|
|
15
|
+
"2xl": "1400px",
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
extend: {
|
|
19
|
+
colors: {
|
|
20
|
+
border: "hsl(var(--border))",
|
|
21
|
+
input: "hsl(var(--input))",
|
|
22
|
+
ring: "hsl(var(--ring))",
|
|
23
|
+
background: "hsl(var(--background))",
|
|
24
|
+
foreground: "hsl(var(--foreground))",
|
|
25
|
+
primary: {
|
|
26
|
+
DEFAULT: "hsl(var(--primary))",
|
|
27
|
+
foreground: "hsl(var(--primary-foreground))",
|
|
28
|
+
},
|
|
29
|
+
secondary: {
|
|
30
|
+
DEFAULT: "hsl(var(--secondary))",
|
|
31
|
+
foreground: "hsl(var(--secondary-foreground))",
|
|
32
|
+
},
|
|
33
|
+
destructive: {
|
|
34
|
+
DEFAULT: "hsl(var(--destructive))",
|
|
35
|
+
foreground: "hsl(var(--destructive-foreground))",
|
|
36
|
+
},
|
|
37
|
+
muted: {
|
|
38
|
+
DEFAULT: "hsl(var(--muted))",
|
|
39
|
+
foreground: "hsl(var(--muted-foreground))",
|
|
40
|
+
},
|
|
41
|
+
accent: {
|
|
42
|
+
DEFAULT: "hsl(var(--accent))",
|
|
43
|
+
foreground: "hsl(var(--accent-foreground))",
|
|
44
|
+
},
|
|
45
|
+
popover: {
|
|
46
|
+
DEFAULT: "hsl(var(--popover))",
|
|
47
|
+
foreground: "hsl(var(--popover-foreground))",
|
|
48
|
+
},
|
|
49
|
+
card: {
|
|
50
|
+
DEFAULT: "hsl(var(--card))",
|
|
51
|
+
foreground: "hsl(var(--card-foreground))",
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
borderRadius: {
|
|
55
|
+
lg: \`var(--radius)\`,
|
|
56
|
+
md: \`calc(var(--radius) - 2px)\`,
|
|
57
|
+
sm: "calc(var(--radius) - 4px)",
|
|
58
|
+
},
|
|
59
|
+
fontFamily: {
|
|
60
|
+
sans: ["var(--font-sans)", ...fontFamily.sans],
|
|
61
|
+
},
|
|
62
|
+
keyframes: {
|
|
63
|
+
"accordion-down": {
|
|
64
|
+
from: { height: "0" },
|
|
65
|
+
to: { height: "var(--radix-accordion-content-height)" },
|
|
66
|
+
},
|
|
67
|
+
"accordion-up": {
|
|
68
|
+
from: { height: "var(--radix-accordion-content-height)" },
|
|
69
|
+
to: { height: "0" },
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
animation: {
|
|
73
|
+
"accordion-down": "accordion-down 0.2s ease-out",
|
|
74
|
+
"accordion-up": "accordion-up 0.2s ease-out",
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
plugins: [require("@tailwindcss/typography"), require("tailwindcss-animate")],
|
|
79
79
|
}`;
|
|
80
|
-
export const globalsCSS = `@tailwind base;
|
|
81
|
-
@tailwind components;
|
|
82
|
-
@tailwind utilities;
|
|
83
|
-
|
|
84
|
-
@layer base {
|
|
85
|
-
:root {
|
|
86
|
-
/* default font added */
|
|
87
|
-
--font-sans: ui-sans-serif;
|
|
88
|
-
|
|
89
|
-
--background: 0 0% 100%;
|
|
90
|
-
--foreground: 222.2 47.4% 11.2%;
|
|
91
|
-
|
|
92
|
-
--muted: 210 40% 96.1%;
|
|
93
|
-
--muted-foreground: 215.4 16.3% 46.9%;
|
|
94
|
-
|
|
95
|
-
--popover: 0 0% 100%;
|
|
96
|
-
--popover-foreground: 222.2 47.4% 11.2%;
|
|
97
|
-
|
|
98
|
-
--border: 214.3 31.8% 91.4%;
|
|
99
|
-
--input: 214.3 31.8% 91.4%;
|
|
100
|
-
|
|
101
|
-
--card: 0 0% 100%;
|
|
102
|
-
--card-foreground: 222.2 47.4% 11.2%;
|
|
103
|
-
|
|
104
|
-
--primary: 222.2 47.4% 11.2%;
|
|
105
|
-
--primary-foreground: 210 40% 98%;
|
|
106
|
-
|
|
107
|
-
--secondary: 210 40% 96.1%;
|
|
108
|
-
--secondary-foreground: 222.2 47.4% 11.2%;
|
|
109
|
-
|
|
110
|
-
--accent: 210 40% 96.1%;
|
|
111
|
-
--accent-foreground: 222.2 47.4% 11.2%;
|
|
112
|
-
|
|
113
|
-
--destructive: 0 100% 50%;
|
|
114
|
-
--destructive-foreground: 210 40% 98%;
|
|
115
|
-
|
|
116
|
-
--ring: 215 20.2% 65.1%;
|
|
117
|
-
|
|
118
|
-
--radius: 0.5rem;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
.dark {
|
|
122
|
-
--background: 224 71% 4%;
|
|
123
|
-
--foreground: 213 31% 91%;
|
|
124
|
-
|
|
125
|
-
--muted: 223 47% 11%;
|
|
126
|
-
--muted-foreground: 215.4 16.3% 56.9%;
|
|
127
|
-
|
|
128
|
-
--accent: 216 34% 17%;
|
|
129
|
-
--accent-foreground: 210 40% 98%;
|
|
130
|
-
|
|
131
|
-
--popover: 224 71% 4%;
|
|
132
|
-
--popover-foreground: 215 20.2% 65.1%;
|
|
133
|
-
|
|
134
|
-
--border: 216 34% 17%;
|
|
135
|
-
--input: 216 34% 17%;
|
|
136
|
-
|
|
137
|
-
--card: 224 71% 4%;
|
|
138
|
-
--card-foreground: 213 31% 91%;
|
|
139
|
-
|
|
140
|
-
--primary: 210 40% 98%;
|
|
141
|
-
--primary-foreground: 222.2 47.4% 1.2%;
|
|
142
|
-
|
|
143
|
-
--secondary: 222.2 47.4% 11.2%;
|
|
144
|
-
--secondary-foreground: 210 40% 98%;
|
|
145
|
-
|
|
146
|
-
--destructive: 0 63% 31%;
|
|
147
|
-
--destructive-foreground: 210 40% 98%;
|
|
148
|
-
|
|
149
|
-
--ring: 216 34% 17%;
|
|
150
|
-
|
|
151
|
-
--radius: 0.5rem;
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
@layer base {
|
|
156
|
-
* {
|
|
157
|
-
@apply border-border;
|
|
158
|
-
}
|
|
159
|
-
body {
|
|
160
|
-
@apply bg-background text-foreground;
|
|
161
|
-
font-feature-settings: "rlig" 1, "calt" 1;
|
|
162
|
-
}
|
|
163
|
-
/* custom from blog astro template */
|
|
164
|
-
main {
|
|
165
|
-
width: 720px;
|
|
166
|
-
max-width: calc(100% - 2em);
|
|
167
|
-
margin: auto;
|
|
168
|
-
padding: 3em 1em;
|
|
169
|
-
}
|
|
170
|
-
}
|
|
80
|
+
export const globalsCSS = `@tailwind base;
|
|
81
|
+
@tailwind components;
|
|
82
|
+
@tailwind utilities;
|
|
83
|
+
|
|
84
|
+
@layer base {
|
|
85
|
+
:root {
|
|
86
|
+
/* default font added */
|
|
87
|
+
--font-sans: ui-sans-serif;
|
|
88
|
+
|
|
89
|
+
--background: 0 0% 100%;
|
|
90
|
+
--foreground: 222.2 47.4% 11.2%;
|
|
91
|
+
|
|
92
|
+
--muted: 210 40% 96.1%;
|
|
93
|
+
--muted-foreground: 215.4 16.3% 46.9%;
|
|
94
|
+
|
|
95
|
+
--popover: 0 0% 100%;
|
|
96
|
+
--popover-foreground: 222.2 47.4% 11.2%;
|
|
97
|
+
|
|
98
|
+
--border: 214.3 31.8% 91.4%;
|
|
99
|
+
--input: 214.3 31.8% 91.4%;
|
|
100
|
+
|
|
101
|
+
--card: 0 0% 100%;
|
|
102
|
+
--card-foreground: 222.2 47.4% 11.2%;
|
|
103
|
+
|
|
104
|
+
--primary: 222.2 47.4% 11.2%;
|
|
105
|
+
--primary-foreground: 210 40% 98%;
|
|
106
|
+
|
|
107
|
+
--secondary: 210 40% 96.1%;
|
|
108
|
+
--secondary-foreground: 222.2 47.4% 11.2%;
|
|
109
|
+
|
|
110
|
+
--accent: 210 40% 96.1%;
|
|
111
|
+
--accent-foreground: 222.2 47.4% 11.2%;
|
|
112
|
+
|
|
113
|
+
--destructive: 0 100% 50%;
|
|
114
|
+
--destructive-foreground: 210 40% 98%;
|
|
115
|
+
|
|
116
|
+
--ring: 215 20.2% 65.1%;
|
|
117
|
+
|
|
118
|
+
--radius: 0.5rem;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.dark {
|
|
122
|
+
--background: 224 71% 4%;
|
|
123
|
+
--foreground: 213 31% 91%;
|
|
124
|
+
|
|
125
|
+
--muted: 223 47% 11%;
|
|
126
|
+
--muted-foreground: 215.4 16.3% 56.9%;
|
|
127
|
+
|
|
128
|
+
--accent: 216 34% 17%;
|
|
129
|
+
--accent-foreground: 210 40% 98%;
|
|
130
|
+
|
|
131
|
+
--popover: 224 71% 4%;
|
|
132
|
+
--popover-foreground: 215 20.2% 65.1%;
|
|
133
|
+
|
|
134
|
+
--border: 216 34% 17%;
|
|
135
|
+
--input: 216 34% 17%;
|
|
136
|
+
|
|
137
|
+
--card: 224 71% 4%;
|
|
138
|
+
--card-foreground: 213 31% 91%;
|
|
139
|
+
|
|
140
|
+
--primary: 210 40% 98%;
|
|
141
|
+
--primary-foreground: 222.2 47.4% 1.2%;
|
|
142
|
+
|
|
143
|
+
--secondary: 222.2 47.4% 11.2%;
|
|
144
|
+
--secondary-foreground: 210 40% 98%;
|
|
145
|
+
|
|
146
|
+
--destructive: 0 63% 31%;
|
|
147
|
+
--destructive-foreground: 210 40% 98%;
|
|
148
|
+
|
|
149
|
+
--ring: 216 34% 17%;
|
|
150
|
+
|
|
151
|
+
--radius: 0.5rem;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
@layer base {
|
|
156
|
+
* {
|
|
157
|
+
@apply border-border;
|
|
158
|
+
}
|
|
159
|
+
body {
|
|
160
|
+
@apply bg-background text-foreground;
|
|
161
|
+
font-feature-settings: "rlig" 1, "calt" 1;
|
|
162
|
+
}
|
|
163
|
+
/* custom from blog astro template */
|
|
164
|
+
main {
|
|
165
|
+
width: 720px;
|
|
166
|
+
max-width: calc(100% - 2em);
|
|
167
|
+
margin: auto;
|
|
168
|
+
padding: 3em 1em;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
171
|
`;
|
|
172
|
-
export const libUtils = `import { clsx, type ClassValue } from "clsx"
|
|
173
|
-
import { twMerge } from "tailwind-merge"
|
|
174
|
-
|
|
175
|
-
export function cn(...inputs: ClassValue[]) {
|
|
176
|
-
return twMerge(clsx(inputs))
|
|
177
|
-
}
|
|
172
|
+
export const libUtils = `import { clsx, type ClassValue } from "clsx"
|
|
173
|
+
import { twMerge } from "tailwind-merge"
|
|
174
|
+
|
|
175
|
+
export function cn(...inputs: ClassValue[]) {
|
|
176
|
+
return twMerge(clsx(inputs))
|
|
177
|
+
}
|
|
178
178
|
`;
|
|
179
179
|
/**
|
|
180
180
|
* from https://ui.shadcn.com/docs/components-json
|
|
181
181
|
* only change is globals.css => global.css
|
|
182
182
|
*/
|
|
183
|
-
export const componentsJSON = `{
|
|
184
|
-
"$schema": "https://ui.shadcn.com/schema.json",
|
|
185
|
-
"style": "default",
|
|
186
|
-
"rsc": false,
|
|
187
|
-
"tsx": true,
|
|
188
|
-
"tailwind": {
|
|
189
|
-
"config": "tailwind.config.mjs",
|
|
190
|
-
"css": "./src/styles/global.css",
|
|
191
|
-
"baseColor": "slate",
|
|
192
|
-
"cssVariables": true,
|
|
193
|
-
"prefix": ""
|
|
194
|
-
},
|
|
195
|
-
"aliases": {
|
|
196
|
-
"components": "@/components",
|
|
197
|
-
"utils": "@/lib/utils"
|
|
198
|
-
}
|
|
183
|
+
export const componentsJSON = `{
|
|
184
|
+
"$schema": "https://ui.shadcn.com/schema.json",
|
|
185
|
+
"style": "default",
|
|
186
|
+
"rsc": false,
|
|
187
|
+
"tsx": true,
|
|
188
|
+
"tailwind": {
|
|
189
|
+
"config": "tailwind.config.mjs",
|
|
190
|
+
"css": "./src/styles/global.css",
|
|
191
|
+
"baseColor": "slate",
|
|
192
|
+
"cssVariables": true,
|
|
193
|
+
"prefix": ""
|
|
194
|
+
},
|
|
195
|
+
"aliases": {
|
|
196
|
+
"components": "@/components",
|
|
197
|
+
"utils": "@/lib/utils"
|
|
198
|
+
}
|
|
199
199
|
}`;
|
|
200
200
|
/**
|
|
201
201
|
* custom auth config
|
|
202
202
|
*/
|
|
203
|
-
export const authConfigTs = `import { getAuthConfig } from "@springmicro/auth";
|
|
204
|
-
|
|
205
|
-
export default getAuthConfig({
|
|
206
|
-
casdoorEndpoint: import.meta.env.PUBLIC_CASDOOR_ENDPOINT,
|
|
207
|
-
clientId: import.meta.env.PUBLIC_CASDOOR_CLIENT_ID,
|
|
208
|
-
clientSecret: import.meta.env.CASDOOR_CLIENT_SECRET,
|
|
203
|
+
export const authConfigTs = `import { getAuthConfig } from "@springmicro/auth";
|
|
204
|
+
|
|
205
|
+
export default getAuthConfig({
|
|
206
|
+
casdoorEndpoint: import.meta.env.PUBLIC_CASDOOR_ENDPOINT,
|
|
207
|
+
clientId: import.meta.env.PUBLIC_CASDOOR_CLIENT_ID,
|
|
208
|
+
clientSecret: import.meta.env.CASDOOR_CLIENT_SECRET,
|
|
209
209
|
});`;
|
|
210
210
|
/**
|
|
211
211
|
* custom README
|
|
212
212
|
*/
|
|
213
|
-
export const readme = (projectName) => `# ${projectName}
|
|
214
|
-
|
|
215
|
-
[](https://springmicrohost.com)
|
|
216
|
-
|
|
217
|
-
This [Astro](https://astro.build/) project was generated with \`@springmicro/cli\` using the [Astro Starter Kit: Blog](https://github.com/withastro/astro/tree/main/examples/blog) template with some modifications.
|
|
218
|
-
|
|
219
|
-
\`\`\`bash
|
|
220
|
-
npm i -g @springmicro/cli
|
|
221
|
-
springmicro init astro -n ${projectName}
|
|
222
|
-
\`\`\`
|
|
223
|
-
|
|
224
|
-
## Features
|
|
225
|
-
|
|
226
|
-
- [tailwindcss](https://tailwindcss.com/) for CSS classes and theming.
|
|
227
|
-
- [shadcn/ui](https://ui.shadcn.com/) for plug-and-play React components.
|
|
228
|
-
- [Content Collections](https://docs.astro.build/en/guides/content-collections/) for blogs, newsletters, whatever you'd like.
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
## Development
|
|
232
|
-
|
|
233
|
-
Install [pnpm](https://pnpm.io/) if you haven't already.
|
|
234
|
-
|
|
235
|
-
<details>
|
|
236
|
-
<summary>Why pnpm?</summary>
|
|
237
|
-
It's a preference of SpringMicroHost. It mostly boils down to faster install times and better dependency management. \`@springmicro/cli\` commands only support pnpm so far.
|
|
238
|
-
</details>
|
|
239
|
-
|
|
240
|
-
\`\`\`bash
|
|
241
|
-
pnpm install
|
|
242
|
-
pnpm run dev
|
|
243
|
-
\`\`\`
|
|
244
|
-
|
|
245
|
-
## Adding SpringMicro packages
|
|
246
|
-
|
|
247
|
-
\`\`\`bash
|
|
248
|
-
springmicro add auth
|
|
249
|
-
\`\`\`
|
|
250
|
-
|
|
251
|
-
## Learn more
|
|
252
|
-
|
|
253
|
-
Check out [our documentation](https://docs.springmicrohost.com).
|
|
213
|
+
export const readme = (projectName) => `# ${projectName}
|
|
214
|
+
|
|
215
|
+
[](https://springmicrohost.com)
|
|
216
|
+
|
|
217
|
+
This [Astro](https://astro.build/) project was generated with \`@springmicro/cli\` using the [Astro Starter Kit: Blog](https://github.com/withastro/astro/tree/main/examples/blog) template with some modifications.
|
|
218
|
+
|
|
219
|
+
\`\`\`bash
|
|
220
|
+
npm i -g @springmicro/cli
|
|
221
|
+
springmicro init astro -n ${projectName}
|
|
222
|
+
\`\`\`
|
|
223
|
+
|
|
224
|
+
## Features
|
|
225
|
+
|
|
226
|
+
- [tailwindcss](https://tailwindcss.com/) for CSS classes and theming.
|
|
227
|
+
- [shadcn/ui](https://ui.shadcn.com/) for plug-and-play React components.
|
|
228
|
+
- [Content Collections](https://docs.astro.build/en/guides/content-collections/) for blogs, newsletters, whatever you'd like.
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
## Development
|
|
232
|
+
|
|
233
|
+
Install [pnpm](https://pnpm.io/) if you haven't already.
|
|
234
|
+
|
|
235
|
+
<details>
|
|
236
|
+
<summary>Why pnpm?</summary>
|
|
237
|
+
It's a preference of SpringMicroHost. It mostly boils down to faster install times and better dependency management. \`@springmicro/cli\` commands only support pnpm so far.
|
|
238
|
+
</details>
|
|
239
|
+
|
|
240
|
+
\`\`\`bash
|
|
241
|
+
pnpm install
|
|
242
|
+
pnpm run dev
|
|
243
|
+
\`\`\`
|
|
244
|
+
|
|
245
|
+
## Adding SpringMicro packages
|
|
246
|
+
|
|
247
|
+
\`\`\`bash
|
|
248
|
+
springmicro add auth
|
|
249
|
+
\`\`\`
|
|
250
|
+
|
|
251
|
+
## Learn more
|
|
252
|
+
|
|
253
|
+
Check out [our documentation](https://docs.springmicrohost.com).
|
|
254
254
|
`;
|
package/dist/data/form/index.js
CHANGED
|
@@ -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/scripts/forms.bat
CHANGED
|
@@ -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
|
package/dist/scripts/forms.sh
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
# no to overwriting shadcn components that have already been installed
|
|
2
|
-
yes no | pnpm dlx shadcn@latest add form
|
|
3
|
-
yes no | pnpm dlx shadcn@latest add button
|
|
4
|
-
yes no | pnpm dlx shadcn@latest add textarea
|
|
5
|
-
yes no | pnpm dlx shadcn@latest add label
|
|
6
|
-
yes no | pnpm dlx shadcn@latest add input
|
|
7
|
-
yes no | pnpm dlx shadcn@latest add sonner
|
|
8
|
-
pnpm add @springmicro/forms
|
|
1
|
+
# no to overwriting shadcn components that have already been installed
|
|
2
|
+
yes no | pnpm dlx shadcn@latest add form
|
|
3
|
+
yes no | pnpm dlx shadcn@latest add button
|
|
4
|
+
yes no | pnpm dlx shadcn@latest add textarea
|
|
5
|
+
yes no | pnpm dlx shadcn@latest add label
|
|
6
|
+
yes no | pnpm dlx shadcn@latest add input
|
|
7
|
+
yes no | pnpm dlx shadcn@latest add sonner
|
|
8
|
+
pnpm add @springmicro/forms
|
package/oclif.manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@springmicro/cli",
|
|
3
3
|
"description": "A new CLI generated with oclif",
|
|
4
|
-
"version": "0.7.
|
|
4
|
+
"version": "0.7.6",
|
|
5
5
|
"author": "David Buckley",
|
|
6
6
|
"private": false,
|
|
7
7
|
"publishConfig": {
|
|
@@ -76,5 +76,5 @@
|
|
|
76
76
|
"version": "oclif readme && git add README.md"
|
|
77
77
|
},
|
|
78
78
|
"types": "dist/index.d.ts",
|
|
79
|
-
"gitHead": "
|
|
79
|
+
"gitHead": "80da3d6ac6bca817c19b88466b9c6c1a1f90b4fc"
|
|
80
80
|
}
|