pejay-ui 1.3.2 โ 1.3.3
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/package.json
CHANGED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
# Codebase Scaffold Audit & Analysis
|
|
2
|
+
|
|
3
|
+
This document provides a comprehensive structural and architectural analysis of the scaffold templates in `pejay-ui` (`templates/scaffolds/`). All scaffolds are ready-to-use boilerplate templates designed to be easily injected into react-based projects using the CLI.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 1. Axios Scaffold (`axios-client`)
|
|
8
|
+
* **Target Directory**: `src/axios/`
|
|
9
|
+
* **Peer Dependencies**: `axios`
|
|
10
|
+
* **Files**:
|
|
11
|
+
* `index.ts`: Configures the base `axiosInstance` with a local port 5001 base URL and default configurations.
|
|
12
|
+
* `interceptors.ts`: Configures standard request and response interceptors.
|
|
13
|
+
* `request.ts`: Implements a type-safe wrapper over `axios` queries with customized `CustomAxiosRequestConfig` options (such as `skipErrorToast`).
|
|
14
|
+
* `endpoints.ts`: Declarative endpoint configurations helper (`createResourceEndpoints`).
|
|
15
|
+
* `api/one.api.ts` & `index.ts`: Implements API wrapper services mapping HTTP verbs (GET, POST, PUT, DELETE, and multipart/form-data POST) using endpoints.
|
|
16
|
+
|
|
17
|
+
### ๐ก Notable Architectural Design Patterns
|
|
18
|
+
* **Token Injection & Eject Pattern**: Setup function allows on-demand ejection of previous interceptors to prevent interceptor duplication when token state resets.
|
|
19
|
+
* **Multipart uploads**: Out-of-the-box helper configuration for `multipart/form-data` uploading.
|
|
20
|
+
* **Commented Best Practice Guides**: Includes detailed code comments discussing error handling strategies (global vs. screen-specific alerts like 400 Validation, 422 Forms, 409 Conflicts).
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## 2. React Router Scaffold (`react-router-client`)
|
|
25
|
+
* **Target Directory**: `src/react-router/`
|
|
26
|
+
* **Peer Dependencies**: `react-router-dom`
|
|
27
|
+
* **Files**:
|
|
28
|
+
* `router/index.ts`: Builds the route hierarchy using the modern object-based router syntax (`createBrowserRouter`).
|
|
29
|
+
* `router/path.ts`: Declares route path constants.
|
|
30
|
+
* `router/guards/private.route.tsx` & `public.route.tsx`: Authentication routing guards.
|
|
31
|
+
* `router/layouts/`: Base layout wrapper components (`auth.layout.tsx`, `error.layout.tsx`, `main.layout.tsx`).
|
|
32
|
+
* `routes/`: Subfolders representing each page boundary with lazy component imports.
|
|
33
|
+
* `hook/useRouterSearch.ts`: Utility hook for robust search parameter reading.
|
|
34
|
+
|
|
35
|
+
### ๐ก Notable Architectural Design Patterns
|
|
36
|
+
* **Route Guards without Paths**: Centralizes auth decisions using pathless routes (layout routes) that encapsulate authentication checks before child route components mount.
|
|
37
|
+
* **Target Restoration Pattern**: เคเคฎเฅเคเค-เคฆเคธเฅเคคเคพเคตเฅเค demonstrates how the private route guard passes `redirectTo` in query parameters, allowing the login flow to restore user navigation state seamlessly.
|
|
38
|
+
* **SEO & Static Prerendering (V7)**: Extensive documentation within route components illustrating route meta configurations and Nginx deployment configurations for serving pre-rendered static HTML structures.
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## 3. Redux Store Scaffold (`redux-store-client`)
|
|
43
|
+
* **Target Directory**: `src/redux-store/`
|
|
44
|
+
* **Peer Dependencies**: `@reduxjs/toolkit`, `react-redux`, `redux-persist`
|
|
45
|
+
* **Files**:
|
|
46
|
+
* `store.ts`: Configures store via `configureStore` with middleware handling to bypass serialization warnings for `redux-persist` actions.
|
|
47
|
+
* `reducers.ts`: Combines slices, setting up selective slice persistence configurations.
|
|
48
|
+
* `slices/`: Example RTK slices (`one.slice.ts` & `two.slice.ts`) containing state declarations, actions, and reducers.
|
|
49
|
+
* `selector/`: Selectors implementing memoized state reading.
|
|
50
|
+
|
|
51
|
+
### ๐ก Notable Architectural Design Patterns
|
|
52
|
+
* **Bypassing Redux-Persist Serialization Warnings**: Custom configureStore config overrides standard serialization check constraints to allow redux-persist lifecycle actions (`FLUSH`, `REHYDRATE`, etc.) without throwing warnings.
|
|
53
|
+
* **Slice-Level Persistence Configuration**: Configured to show developers how to selectively persist specific slices using `storageLocal` instead of forcing entire store persistence.
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## 4. RTK Query Scaffold (`rtk-query-client`)
|
|
58
|
+
* **Target Directory**: `src/rtk-query/`
|
|
59
|
+
* **Peer Dependencies**: `@reduxjs/toolkit`, `react-redux`
|
|
60
|
+
* **Files**:
|
|
61
|
+
* `baseApi.ts`: Initial API framework setup using `createApi` and injecting custom base queries.
|
|
62
|
+
* `baseQuery.ts`: Configures base query parameters.
|
|
63
|
+
* `queryTags.ts`: Declarative cache tag declarations.
|
|
64
|
+
* `middlewares.ts`: RTK query middleware definitions.
|
|
65
|
+
* `endpoints/`: Route query endpoint modules.
|
|
66
|
+
|
|
67
|
+
### ๐ก Notable Architectural Design Patterns
|
|
68
|
+
* **Centralized Cache Tag Management**: Centralizes tag types in a single array mapping configuration to prevent magic strings and cache invalidation issues.
|
|
69
|
+
* **Ready-to-Plug Store Middleware**: Clear documentation showing how to connect RTK Query's reducer and middleware inside the primary Redux root store.
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## 5. TanStack Query Scaffold (`tanstack-query-client`)
|
|
74
|
+
* **Target Directory**: `src/tanstack-query/`
|
|
75
|
+
* **Peer Dependencies**: `@tanstack/react-query`
|
|
76
|
+
* **Files**:
|
|
77
|
+
* `client.ts`: Configures a custom type-safe `apiClient` wrapper around the web fetch API.
|
|
78
|
+
* `api-base.ts`: Standard configuration settings.
|
|
79
|
+
* `api-queries.ts` / `api-mutations.ts`: API query hooks.
|
|
80
|
+
* `module/`: Modular services, mutations, queries, mappers, and cache keys configuration.
|
|
81
|
+
|
|
82
|
+
### ๐ก Notable Architectural Design Patterns
|
|
83
|
+
* **Type-Safe API Wrapper Client**: Provides custom `.get()`, `.post()`, `.put()`, `.patch()`, and `.delete()` wrappers on `fetch` with automated JSON serialization guards.
|
|
84
|
+
* **Separation of Concerns**: Structures files with clean mappers (decoupling API responses from UI representations) and query key factories (avoiding string typos).
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
## 6. TanStack Router Scaffold (`tanstack-router-client`)
|
|
89
|
+
* **Target Directory**: `src/tanstack-router/`
|
|
90
|
+
* **Peer Dependencies**: `@tanstack/react-router`
|
|
91
|
+
* **Files**:
|
|
92
|
+
* `router.ts`: Initializes Tanstack `createRouter` and configures defaults.
|
|
93
|
+
* `routes/`: File-based route trees (`__root.tsx`, `_app.tsx`, `_auth.tsx`).
|
|
94
|
+
* `layout/`: UI layouts (`app.layout.tsx`, `auth.layout.tsx`, etc.).
|
|
95
|
+
* `page/`: Visual target pages.
|
|
96
|
+
|
|
97
|
+
### ๐ก Notable Architectural Design Patterns
|
|
98
|
+
* **Intent-Based Preloading**: Uses `defaultPreload: "intent"` to preload route bundles and datasets immediately when a user hovers over a link, maximizing perceived UI responsiveness.
|
|
99
|
+
* **TypeScript Route Declaration Merging**: Employs TypeScript interface merging (`Register`) to ensure global route tree parameters are fully typed across the application.
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## ๐ ๏ธ Verification & Quality Assessment
|
|
104
|
+
|
|
105
|
+
* **Relative Imports**: All internal template files reference other module files using relative imports (`./` or `../`). They do not depend on absolute webpack/vite aliases (e.g. `@/`), making them immediately compatible with any folder structure they are copied into.
|
|
106
|
+
* **Code Cleanliness**: Types are cleanly defined, variables are appropriately scoped, and hooks clean up event listeners on unmount.
|
|
107
|
+
* **Documentation Quality**: Comments explain the architectural "Why" (e.g., Suspense vs Component Skeletons, SEO Nginx server setup) instead of just repeating what the code does. This is extremely helpful for developers installing these scaffolds.
|
|
@@ -29,21 +29,25 @@ echo.
|
|
|
29
29
|
|
|
30
30
|
set "packages="
|
|
31
31
|
|
|
32
|
-
call :ask "@reduxjs/toolkit"
|
|
33
32
|
call :ask "@tailwindcss/vite"
|
|
33
|
+
call :ask "tailwindcss"
|
|
34
|
+
call :ask "tailwind-merge"
|
|
34
35
|
call :ask "clsx"
|
|
35
|
-
call :ask "date-fns"
|
|
36
|
-
call :ask "dayjs"
|
|
37
|
-
call :ask "@floating-ui/react"
|
|
38
|
-
call :ask "lucide-react"
|
|
39
36
|
call :ask "react-hook-form"
|
|
40
|
-
call :ask "react-redux"
|
|
41
37
|
call :ask "react-router-dom"
|
|
42
|
-
call :ask "tailwind-merge"
|
|
43
|
-
call :ask "tailwindcss"
|
|
44
38
|
call :ask "@tanstack/react-query"
|
|
45
|
-
call :ask "
|
|
39
|
+
call :ask "@tanstack/react-router"
|
|
40
|
+
call :ask "@reduxjs/toolkit"
|
|
41
|
+
call :ask "react-redux"
|
|
42
|
+
call :ask "redux-persist"
|
|
43
|
+
call :ask "lucide-react"
|
|
44
|
+
call :ask "react-icons"
|
|
45
|
+
call :ask "axios"
|
|
46
46
|
call :ask "zustand"
|
|
47
|
+
call :ask "zod"
|
|
48
|
+
call :ask "@hookform/resolvers"
|
|
49
|
+
call :ask "@floating-ui/react"
|
|
50
|
+
call :ask "framer-motion"
|
|
47
51
|
|
|
48
52
|
if not "!packages!"=="" (
|
|
49
53
|
echo.
|
|
@@ -222,51 +226,90 @@ type nul > components\global\index.ts
|
|
|
222
226
|
mkdir hooks
|
|
223
227
|
type nul > hooks\index.ts
|
|
224
228
|
|
|
225
|
-
mkdir lib
|
|
226
|
-
type nul > lib\index.ts
|
|
227
|
-
|
|
228
|
-
mkdir routes
|
|
229
|
-
type nul > routes\index.ts
|
|
230
|
-
mkdir routes\dashboard
|
|
231
|
-
type nul > routes\dashboard\index.ts
|
|
232
|
-
mkdir routes\dashboard\components
|
|
233
|
-
type nul > routes\dashboard\components\index.ts
|
|
234
|
-
mkdir routes\dashboard\hooks
|
|
235
|
-
type nul > routes\dashboard\hooks\index.ts
|
|
236
|
-
mkdir routes\auth
|
|
237
|
-
type nul > routes\auth\index.ts
|
|
238
|
-
mkdir routes\auth\components
|
|
239
|
-
type nul > routes\auth\components\index.ts
|
|
240
|
-
mkdir routes\auth\hooks
|
|
241
|
-
type nul > routes\auth\hooks\index.ts
|
|
242
|
-
|
|
243
|
-
mkdir router
|
|
244
|
-
mkdir router\guards
|
|
245
|
-
type nul > router\guards\guard.public.ts
|
|
246
|
-
type nul > router\guards\guard.private.ts
|
|
247
|
-
mkdir router\layout
|
|
248
|
-
type nul > router\layout\layout.public.ts
|
|
249
|
-
type nul > router\layout\layout.main.ts
|
|
250
|
-
type nul > router\layout\layout.auth.ts
|
|
251
|
-
type nul > router\index.ts
|
|
252
|
-
|
|
253
|
-
mkdir providers
|
|
254
|
-
type nul > providers\index.ts
|
|
255
|
-
type nul > providers\app.provider.ts
|
|
256
|
-
|
|
257
|
-
mkdir services
|
|
258
|
-
type nul > services\index.ts
|
|
259
|
-
mkdir services\dashboard
|
|
260
|
-
mkdir services\auth
|
|
261
|
-
|
|
262
|
-
mkdir store
|
|
263
|
-
type nul > store\index.ts
|
|
264
|
-
|
|
265
229
|
mkdir utils
|
|
266
230
|
type nul > utils\index.ts
|
|
267
231
|
|
|
268
232
|
cd ..
|
|
269
233
|
|
|
234
|
+
:: โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
235
|
+
:: pejay-ui initialization and scaffolding
|
|
236
|
+
:: โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
237
|
+
set "hasAxios="
|
|
238
|
+
set "hasTanstackQuery="
|
|
239
|
+
set "hasTanstackRouter="
|
|
240
|
+
set "hasReactRouter="
|
|
241
|
+
set "hasRedux="
|
|
242
|
+
set "hasPersist="
|
|
243
|
+
|
|
244
|
+
for %%p in (!packages!) do (
|
|
245
|
+
if "%%p"=="axios" set "hasAxios=1"
|
|
246
|
+
if "%%p"=="@tanstack/react-query" set "hasTanstackQuery=1"
|
|
247
|
+
if "%%p"=="@tanstack/react-router" set "hasTanstackRouter=1"
|
|
248
|
+
if "%%p"=="react-router-dom" set "hasReactRouter=1"
|
|
249
|
+
if "%%p"=="@reduxjs/toolkit" set "hasRedux=1"
|
|
250
|
+
if "%%p"=="react-redux" set "hasRedux=1"
|
|
251
|
+
if "%%p"=="redux-persist" set "hasPersist=1"
|
|
252
|
+
)
|
|
253
|
+
|
|
254
|
+
set "needsInit="
|
|
255
|
+
if defined hasAxios set "needsInit=1"
|
|
256
|
+
if defined hasTanstackQuery set "needsInit=1"
|
|
257
|
+
if defined hasTanstackRouter set "needsInit=1"
|
|
258
|
+
if defined hasReactRouter set "needsInit=1"
|
|
259
|
+
if defined hasRedux set "needsInit=1"
|
|
260
|
+
|
|
261
|
+
if defined needsInit (
|
|
262
|
+
echo.
|
|
263
|
+
echo Initializing pejay-ui...
|
|
264
|
+
call npx pejay-ui init
|
|
265
|
+
|
|
266
|
+
if defined hasAxios (
|
|
267
|
+
echo Adding axios-client...
|
|
268
|
+
call npx pejay-ui add axios-client
|
|
269
|
+
)
|
|
270
|
+
if defined hasTanstackQuery (
|
|
271
|
+
echo Adding tanstack-query-client...
|
|
272
|
+
call npx pejay-ui add tanstack-query-client
|
|
273
|
+
)
|
|
274
|
+
if defined hasTanstackRouter (
|
|
275
|
+
echo Adding tanstack-router-client...
|
|
276
|
+
call npx pejay-ui add tanstack-router-client
|
|
277
|
+
)
|
|
278
|
+
if defined hasReactRouter (
|
|
279
|
+
echo Adding react-router-client...
|
|
280
|
+
call npx pejay-ui add react-router-client
|
|
281
|
+
)
|
|
282
|
+
if defined hasRedux (
|
|
283
|
+
if defined hasPersist (
|
|
284
|
+
echo Adding redux-store-client...
|
|
285
|
+
call npx pejay-ui add redux-store-client
|
|
286
|
+
) else (
|
|
287
|
+
echo.
|
|
288
|
+
echo You selected Redux. Which template would you like to add?
|
|
289
|
+
echo [1] Redux Store (redux-store-client)
|
|
290
|
+
echo [2] RTK Query (rtk-query-client)
|
|
291
|
+
echo [3] Both
|
|
292
|
+
echo [4] None
|
|
293
|
+
set "reduxAns=1"
|
|
294
|
+
set /p "reduxAns=Enter choice (1-4, default 1): "
|
|
295
|
+
if "!reduxAns!"=="2" (
|
|
296
|
+
echo Adding rtk-query-client...
|
|
297
|
+
call npx pejay-ui add rtk-query-client
|
|
298
|
+
) else if "!reduxAns!"=="3" (
|
|
299
|
+
echo Adding redux-store-client...
|
|
300
|
+
call npx pejay-ui add redux-store-client
|
|
301
|
+
echo Adding rtk-query-client...
|
|
302
|
+
call npx pejay-ui add rtk-query-client
|
|
303
|
+
) else if "!reduxAns!"=="4" (
|
|
304
|
+
rem Do nothing
|
|
305
|
+
) else (
|
|
306
|
+
echo Adding redux-store-client...
|
|
307
|
+
call npx pejay-ui add redux-store-client
|
|
308
|
+
)
|
|
309
|
+
)
|
|
310
|
+
)
|
|
311
|
+
)
|
|
312
|
+
|
|
270
313
|
echo.
|
|
271
314
|
echo Project '%projectName%' setup complete!
|
|
272
315
|
endlocal
|
|
@@ -63,28 +63,33 @@ Write-Output "Installing dependencies"
|
|
|
63
63
|
|
|
64
64
|
|
|
65
65
|
$availablePackages = @(
|
|
66
|
-
"@reduxjs/toolkit",
|
|
67
66
|
"@tailwindcss/vite",
|
|
67
|
+
"tailwindcss",
|
|
68
|
+
"tailwind-merge",
|
|
68
69
|
"clsx",
|
|
69
|
-
"
|
|
70
|
-
"dayjs",
|
|
71
|
-
"floating-ui",
|
|
72
|
-
"lucide-react",
|
|
73
|
-
"react-form-hook",
|
|
74
|
-
"react-redux",
|
|
70
|
+
"react-hook-form",
|
|
75
71
|
"react-router-dom",
|
|
76
|
-
"
|
|
77
|
-
"
|
|
78
|
-
"
|
|
72
|
+
"@tanstack/react-query",
|
|
73
|
+
"@tanstack/react-router",
|
|
74
|
+
"@reduxjs/toolkit",
|
|
75
|
+
"react-redux",
|
|
76
|
+
"redux-persist",
|
|
77
|
+
"lucide-react",
|
|
78
|
+
"react-icons",
|
|
79
|
+
"axios",
|
|
80
|
+
"zustand",
|
|
79
81
|
"zod",
|
|
80
|
-
"
|
|
82
|
+
"@hookform/resolvers",
|
|
83
|
+
"@floating-ui/react",
|
|
84
|
+
"framer-motion"
|
|
81
85
|
)
|
|
82
86
|
|
|
83
87
|
$selectedPackages = Show-MultiSelect -Options $availablePackages -Title "Select packages to install (SPACE to toggle, ENTER to confirm):"
|
|
84
88
|
|
|
85
89
|
if ($selectedPackages.Count -gt 0) {
|
|
86
90
|
npm install
|
|
87
|
-
|
|
91
|
+
$packageString = $selectedPackages -join " "
|
|
92
|
+
Invoke-Expression "npm install $packageString"
|
|
88
93
|
} else {
|
|
89
94
|
Write-Output "No packages selected, skipping..."
|
|
90
95
|
}
|
|
@@ -270,49 +275,66 @@ Set-Content "components/global/index.ts" ""
|
|
|
270
275
|
mkdir hooks
|
|
271
276
|
Set-Content "hooks/index.ts" ""
|
|
272
277
|
|
|
273
|
-
mkdir lib
|
|
274
|
-
Set-Content "lib/index.ts" ""
|
|
275
|
-
|
|
276
|
-
mkdir routes
|
|
277
|
-
Set-Content "routes/index.ts" ""
|
|
278
|
-
mkdir routes/dashboard
|
|
279
|
-
Set-Content "routes/dashboard/index.ts" ""
|
|
280
|
-
mkdir routes/dashboard/components
|
|
281
|
-
Set-Content "routes/dashboard/components/index.ts" ""
|
|
282
|
-
mkdir routes/dashboard/hooks
|
|
283
|
-
Set-Content "routes/dashboard/hooks/index.ts" ""
|
|
284
|
-
mkdir routes/auth
|
|
285
|
-
Set-Content "routes/auth/index.ts" ""
|
|
286
|
-
mkdir routes/auth/components
|
|
287
|
-
Set-Content "routes/auth/components/index.ts" ""
|
|
288
|
-
mkdir routes/auth/hooks
|
|
289
|
-
Set-Content "routes/auth/hooks/index.ts" ""
|
|
290
|
-
|
|
291
|
-
mkdir router
|
|
292
|
-
mkdir router/guards
|
|
293
|
-
Set-Content "router/guards/guard.public.ts" ""
|
|
294
|
-
Set-Content "router/guards/guard.private.ts" ""
|
|
295
|
-
mkdir router/layout
|
|
296
|
-
Set-Content "router/layout/layout.public.ts" ""
|
|
297
|
-
Set-Content "router/layout/layout.main.ts" ""
|
|
298
|
-
Set-Content "router/layout/layout.auth.ts" ""
|
|
299
|
-
Set-Content "router/index.ts" ""
|
|
300
|
-
|
|
301
|
-
mkdir providers
|
|
302
|
-
Set-Content "providers/index.ts" ""
|
|
303
|
-
Set-Content "providers/app.provider.ts" ""
|
|
304
|
-
|
|
305
|
-
mkdir services
|
|
306
|
-
Set-Content "services/index.ts" ""
|
|
307
|
-
mkdir services/dashboard
|
|
308
|
-
mkdir services/auth
|
|
309
|
-
|
|
310
|
-
mkdir store
|
|
311
|
-
Set-Content "store/index.ts" ""
|
|
312
|
-
|
|
313
278
|
mkdir utils
|
|
314
279
|
Set-Content "utils/index.ts" ""
|
|
315
280
|
|
|
316
281
|
Set-Location ..
|
|
317
282
|
|
|
283
|
+
# โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
284
|
+
# pejay-ui initialization and scaffolding
|
|
285
|
+
# โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
286
|
+
$needsInit = $false
|
|
287
|
+
$templatesToAdd = @()
|
|
288
|
+
|
|
289
|
+
if ($selectedPackages -contains "axios") {
|
|
290
|
+
$needsInit = $true
|
|
291
|
+
$templatesToAdd += "axios-client"
|
|
292
|
+
}
|
|
293
|
+
if ($selectedPackages -contains "@tanstack/react-query") {
|
|
294
|
+
$needsInit = $true
|
|
295
|
+
$templatesToAdd += "tanstack-query-client"
|
|
296
|
+
}
|
|
297
|
+
if ($selectedPackages -contains "@tanstack/react-router") {
|
|
298
|
+
$needsInit = $true
|
|
299
|
+
$templatesToAdd += "tanstack-router-client"
|
|
300
|
+
}
|
|
301
|
+
if ($selectedPackages -contains "react-router-dom") {
|
|
302
|
+
$needsInit = $true
|
|
303
|
+
$templatesToAdd += "react-router-client"
|
|
304
|
+
}
|
|
305
|
+
if ($selectedPackages -contains "@reduxjs/toolkit" -or $selectedPackages -contains "react-redux") {
|
|
306
|
+
$needsInit = $true
|
|
307
|
+
if ($selectedPackages -contains "redux-persist") {
|
|
308
|
+
$templatesToAdd += "redux-store-client"
|
|
309
|
+
} else {
|
|
310
|
+
Write-Output ""
|
|
311
|
+
Write-Output "You selected Redux. Which template would you like to add?"
|
|
312
|
+
Write-Output "1) Redux Store (redux-store-client)"
|
|
313
|
+
Write-Output "2) RTK Query (rtk-query-client)"
|
|
314
|
+
Write-Output "3) Both"
|
|
315
|
+
Write-Output "4) None"
|
|
316
|
+
$reduxChoice = Read-Host "Select option (1-4, default 1)"
|
|
317
|
+
if ($reduxChoice -eq "2") {
|
|
318
|
+
$templatesToAdd += "rtk-query-client"
|
|
319
|
+
} elseif ($reduxChoice -eq "3") {
|
|
320
|
+
$templatesToAdd += "redux-store-client"
|
|
321
|
+
$templatesToAdd += "rtk-query-client"
|
|
322
|
+
} elseif ($reduxChoice -eq "4") {
|
|
323
|
+
# None
|
|
324
|
+
} else {
|
|
325
|
+
$templatesToAdd += "redux-store-client"
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
if ($needsInit) {
|
|
331
|
+
Write-Output "`nInitializing pejay-ui..."
|
|
332
|
+
npx pejay-ui init
|
|
333
|
+
|
|
334
|
+
foreach ($template in $templatesToAdd) {
|
|
335
|
+
Write-Output "Adding template: $template..."
|
|
336
|
+
npx pejay-ui add $template
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
|
|
318
340
|
Write-Output "โ
Project '$projectName' setup complete!"
|