@aditokmo/react-setup-cli 0.1.0
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 +134 -0
- package/dist/index.js +81 -0
- package/dist/installers.js +23 -0
- package/dist/mapper.js +17 -0
- package/dist/packages.js +60 -0
- package/dist/questions.js +82 -0
- package/dist/types.js +1 -0
- package/dist/utils.js +74 -0
- package/package.json +65 -0
- package/templates/base/README.md +73 -0
- package/templates/base/eslint.config.js +23 -0
- package/templates/base/index.html +14 -0
- package/templates/base/package.json +30 -0
- package/templates/base/pnpm-lock.yaml +2105 -0
- package/templates/base/public/vite.svg +1 -0
- package/templates/base/src/App.tsx +9 -0
- package/templates/base/src/api/api.ts +29 -0
- package/templates/base/src/api/http.ts +27 -0
- package/templates/base/src/api/index.ts +2 -0
- package/templates/base/src/assets/react.svg +1 -0
- package/templates/base/src/layout/AuthLayout.tsx +0 -0
- package/templates/base/src/layout/MainLayout.tsx +0 -0
- package/templates/base/src/layout/index.ts +2 -0
- package/templates/base/src/main.tsx +9 -0
- package/templates/base/src/modules/auth/components/AuthForm.tsx +5 -0
- package/templates/base/src/modules/auth/hooks/useAuth.ts +43 -0
- package/templates/base/src/modules/auth/pages/ForgotPassword.tsx +5 -0
- package/templates/base/src/modules/auth/pages/Login.tsx +5 -0
- package/templates/base/src/modules/auth/pages/Register.tsx +5 -0
- package/templates/base/src/modules/auth/pages/index.ts +3 -0
- package/templates/base/src/modules/auth/services/auth.service.ts +17 -0
- package/templates/base/src/modules/auth/services/endpoint.ts +10 -0
- package/templates/base/src/modules/auth/services/index.ts +3 -0
- package/templates/base/src/modules/auth/services/oauth.service.ts +1 -0
- package/templates/base/src/modules/auth/services/password.service.ts +1 -0
- package/templates/base/src/modules/auth/types/auth.types.ts +3 -0
- package/templates/base/src/modules/auth/types/index.ts +3 -0
- package/templates/base/src/modules/auth/types/oauth.types.ts +1 -0
- package/templates/base/src/modules/auth/types/password.types.ts +1 -0
- package/templates/base/src/modules/common/pages/NotFound.tsx +9 -0
- package/templates/base/src/modules/common/pages/index.ts +1 -0
- package/templates/base/src/utils/api-error-handler.ts +25 -0
- package/templates/base/tsconfig.app.json +32 -0
- package/templates/base/tsconfig.json +13 -0
- package/templates/base/tsconfig.node.json +26 -0
- package/templates/base/vite-env.d.ts +1 -0
- package/templates/base/vite.config.ts +18 -0
- package/templates/hooks/index.ts +0 -0
- package/templates/hooks/useDebounce.ts +1 -0
- package/templates/hooks/useTheme.ts +1 -0
- package/templates/hooks/useThrottle.ts +1 -0
- package/templates/hooks/useWebStorage.ts +1 -0
- package/templates/router/react-router/src/components/ProtectedRoute.tsx +20 -0
- package/templates/router/react-router/src/components/PublicRoute.tsx +20 -0
- package/templates/router/react-router/src/modules/auth/routes/index.tsx +21 -0
- package/templates/router/react-router/src/routes/AppRoutes.tsx +18 -0
- package/templates/router/react-router/src/routes/index.ts +3 -0
- package/templates/router/tanstack-router/src/providers/TanstackRouterProvider.tsx +14 -0
- package/templates/router/tanstack-router/src/routes/__root.tsx +13 -0
- package/templates/router/tanstack-router/src/routes/_protected/index.tsx +10 -0
- package/templates/router/tanstack-router/src/routes/_protected.tsx +18 -0
- package/templates/router/tanstack-router/src/routes/_public/forgot-password.tsx +6 -0
- package/templates/router/tanstack-router/src/routes/_public/login.tsx +6 -0
- package/templates/router/tanstack-router/src/routes/_public/register.tsx +6 -0
- package/templates/router/tanstack-router/src/routes/_public.tsx +13 -0
- package/templates/state/react-query/src/ReactQueryProvider.tsx +15 -0
- package/templates/state/react-query/src/index.ts +1 -0
- package/templates/state/zustand/src/auth/useAuthStore.ts +29 -0
- package/templates/state/zustand/src/index.ts +2 -0
- package/templates/state/zustand/src/theme/useThemeStore.ts +27 -0
- package/templates/styles/css/src/main.css +0 -0
- package/templates/styles/scss/src/main.scss +0 -0
- package/templates/styles/tailwind/config/_vite.config.ts +14 -0
- package/templates/styles/tailwind/src/main.css +123 -0
- package/templates/ui/shadcn/src/components/ui/button.tsx +62 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { create } from 'zustand';
|
|
2
|
+
import { persist, devtools } from 'zustand/middleware';
|
|
3
|
+
|
|
4
|
+
interface Theme {
|
|
5
|
+
theme: 'light' | 'dark';
|
|
6
|
+
setTheme: (theme: 'light' | 'dark') => void;
|
|
7
|
+
toggleTheme: () => void;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const useThemeStore = create<Theme>()(
|
|
11
|
+
devtools(
|
|
12
|
+
persist((set) => ({
|
|
13
|
+
theme: 'light',
|
|
14
|
+
setTheme: (theme) => set({ theme }),
|
|
15
|
+
toggleTheme: () => set((state) => ({
|
|
16
|
+
theme: state.theme === 'light' ? 'dark' : 'light'
|
|
17
|
+
})),
|
|
18
|
+
}),
|
|
19
|
+
{
|
|
20
|
+
name: 'theme'
|
|
21
|
+
}
|
|
22
|
+
),
|
|
23
|
+
{
|
|
24
|
+
name: 'ThemeStore'
|
|
25
|
+
}
|
|
26
|
+
)
|
|
27
|
+
)
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import path from "path"
|
|
2
|
+
import tailwindcss from "@tailwindcss/vite"
|
|
3
|
+
import react from "@vitejs/plugin-react"
|
|
4
|
+
import { defineConfig } from "vite"
|
|
5
|
+
|
|
6
|
+
// https://vite.dev/config/
|
|
7
|
+
export default defineConfig({
|
|
8
|
+
plugins: [react(), tailwindcss()],
|
|
9
|
+
resolve: {
|
|
10
|
+
alias: {
|
|
11
|
+
"@": path.resolve(__dirname, "./src"),
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
})
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
@import "tailwindcss";
|
|
2
|
+
@import "tw-animate-css";
|
|
3
|
+
|
|
4
|
+
@custom-variant dark (&:is(.dark *));
|
|
5
|
+
|
|
6
|
+
@theme inline {
|
|
7
|
+
--radius-sm: calc(var(--radius) - 4px);
|
|
8
|
+
--radius-md: calc(var(--radius) - 2px);
|
|
9
|
+
--radius-lg: var(--radius);
|
|
10
|
+
--radius-xl: calc(var(--radius) + 4px);
|
|
11
|
+
--radius-2xl: calc(var(--radius) + 8px);
|
|
12
|
+
--radius-3xl: calc(var(--radius) + 12px);
|
|
13
|
+
--radius-4xl: calc(var(--radius) + 16px);
|
|
14
|
+
--color-background: var(--background);
|
|
15
|
+
--color-foreground: var(--foreground);
|
|
16
|
+
--color-card: var(--card);
|
|
17
|
+
--color-card-foreground: var(--card-foreground);
|
|
18
|
+
--color-popover: var(--popover);
|
|
19
|
+
--color-popover-foreground: var(--popover-foreground);
|
|
20
|
+
--color-primary: var(--primary);
|
|
21
|
+
--color-primary-foreground: var(--primary-foreground);
|
|
22
|
+
--color-secondary: var(--secondary);
|
|
23
|
+
--color-secondary-foreground: var(--secondary-foreground);
|
|
24
|
+
--color-muted: var(--muted);
|
|
25
|
+
--color-muted-foreground: var(--muted-foreground);
|
|
26
|
+
--color-accent: var(--accent);
|
|
27
|
+
--color-accent-foreground: var(--accent-foreground);
|
|
28
|
+
--color-destructive: var(--destructive);
|
|
29
|
+
--color-border: var(--border);
|
|
30
|
+
--color-input: var(--input);
|
|
31
|
+
--color-ring: var(--ring);
|
|
32
|
+
--color-chart-1: var(--chart-1);
|
|
33
|
+
--color-chart-2: var(--chart-2);
|
|
34
|
+
--color-chart-3: var(--chart-3);
|
|
35
|
+
--color-chart-4: var(--chart-4);
|
|
36
|
+
--color-chart-5: var(--chart-5);
|
|
37
|
+
--color-sidebar: var(--sidebar);
|
|
38
|
+
--color-sidebar-foreground: var(--sidebar-foreground);
|
|
39
|
+
--color-sidebar-primary: var(--sidebar-primary);
|
|
40
|
+
--color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
|
|
41
|
+
--color-sidebar-accent: var(--sidebar-accent);
|
|
42
|
+
--color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
|
|
43
|
+
--color-sidebar-border: var(--sidebar-border);
|
|
44
|
+
--color-sidebar-ring: var(--sidebar-ring);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
:root {
|
|
48
|
+
--radius: 0.625rem;
|
|
49
|
+
--background: oklch(1 0 0);
|
|
50
|
+
--foreground: oklch(0.145 0 0);
|
|
51
|
+
--card: oklch(1 0 0);
|
|
52
|
+
--card-foreground: oklch(0.145 0 0);
|
|
53
|
+
--popover: oklch(1 0 0);
|
|
54
|
+
--popover-foreground: oklch(0.145 0 0);
|
|
55
|
+
--primary: oklch(0.205 0 0);
|
|
56
|
+
--primary-foreground: oklch(0.985 0 0);
|
|
57
|
+
--secondary: oklch(0.97 0 0);
|
|
58
|
+
--secondary-foreground: oklch(0.205 0 0);
|
|
59
|
+
--muted: oklch(0.97 0 0);
|
|
60
|
+
--muted-foreground: oklch(0.556 0 0);
|
|
61
|
+
--accent: oklch(0.97 0 0);
|
|
62
|
+
--accent-foreground: oklch(0.205 0 0);
|
|
63
|
+
--destructive: oklch(0.577 0.245 27.325);
|
|
64
|
+
--border: oklch(0.922 0 0);
|
|
65
|
+
--input: oklch(0.922 0 0);
|
|
66
|
+
--ring: oklch(0.708 0 0);
|
|
67
|
+
--chart-1: oklch(0.646 0.222 41.116);
|
|
68
|
+
--chart-2: oklch(0.6 0.118 184.704);
|
|
69
|
+
--chart-3: oklch(0.398 0.07 227.392);
|
|
70
|
+
--chart-4: oklch(0.828 0.189 84.429);
|
|
71
|
+
--chart-5: oklch(0.769 0.188 70.08);
|
|
72
|
+
--sidebar: oklch(0.985 0 0);
|
|
73
|
+
--sidebar-foreground: oklch(0.145 0 0);
|
|
74
|
+
--sidebar-primary: oklch(0.205 0 0);
|
|
75
|
+
--sidebar-primary-foreground: oklch(0.985 0 0);
|
|
76
|
+
--sidebar-accent: oklch(0.97 0 0);
|
|
77
|
+
--sidebar-accent-foreground: oklch(0.205 0 0);
|
|
78
|
+
--sidebar-border: oklch(0.922 0 0);
|
|
79
|
+
--sidebar-ring: oklch(0.708 0 0);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.dark {
|
|
83
|
+
--background: oklch(0.145 0 0);
|
|
84
|
+
--foreground: oklch(0.985 0 0);
|
|
85
|
+
--card: oklch(0.205 0 0);
|
|
86
|
+
--card-foreground: oklch(0.985 0 0);
|
|
87
|
+
--popover: oklch(0.205 0 0);
|
|
88
|
+
--popover-foreground: oklch(0.985 0 0);
|
|
89
|
+
--primary: oklch(0.922 0 0);
|
|
90
|
+
--primary-foreground: oklch(0.205 0 0);
|
|
91
|
+
--secondary: oklch(0.269 0 0);
|
|
92
|
+
--secondary-foreground: oklch(0.985 0 0);
|
|
93
|
+
--muted: oklch(0.269 0 0);
|
|
94
|
+
--muted-foreground: oklch(0.708 0 0);
|
|
95
|
+
--accent: oklch(0.269 0 0);
|
|
96
|
+
--accent-foreground: oklch(0.985 0 0);
|
|
97
|
+
--destructive: oklch(0.704 0.191 22.216);
|
|
98
|
+
--border: oklch(1 0 0 / 10%);
|
|
99
|
+
--input: oklch(1 0 0 / 15%);
|
|
100
|
+
--ring: oklch(0.556 0 0);
|
|
101
|
+
--chart-1: oklch(0.488 0.243 264.376);
|
|
102
|
+
--chart-2: oklch(0.696 0.17 162.48);
|
|
103
|
+
--chart-3: oklch(0.769 0.188 70.08);
|
|
104
|
+
--chart-4: oklch(0.627 0.265 303.9);
|
|
105
|
+
--chart-5: oklch(0.645 0.246 16.439);
|
|
106
|
+
--sidebar: oklch(0.205 0 0);
|
|
107
|
+
--sidebar-foreground: oklch(0.985 0 0);
|
|
108
|
+
--sidebar-primary: oklch(0.488 0.243 264.376);
|
|
109
|
+
--sidebar-primary-foreground: oklch(0.985 0 0);
|
|
110
|
+
--sidebar-accent: oklch(0.269 0 0);
|
|
111
|
+
--sidebar-accent-foreground: oklch(0.985 0 0);
|
|
112
|
+
--sidebar-border: oklch(1 0 0 / 10%);
|
|
113
|
+
--sidebar-ring: oklch(0.556 0 0);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
@layer base {
|
|
117
|
+
* {
|
|
118
|
+
@apply border-border outline-ring/50;
|
|
119
|
+
}
|
|
120
|
+
body {
|
|
121
|
+
@apply bg-background text-foreground;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import { Slot } from "@radix-ui/react-slot"
|
|
3
|
+
import { cva, type VariantProps } from "class-variance-authority"
|
|
4
|
+
|
|
5
|
+
import { cn } from "@/lib/utils"
|
|
6
|
+
|
|
7
|
+
const buttonVariants = cva(
|
|
8
|
+
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
|
9
|
+
{
|
|
10
|
+
variants: {
|
|
11
|
+
variant: {
|
|
12
|
+
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
13
|
+
destructive:
|
|
14
|
+
"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
|
|
15
|
+
outline:
|
|
16
|
+
"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",
|
|
17
|
+
secondary:
|
|
18
|
+
"bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
19
|
+
ghost:
|
|
20
|
+
"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
|
|
21
|
+
link: "text-primary underline-offset-4 hover:underline",
|
|
22
|
+
},
|
|
23
|
+
size: {
|
|
24
|
+
default: "h-9 px-4 py-2 has-[>svg]:px-3",
|
|
25
|
+
sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
|
|
26
|
+
lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
|
|
27
|
+
icon: "size-9",
|
|
28
|
+
"icon-sm": "size-8",
|
|
29
|
+
"icon-lg": "size-10",
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
defaultVariants: {
|
|
33
|
+
variant: "default",
|
|
34
|
+
size: "default",
|
|
35
|
+
},
|
|
36
|
+
}
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
function Button({
|
|
40
|
+
className,
|
|
41
|
+
variant = "default",
|
|
42
|
+
size = "default",
|
|
43
|
+
asChild = false,
|
|
44
|
+
...props
|
|
45
|
+
}: React.ComponentProps<"button"> &
|
|
46
|
+
VariantProps<typeof buttonVariants> & {
|
|
47
|
+
asChild?: boolean
|
|
48
|
+
}) {
|
|
49
|
+
const Comp = asChild ? Slot : "button"
|
|
50
|
+
|
|
51
|
+
return (
|
|
52
|
+
<Comp
|
|
53
|
+
data-slot="button"
|
|
54
|
+
data-variant={variant}
|
|
55
|
+
data-size={size}
|
|
56
|
+
className={cn(buttonVariants({ variant, size, className }))}
|
|
57
|
+
{...props}
|
|
58
|
+
/>
|
|
59
|
+
)
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export { Button, buttonVariants }
|