pejay-ui 1.3.2 → 1.3.4
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 +44 -132
- package/package.json +1 -1
- package/templates/notes/analysis_results.md +107 -0
- package/templates/scripts/setup.bat +92 -49
- package/templates/scripts/setup.ps1 +74 -52
package/README.md
CHANGED
|
@@ -1,165 +1,77 @@
|
|
|
1
|
-
# pejay-ui
|
|
1
|
+
# pejay-ui
|
|
2
2
|
|
|
3
3
|
A lightweight CLI tool to initialize, add, and remove React UI components in your projects.
|
|
4
4
|
|
|
5
|
-
## Commands
|
|
5
|
+
## Core Commands
|
|
6
6
|
|
|
7
7
|
### 1. Initialize Configuration
|
|
8
|
-
Initialize the configuration file `pejay-ui.json` in the root of your project.
|
|
9
8
|
```bash
|
|
10
9
|
npx pejay-ui init
|
|
11
10
|
```
|
|
12
11
|
|
|
13
12
|
### 2. Add Component
|
|
14
|
-
Download and install a component, automatically setting up its utilities (like `cn`) and resolving component-to-component dependencies.
|
|
15
13
|
```bash
|
|
16
14
|
npx pejay-ui add <component-name>
|
|
17
15
|
```
|
|
18
|
-
*Example:* `npx pejay-ui add button` or `npx pejay-ui add form/date-picker`
|
|
19
16
|
|
|
20
17
|
### 3. Remove Component
|
|
21
|
-
Safely delete a component's files, and clean up any unused utilities or package dependencies that were installed with it.
|
|
22
18
|
```bash
|
|
23
19
|
npx pejay-ui remove <component-name>
|
|
24
20
|
```
|
|
25
|
-
*Example:* `npx pejay-ui remove button`
|
|
26
21
|
|
|
27
22
|
---
|
|
28
23
|
|
|
29
|
-
## Available Components
|
|
30
|
-
|
|
31
|
-
Below is the list of components you can add. Each has a copyable command block with a working native copy button on GitHub and NPM:
|
|
24
|
+
## Available Components & Scaffolds
|
|
32
25
|
|
|
33
26
|
### Buttons
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
npx pejay-ui add button
|
|
38
|
-
```
|
|
27
|
+
```bash
|
|
28
|
+
npx pejay-ui add button
|
|
29
|
+
```
|
|
39
30
|
|
|
40
31
|
### Form Inputs
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
* **`form/email-input`**: Dedicated input for email addresses with prefix icon.
|
|
59
|
-
```bash
|
|
60
|
-
npx pejay-ui add form/email-input
|
|
61
|
-
```
|
|
62
|
-
* **`form/file-input`**: Premium dropzone-style file upload component supporting drag-and-drop and progress/preview states.
|
|
63
|
-
```bash
|
|
64
|
-
npx pejay-ui add form/file-input
|
|
65
|
-
```
|
|
66
|
-
* **`form/number-input`**: Input field for numerical values with increment/decrement steppers.
|
|
67
|
-
```bash
|
|
68
|
-
npx pejay-ui add form/number-input
|
|
69
|
-
```
|
|
70
|
-
* **`form/password-input`**: Secure text input with eye icon toggle to show/hide the password.
|
|
71
|
-
```bash
|
|
72
|
-
npx pejay-ui add form/password-input
|
|
73
|
-
```
|
|
74
|
-
* **`form/phone-input`**: Formatted input field for telephone numbers.
|
|
75
|
-
```bash
|
|
76
|
-
npx pejay-ui add form/phone-input
|
|
77
|
-
```
|
|
78
|
-
* **`form/radio`**: Styled radio selection dot.
|
|
79
|
-
```bash
|
|
80
|
-
npx pejay-ui add form/radio
|
|
81
|
-
```
|
|
82
|
-
* **`form/radio-group`**: Group of mutually exclusive radio options.
|
|
83
|
-
```bash
|
|
84
|
-
npx pejay-ui add form/radio-group
|
|
85
|
-
```
|
|
86
|
-
* **`form/range-slider`**: Slider controls for choosing values from a numeric range.
|
|
87
|
-
```bash
|
|
88
|
-
npx pejay-ui add form/range-slider
|
|
89
|
-
```
|
|
90
|
-
* **`form/switch`**: Styled toggle switch representing boolean options.
|
|
91
|
-
```bash
|
|
92
|
-
npx pejay-ui add form/switch
|
|
93
|
-
```
|
|
94
|
-
* **`form/textarea`**: Multiline text area input with character counter/limit indicators.
|
|
95
|
-
```bash
|
|
96
|
-
npx pejay-ui add form/textarea
|
|
97
|
-
```
|
|
98
|
-
* **`form/url-input`**: Styled input field specifically formatted for web addresses/links.
|
|
99
|
-
```bash
|
|
100
|
-
npx pejay-ui add form/url-input
|
|
101
|
-
```
|
|
32
|
+
```bash
|
|
33
|
+
npx pejay-ui add form/input
|
|
34
|
+
npx pejay-ui add form/amount-input
|
|
35
|
+
npx pejay-ui add form/checkbox
|
|
36
|
+
npx pejay-ui add form/checkbox-group
|
|
37
|
+
npx pejay-ui add form/email-input
|
|
38
|
+
npx pejay-ui add form/file-input
|
|
39
|
+
npx pejay-ui add form/number-input
|
|
40
|
+
npx pejay-ui add form/password-input
|
|
41
|
+
npx pejay-ui add form/phone-input
|
|
42
|
+
npx pejay-ui add form/radio
|
|
43
|
+
npx pejay-ui add form/radio-group
|
|
44
|
+
npx pejay-ui add form/range-slider
|
|
45
|
+
npx pejay-ui add form/switch
|
|
46
|
+
npx pejay-ui add form/textarea
|
|
47
|
+
npx pejay-ui add form/url-input
|
|
48
|
+
```
|
|
102
49
|
|
|
103
50
|
### Date & Time Pickers
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
```bash
|
|
111
|
-
npx pejay-ui add form/date-range-picker
|
|
112
|
-
```
|
|
113
|
-
* **`form/time-picker`**: Dropdown component for picking specific hours, minutes, and AM/PM.
|
|
114
|
-
```bash
|
|
115
|
-
npx pejay-ui add form/time-picker
|
|
116
|
-
```
|
|
117
|
-
* **`form/time-range-picker`**: Popover time selector for configuring custom duration intervals.
|
|
118
|
-
```bash
|
|
119
|
-
npx pejay-ui add form/time-range-picker
|
|
120
|
-
```
|
|
51
|
+
```bash
|
|
52
|
+
npx pejay-ui add form/date-picker
|
|
53
|
+
npx pejay-ui add form/date-range-picker
|
|
54
|
+
npx pejay-ui add form/time-picker
|
|
55
|
+
npx pejay-ui add form/time-range-picker
|
|
56
|
+
```
|
|
121
57
|
|
|
122
58
|
### Dropdowns & Selects
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
```
|
|
128
|
-
* **`dropdown/multiselect-input`**: Searchable multiselect dropdown which renders selected options as dismissible tag pills.
|
|
129
|
-
```bash
|
|
130
|
-
npx pejay-ui add dropdown/multiselect-input
|
|
131
|
-
```
|
|
59
|
+
```bash
|
|
60
|
+
npx pejay-ui add dropdown/select-input
|
|
61
|
+
npx pejay-ui add dropdown/multiselect-input
|
|
62
|
+
```
|
|
132
63
|
|
|
133
64
|
### Layouts
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
npx pejay-ui add layouts/lv1
|
|
138
|
-
```
|
|
65
|
+
```bash
|
|
66
|
+
npx pejay-ui add layouts/lv1
|
|
67
|
+
```
|
|
139
68
|
|
|
140
69
|
### Scaffolds & Templates
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
```
|
|
150
|
-
* **`tanstack-router-client`**: TanStack Router setup with layouts, route guards, and file-based route stubs, copied into `src/tanstack-router/`.
|
|
151
|
-
```bash
|
|
152
|
-
npx pejay-ui add tanstack-router-client
|
|
153
|
-
```
|
|
154
|
-
* **`axios-client`**: Axios instance with interceptors, request helpers, and a sample API module, copied into `src/axios/`.
|
|
155
|
-
```bash
|
|
156
|
-
npx pejay-ui add axios-client
|
|
157
|
-
```
|
|
158
|
-
* **`redux-store-client`**: Redux Toolkit store setup with `redux-persist`, reducers, slices, and selectors, copied into `src/redux-store/`.
|
|
159
|
-
```bash
|
|
160
|
-
npx pejay-ui add redux-store-client
|
|
161
|
-
```
|
|
162
|
-
* **`rtk-query-client`**: RTK Query base API with `fetchBaseQuery`, tag management, middleware, and a sample endpoint, copied into `src/rtk-query/`.
|
|
163
|
-
```bash
|
|
164
|
-
npx pejay-ui add rtk-query-client
|
|
165
|
-
```
|
|
70
|
+
```bash
|
|
71
|
+
npx pejay-ui add tanstack-query-client
|
|
72
|
+
npx pejay-ui add react-router-client
|
|
73
|
+
npx pejay-ui add tanstack-router-client
|
|
74
|
+
npx pejay-ui add axios-client
|
|
75
|
+
npx pejay-ui add redux-store-client
|
|
76
|
+
npx pejay-ui add rtk-query-client
|
|
77
|
+
```
|
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!"
|