create-vite-redux 1.0.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 +98 -0
- package/index.js +169 -0
- package/package.json +30 -0
- package/templates/react-redux-tw/.env.example +1 -0
- package/templates/react-redux-tw/.prettierignore +2 -0
- package/templates/react-redux-tw/.prettierrc +8 -0
- package/templates/react-redux-tw/README.md +81 -0
- package/templates/react-redux-tw/_gitignore +31 -0
- package/templates/react-redux-tw/_package.json +49 -0
- package/templates/react-redux-tw/eslint.config.js +25 -0
- package/templates/react-redux-tw/index.html +13 -0
- package/templates/react-redux-tw/src/App.tsx +15 -0
- package/templates/react-redux-tw/src/components/layout/Footer.tsx +11 -0
- package/templates/react-redux-tw/src/components/layout/Header.tsx +16 -0
- package/templates/react-redux-tw/src/components/ui/button.tsx +54 -0
- package/templates/react-redux-tw/src/components/ui/card.tsx +73 -0
- package/templates/react-redux-tw/src/components/ui/dialog.tsx +118 -0
- package/templates/react-redux-tw/src/components/ui/form.tsx +138 -0
- package/templates/react-redux-tw/src/components/ui/input.tsx +18 -0
- package/templates/react-redux-tw/src/components/ui/label.tsx +18 -0
- package/templates/react-redux-tw/src/components/ui/sonner.tsx +19 -0
- package/templates/react-redux-tw/src/features/auth/LoginForm.tsx +92 -0
- package/templates/react-redux-tw/src/features/auth/authApi.ts +40 -0
- package/templates/react-redux-tw/src/features/auth/authSchema.ts +19 -0
- package/templates/react-redux-tw/src/features/auth/authSlice.ts +31 -0
- package/templates/react-redux-tw/src/features/counter/Counter.tsx +34 -0
- package/templates/react-redux-tw/src/features/counter/counterSlice.ts +32 -0
- package/templates/react-redux-tw/src/hooks/redux.ts +5 -0
- package/templates/react-redux-tw/src/index.css +123 -0
- package/templates/react-redux-tw/src/lib/utils.ts +6 -0
- package/templates/react-redux-tw/src/main.tsx +17 -0
- package/templates/react-redux-tw/src/router/index.tsx +26 -0
- package/templates/react-redux-tw/src/services/api.ts +10 -0
- package/templates/react-redux-tw/src/store/index.ts +16 -0
- package/templates/react-redux-tw/tsconfig.app.json +32 -0
- package/templates/react-redux-tw/tsconfig.json +7 -0
- package/templates/react-redux-tw/tsconfig.node.json +24 -0
- package/templates/react-redux-tw/vite.config.ts +17 -0
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
@import "tailwindcss";
|
|
2
|
+
@import "tw-animate-css";
|
|
3
|
+
|
|
4
|
+
@custom-variant dark (&:is(.dark *));
|
|
5
|
+
|
|
6
|
+
@theme inline {
|
|
7
|
+
--color-background: var(--background);
|
|
8
|
+
--color-foreground: var(--foreground);
|
|
9
|
+
--color-card: var(--card);
|
|
10
|
+
--color-card-foreground: var(--card-foreground);
|
|
11
|
+
--color-popover: var(--popover);
|
|
12
|
+
--color-popover-foreground: var(--popover-foreground);
|
|
13
|
+
--color-primary: var(--primary);
|
|
14
|
+
--color-primary-foreground: var(--primary-foreground);
|
|
15
|
+
--color-secondary: var(--secondary);
|
|
16
|
+
--color-secondary-foreground: var(--secondary-foreground);
|
|
17
|
+
--color-muted: var(--muted);
|
|
18
|
+
--color-muted-foreground: var(--muted-foreground);
|
|
19
|
+
--color-accent: var(--accent);
|
|
20
|
+
--color-accent-foreground: var(--accent-foreground);
|
|
21
|
+
--color-destructive: var(--destructive);
|
|
22
|
+
--color-destructive-foreground: var(--destructive-foreground);
|
|
23
|
+
--color-border: var(--border);
|
|
24
|
+
--color-input: var(--input);
|
|
25
|
+
--color-ring: var(--ring);
|
|
26
|
+
--color-chart-1: var(--chart-1);
|
|
27
|
+
--color-chart-2: var(--chart-2);
|
|
28
|
+
--color-chart-3: var(--chart-3);
|
|
29
|
+
--color-chart-4: var(--chart-4);
|
|
30
|
+
--color-chart-5: var(--chart-5);
|
|
31
|
+
--color-sidebar: var(--sidebar);
|
|
32
|
+
--color-sidebar-foreground: var(--sidebar-foreground);
|
|
33
|
+
--color-sidebar-primary: var(--sidebar-primary);
|
|
34
|
+
--color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
|
|
35
|
+
--color-sidebar-accent: var(--sidebar-accent);
|
|
36
|
+
--color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
|
|
37
|
+
--color-sidebar-border: var(--sidebar-border);
|
|
38
|
+
--color-sidebar-ring: var(--sidebar-ring);
|
|
39
|
+
--radius-sm: calc(var(--radius) - 4px);
|
|
40
|
+
--radius-md: calc(var(--radius) - 2px);
|
|
41
|
+
--radius-lg: var(--radius);
|
|
42
|
+
--radius-xl: calc(var(--radius) + 4px);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
:root {
|
|
46
|
+
--radius: 0.625rem;
|
|
47
|
+
--background: oklch(1 0 0);
|
|
48
|
+
--foreground: oklch(0.145 0 0);
|
|
49
|
+
--card: oklch(1 0 0);
|
|
50
|
+
--card-foreground: oklch(0.145 0 0);
|
|
51
|
+
--popover: oklch(1 0 0);
|
|
52
|
+
--popover-foreground: oklch(0.145 0 0);
|
|
53
|
+
--primary: oklch(0.205 0 0);
|
|
54
|
+
--primary-foreground: oklch(0.985 0 0);
|
|
55
|
+
--secondary: oklch(0.97 0 0);
|
|
56
|
+
--secondary-foreground: oklch(0.205 0 0);
|
|
57
|
+
--muted: oklch(0.97 0 0);
|
|
58
|
+
--muted-foreground: oklch(0.556 0 0);
|
|
59
|
+
--accent: oklch(0.97 0 0);
|
|
60
|
+
--accent-foreground: oklch(0.205 0 0);
|
|
61
|
+
--destructive: oklch(0.577 0.245 27.325);
|
|
62
|
+
--destructive-foreground: oklch(0.985 0 0);
|
|
63
|
+
--border: oklch(0.922 0 0);
|
|
64
|
+
--input: oklch(0.922 0 0);
|
|
65
|
+
--ring: oklch(0.708 0 0);
|
|
66
|
+
--chart-1: oklch(0.646 0.222 41.116);
|
|
67
|
+
--chart-2: oklch(0.6 0.118 184.704);
|
|
68
|
+
--chart-3: oklch(0.398 0.07 227.392);
|
|
69
|
+
--chart-4: oklch(0.828 0.189 84.429);
|
|
70
|
+
--chart-5: oklch(0.769 0.188 70.08);
|
|
71
|
+
--sidebar: oklch(0.985 0 0);
|
|
72
|
+
--sidebar-foreground: oklch(0.145 0 0);
|
|
73
|
+
--sidebar-primary: oklch(0.205 0 0);
|
|
74
|
+
--sidebar-primary-foreground: oklch(0.985 0 0);
|
|
75
|
+
--sidebar-accent: oklch(0.97 0 0);
|
|
76
|
+
--sidebar-accent-foreground: oklch(0.205 0 0);
|
|
77
|
+
--sidebar-border: oklch(0.922 0 0);
|
|
78
|
+
--sidebar-ring: oklch(0.708 0 0);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.dark {
|
|
82
|
+
--background: oklch(0.145 0 0);
|
|
83
|
+
--foreground: oklch(0.985 0 0);
|
|
84
|
+
--card: oklch(0.205 0 0);
|
|
85
|
+
--card-foreground: oklch(0.985 0 0);
|
|
86
|
+
--popover: oklch(0.205 0 0);
|
|
87
|
+
--popover-foreground: oklch(0.985 0 0);
|
|
88
|
+
--primary: oklch(0.922 0 0);
|
|
89
|
+
--primary-foreground: oklch(0.205 0 0);
|
|
90
|
+
--secondary: oklch(0.269 0 0);
|
|
91
|
+
--secondary-foreground: oklch(0.985 0 0);
|
|
92
|
+
--muted: oklch(0.269 0 0);
|
|
93
|
+
--muted-foreground: oklch(0.708 0 0);
|
|
94
|
+
--accent: oklch(0.269 0 0);
|
|
95
|
+
--accent-foreground: oklch(0.985 0 0);
|
|
96
|
+
--destructive: oklch(0.704 0.191 22.216);
|
|
97
|
+
--destructive-foreground: oklch(0.985 0 0);
|
|
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
|
+
* {
|
|
117
|
+
border-color: var(--border);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
body {
|
|
121
|
+
background-color: var(--background);
|
|
122
|
+
color: var(--foreground);
|
|
123
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { StrictMode } from 'react'
|
|
2
|
+
import { createRoot } from 'react-dom/client'
|
|
3
|
+
import { Provider } from 'react-redux'
|
|
4
|
+
import { RouterProvider } from 'react-router-dom'
|
|
5
|
+
import { store } from '@/store'
|
|
6
|
+
import { Toaster } from '@/components/ui/sonner'
|
|
7
|
+
import { router } from '@/router'
|
|
8
|
+
import './index.css'
|
|
9
|
+
|
|
10
|
+
createRoot(document.getElementById('root')!).render(
|
|
11
|
+
<StrictMode>
|
|
12
|
+
<Provider store={store}>
|
|
13
|
+
<RouterProvider router={router} />
|
|
14
|
+
<Toaster />
|
|
15
|
+
</Provider>
|
|
16
|
+
</StrictMode>
|
|
17
|
+
)
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { createBrowserRouter } from 'react-router-dom'
|
|
2
|
+
import App from '@/App'
|
|
3
|
+
import { Counter } from '@/features/counter/Counter'
|
|
4
|
+
|
|
5
|
+
export const router = createBrowserRouter([
|
|
6
|
+
{
|
|
7
|
+
path: '/',
|
|
8
|
+
element: <App />,
|
|
9
|
+
children: [
|
|
10
|
+
{
|
|
11
|
+
index: true,
|
|
12
|
+
element: (
|
|
13
|
+
<div className="flex flex-col items-center gap-8 text-center">
|
|
14
|
+
<div>
|
|
15
|
+
<h1 className="text-4xl font-bold tracking-tight">Welcome to {{PROJECT_NAME}}</h1>
|
|
16
|
+
<p className="mt-2 text-muted-foreground">
|
|
17
|
+
Edit <code className="font-mono text-sm bg-muted px-1.5 py-0.5 rounded">src/App.tsx</code> to get started.
|
|
18
|
+
</p>
|
|
19
|
+
</div>
|
|
20
|
+
<Counter />
|
|
21
|
+
</div>
|
|
22
|
+
),
|
|
23
|
+
},
|
|
24
|
+
],
|
|
25
|
+
},
|
|
26
|
+
])
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'
|
|
2
|
+
|
|
3
|
+
export const api = createApi({
|
|
4
|
+
reducerPath: 'api',
|
|
5
|
+
baseQuery: fetchBaseQuery({
|
|
6
|
+
baseUrl: import.meta.env.VITE_API_URL ?? '/api',
|
|
7
|
+
}),
|
|
8
|
+
tagTypes: [],
|
|
9
|
+
endpoints: () => ({}),
|
|
10
|
+
})
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { configureStore } from '@reduxjs/toolkit'
|
|
2
|
+
import { api } from '@/services/api'
|
|
3
|
+
import counterReducer from '@/features/counter/counterSlice'
|
|
4
|
+
import authReducer from '@/features/auth/authSlice'
|
|
5
|
+
|
|
6
|
+
export const store = configureStore({
|
|
7
|
+
reducer: {
|
|
8
|
+
[api.reducerPath]: api.reducer,
|
|
9
|
+
counter: counterReducer,
|
|
10
|
+
auth: authReducer,
|
|
11
|
+
},
|
|
12
|
+
middleware: (getDefaultMiddleware) => getDefaultMiddleware().concat(api.middleware),
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
export type RootState = ReturnType<typeof store.getState>
|
|
16
|
+
export type AppDispatch = typeof store.dispatch
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
|
|
4
|
+
"target": "ES2020",
|
|
5
|
+
"useDefineForClassFields": true,
|
|
6
|
+
"lib": ["ES2020", "DOM", "DOM.Iterable"],
|
|
7
|
+
"module": "ESNext",
|
|
8
|
+
"skipLibCheck": true,
|
|
9
|
+
|
|
10
|
+
/* Bundler mode */
|
|
11
|
+
"moduleResolution": "bundler",
|
|
12
|
+
"allowImportingTsExtensions": true,
|
|
13
|
+
"isolatedModules": true,
|
|
14
|
+
"moduleDetection": "force",
|
|
15
|
+
"noEmit": true,
|
|
16
|
+
"jsx": "react-jsx",
|
|
17
|
+
|
|
18
|
+
/* Path aliases */
|
|
19
|
+
"baseUrl": ".",
|
|
20
|
+
"paths": {
|
|
21
|
+
"@/*": ["./src/*"]
|
|
22
|
+
},
|
|
23
|
+
|
|
24
|
+
/* Linting */
|
|
25
|
+
"strict": true,
|
|
26
|
+
"noUnusedLocals": true,
|
|
27
|
+
"noUnusedParameters": true,
|
|
28
|
+
"noFallthroughCasesInSwitch": true,
|
|
29
|
+
"noUncheckedSideEffectImports": true
|
|
30
|
+
},
|
|
31
|
+
"include": ["src"]
|
|
32
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
|
|
4
|
+
"target": "ES2022",
|
|
5
|
+
"lib": ["ES2023"],
|
|
6
|
+
"module": "ESNext",
|
|
7
|
+
"skipLibCheck": true,
|
|
8
|
+
|
|
9
|
+
/* Bundler mode */
|
|
10
|
+
"moduleResolution": "bundler",
|
|
11
|
+
"allowImportingTsExtensions": true,
|
|
12
|
+
"isolatedModules": true,
|
|
13
|
+
"moduleDetection": "force",
|
|
14
|
+
"noEmit": true,
|
|
15
|
+
|
|
16
|
+
/* Linting */
|
|
17
|
+
"strict": true,
|
|
18
|
+
"noUnusedLocals": true,
|
|
19
|
+
"noUnusedParameters": true,
|
|
20
|
+
"noFallthroughCasesInSwitch": true,
|
|
21
|
+
"noUncheckedSideEffectImports": true
|
|
22
|
+
},
|
|
23
|
+
"include": ["vite.config.ts"]
|
|
24
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { defineConfig } from 'vite'
|
|
2
|
+
import react from '@vitejs/plugin-react'
|
|
3
|
+
import tailwindcss from '@tailwindcss/vite'
|
|
4
|
+
import path from 'path'
|
|
5
|
+
import { fileURLToPath } from 'url'
|
|
6
|
+
|
|
7
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
|
8
|
+
|
|
9
|
+
// https://vite.dev/config/
|
|
10
|
+
export default defineConfig({
|
|
11
|
+
plugins: [react(), tailwindcss()],
|
|
12
|
+
resolve: {
|
|
13
|
+
alias: {
|
|
14
|
+
'@': path.resolve(__dirname, './src'),
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
})
|