pejay-ui 1.2.2 → 1.3.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/package.json +1 -1
- package/registry.json +33 -1
- package/templates/notes/create-pejay.md +222 -0
- package/templates/notes/notes-v1.md +516 -0
- package/templates/notes/notes-v2.md +764 -0
- package/templates/notes/notes-v3.md +574 -0
- package/templates/notes/notes-v4.md +811 -0
- package/templates/notes/notes-v5.md +579 -0
- package/templates/notes/notes-vf+1.md +311 -0
- package/templates/notes/notes-vfinal.md +852 -0
- package/templates/scaffolds/axios/api/index.ts +40 -0
- package/templates/scaffolds/axios/api/one.api.ts +94 -0
- package/templates/scaffolds/axios/endpoints.ts +9 -0
- package/templates/scaffolds/axios/index.ts +26 -0
- package/templates/scaffolds/axios/interceptors.ts +103 -0
- package/templates/scaffolds/axios/request.ts +32 -0
- package/templates/scaffolds/react-router/hook/useRouterSearch.ts +8 -0
- package/templates/scaffolds/react-router/router/guards/private.route.tsx +1 -0
- package/templates/scaffolds/react-router/router/index.ts +26 -0
- package/templates/scaffolds/react-router/router/layouts/error.layout.tsx +1 -1
- package/templates/scaffolds/redux-store/middlewares.ts +0 -0
- package/templates/scaffolds/redux-store/reducers.ts +30 -0
- package/templates/scaffolds/redux-store/selector/one.selector.ts +43 -0
- package/templates/scaffolds/redux-store/selector/two.selector.ts +11 -0
- package/templates/scaffolds/redux-store/slices/one.slice.ts +202 -0
- package/templates/scaffolds/redux-store/slices/two.slice.ts +21 -0
- package/templates/scaffolds/redux-store/store.ts +38 -0
- package/templates/scaffolds/rtk-query/baseApi.ts +24 -0
- package/templates/scaffolds/rtk-query/baseQuery.ts +12 -0
- package/templates/scaffolds/rtk-query/endpoints/api.one.ts +82 -0
- package/templates/scaffolds/rtk-query/endpoints/index.ts +1 -0
- package/templates/scaffolds/rtk-query/middlewares.ts +11 -0
- package/templates/scaffolds/rtk-query/queryTags.ts +13 -0
- package/templates/scaffolds/tanstack-query/api-base.ts +68 -68
- package/templates/scaffolds/tanstack-query/api-queries.ts +0 -19
- package/templates/scaffolds/tanstack-query/client.ts +8 -0
- package/templates/scaffolds/tanstack-query/module/index.ts +12 -12
- package/templates/scaffolds/tanstack-query/module/keys.ts +17 -17
- package/templates/scaffolds/tanstack-query/module/mappers.ts +15 -15
- package/templates/scaffolds/tanstack-query/module/mutations.ts +59 -55
- package/templates/scaffolds/tanstack-query/module/queries.ts +145 -156
- package/templates/scaffolds/tanstack-query/module/services.ts +74 -66
- package/templates/scaffolds/tanstack-router/layout/404.layout.tsx +3 -0
- package/templates/scaffolds/tanstack-router/layout/app.layout.tsx +10 -0
- package/templates/scaffolds/tanstack-router/layout/auth.layout.tsx +10 -0
- package/templates/scaffolds/tanstack-router/layout/error.layout.tsx +3 -0
- package/templates/scaffolds/tanstack-router/page/auth/login.tsx +3 -0
- package/templates/scaffolds/tanstack-router/page/one/index.tsx +3 -0
- package/templates/scaffolds/tanstack-router/page/one/one-id.tsx +128 -0
- package/templates/scaffolds/tanstack-router/router.ts +90 -0
- package/templates/scaffolds/tanstack-router/routes/_404.tsx +0 -0
- package/templates/scaffolds/tanstack-router/routes/__root.tsx +9 -0
- package/templates/scaffolds/tanstack-router/routes/_app.tsx +6 -0
- package/templates/scaffolds/tanstack-router/routes/_auth.tsx +6 -0
- package/templates/scaffolds/tanstack-router/routes/_error.tsx +0 -0
- package/templates/scaffolds/tanstack-router/routes/auth/login.tsx +6 -0
- package/templates/scaffolds/tanstack-router/routes/one/$id.tsx +191 -0
- package/templates/scaffolds/tanstack-router/routes/one/index.tsx +6 -0
- package/templates/scripts/setup.bat +284 -0
- package/templates/scripts/setup.ps1 +318 -0
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
@echo off
|
|
2
|
+
setlocal enabledelayedexpansion
|
|
3
|
+
|
|
4
|
+
:: ─────────────────────────────────────────
|
|
5
|
+
:: Project name
|
|
6
|
+
:: ─────────────────────────────────────────
|
|
7
|
+
set /p projectName="Enter project name: "
|
|
8
|
+
|
|
9
|
+
if exist "%projectName%" (
|
|
10
|
+
echo Project '%projectName%' already exists. Exiting.
|
|
11
|
+
exit /b 1
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
echo Initializing vite project '%projectName%'...
|
|
15
|
+
call npm create vite@latest %projectName% -- --template react-ts
|
|
16
|
+
if errorlevel 1 (
|
|
17
|
+
echo Failed to create vite project. Exiting.
|
|
18
|
+
exit /b 1
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
cd %projectName%
|
|
22
|
+
|
|
23
|
+
:: ─────────────────────────────────────────
|
|
24
|
+
:: Package selection (y/n per package)
|
|
25
|
+
:: ─────────────────────────────────────────
|
|
26
|
+
echo.
|
|
27
|
+
echo Select packages to install (y/n):
|
|
28
|
+
echo.
|
|
29
|
+
|
|
30
|
+
set "packages="
|
|
31
|
+
|
|
32
|
+
call :ask "@reduxjs/toolkit"
|
|
33
|
+
call :ask "@tailwindcss/vite"
|
|
34
|
+
call :ask "clsx"
|
|
35
|
+
call :ask "date-fns"
|
|
36
|
+
call :ask "dayjs"
|
|
37
|
+
call :ask "@floating-ui/react"
|
|
38
|
+
call :ask "lucide-react"
|
|
39
|
+
call :ask "react-hook-form"
|
|
40
|
+
call :ask "react-redux"
|
|
41
|
+
call :ask "react-router-dom"
|
|
42
|
+
call :ask "tailwind-merge"
|
|
43
|
+
call :ask "tailwindcss"
|
|
44
|
+
call :ask "@tanstack/react-query"
|
|
45
|
+
call :ask "zod"
|
|
46
|
+
call :ask "zustand"
|
|
47
|
+
|
|
48
|
+
if not "!packages!"=="" (
|
|
49
|
+
echo.
|
|
50
|
+
echo Installing base dependencies...
|
|
51
|
+
call npm install
|
|
52
|
+
echo Installing selected packages: !packages!
|
|
53
|
+
call npm install !packages!
|
|
54
|
+
) else (
|
|
55
|
+
echo No packages selected, skipping...
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
:: ─────────────────────────────────────────
|
|
59
|
+
:: Environment variables
|
|
60
|
+
:: ─────────────────────────────────────────
|
|
61
|
+
echo.
|
|
62
|
+
echo Creating environment variables...
|
|
63
|
+
|
|
64
|
+
type nul > .env
|
|
65
|
+
|
|
66
|
+
(
|
|
67
|
+
echo VITE_HOST=0.0.0.0
|
|
68
|
+
echo VITE_PORT=3030
|
|
69
|
+
echo #VITE_API_URL=
|
|
70
|
+
) > .env.development
|
|
71
|
+
|
|
72
|
+
(
|
|
73
|
+
echo VITE_HOST=0.0.0.0
|
|
74
|
+
echo VITE_PORT=3031
|
|
75
|
+
echo #VITE_API_URL=
|
|
76
|
+
) > .env.staging
|
|
77
|
+
|
|
78
|
+
(
|
|
79
|
+
echo VITE_HOST=0.0.0.0
|
|
80
|
+
echo VITE_PORT=3032
|
|
81
|
+
echo #VITE_API_URL=
|
|
82
|
+
) > .env.production
|
|
83
|
+
|
|
84
|
+
:: ─────────────────────────────────────────
|
|
85
|
+
:: Update package.json scripts via Node
|
|
86
|
+
:: ─────────────────────────────────────────
|
|
87
|
+
echo.
|
|
88
|
+
echo Updating scripts section in package.json...
|
|
89
|
+
|
|
90
|
+
node -e ^
|
|
91
|
+
"const fs = require('fs');" ^
|
|
92
|
+
"const pkg = JSON.parse(fs.readFileSync('package.json', 'utf8'));" ^
|
|
93
|
+
"pkg.scripts = { lint: 'eslint .', preview: 'vite preview', dev: 'vite', stage: 'vite --mode staging', build: 'vite build', 'build-stage': 'vite build --mode staging' };" ^
|
|
94
|
+
"fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2));"
|
|
95
|
+
|
|
96
|
+
:: ─────────────────────────────────────────
|
|
97
|
+
:: vite.config.ts
|
|
98
|
+
:: ─────────────────────────────────────────
|
|
99
|
+
echo.
|
|
100
|
+
echo Setting up vite config...
|
|
101
|
+
|
|
102
|
+
(
|
|
103
|
+
echo import { defineConfig, loadEnv } from 'vite';
|
|
104
|
+
echo import react from '@vitejs/plugin-react';
|
|
105
|
+
echo import tailwindcss from '@tailwindcss/vite';
|
|
106
|
+
echo import path from 'path';
|
|
107
|
+
echo.
|
|
108
|
+
echo export default defineConfig(({ mode }) =^> {
|
|
109
|
+
echo const env = loadEnv(mode, process.cwd(), ''^);
|
|
110
|
+
echo return {
|
|
111
|
+
echo plugins: [react(^), tailwindcss(^)],
|
|
112
|
+
echo resolve: {
|
|
113
|
+
echo alias: {
|
|
114
|
+
echo '@': path.resolve(__dirname, './src'^),
|
|
115
|
+
echo },
|
|
116
|
+
echo },
|
|
117
|
+
echo server: {
|
|
118
|
+
echo host: '0.0.0.0',
|
|
119
|
+
echo port: Number(env.VITE_PORT^),
|
|
120
|
+
echo },
|
|
121
|
+
echo };
|
|
122
|
+
echo }^);
|
|
123
|
+
) > vite.config.ts
|
|
124
|
+
|
|
125
|
+
:: ─────────────────────────────────────────
|
|
126
|
+
:: tsconfig.app.json
|
|
127
|
+
:: ─────────────────────────────────────────
|
|
128
|
+
echo.
|
|
129
|
+
echo Setting up tsconfig paths...
|
|
130
|
+
|
|
131
|
+
(
|
|
132
|
+
echo {
|
|
133
|
+
echo "compilerOptions": {
|
|
134
|
+
echo "baseUrl": ".",
|
|
135
|
+
echo "paths": { "@/*": ["src/*"] },
|
|
136
|
+
echo "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
|
|
137
|
+
echo "target": "es2023",
|
|
138
|
+
echo "lib": ["ES2023", "DOM"],
|
|
139
|
+
echo "module": "esnext",
|
|
140
|
+
echo "types": ["vite/client"],
|
|
141
|
+
echo "skipLibCheck": true,
|
|
142
|
+
echo "moduleResolution": "bundler",
|
|
143
|
+
echo "allowImportingTsExtensions": true,
|
|
144
|
+
echo "verbatimModuleSyntax": true,
|
|
145
|
+
echo "moduleDetection": "force",
|
|
146
|
+
echo "noEmit": true,
|
|
147
|
+
echo "jsx": "react-jsx",
|
|
148
|
+
echo "noUnusedLocals": true,
|
|
149
|
+
echo "noUnusedParameters": true,
|
|
150
|
+
echo "erasableSyntaxOnly": true,
|
|
151
|
+
echo "noFallthroughCasesInSwitch": true
|
|
152
|
+
echo },
|
|
153
|
+
echo "include": ["src"]
|
|
154
|
+
echo }
|
|
155
|
+
) > tsconfig.app.json
|
|
156
|
+
|
|
157
|
+
:: ─────────────────────────────────────────
|
|
158
|
+
:: tailwind.config.ts
|
|
159
|
+
:: ─────────────────────────────────────────
|
|
160
|
+
echo.
|
|
161
|
+
echo Setting up tailwind config...
|
|
162
|
+
|
|
163
|
+
(
|
|
164
|
+
echo /** @type {import('tailwindcss'^).Config} */
|
|
165
|
+
echo export default {
|
|
166
|
+
echo content: ['./index.html', './src/**/*.{js,ts,jsx,tsx}'],
|
|
167
|
+
echo theme: {
|
|
168
|
+
echo extend: {},
|
|
169
|
+
echo },
|
|
170
|
+
echo plugins: [],
|
|
171
|
+
echo };
|
|
172
|
+
) > tailwind.config.ts
|
|
173
|
+
|
|
174
|
+
:: ─────────────────────────────────────────
|
|
175
|
+
:: README + .gitignore
|
|
176
|
+
:: ─────────────────────────────────────────
|
|
177
|
+
echo.
|
|
178
|
+
echo Formatting README.md and .gitignore...
|
|
179
|
+
|
|
180
|
+
type nul > README.md
|
|
181
|
+
|
|
182
|
+
(
|
|
183
|
+
echo.
|
|
184
|
+
echo .env
|
|
185
|
+
echo .env.*
|
|
186
|
+
echo .sixth*
|
|
187
|
+
) >> .gitignore
|
|
188
|
+
|
|
189
|
+
:: ─────────────────────────────────────────
|
|
190
|
+
:: src directory structure
|
|
191
|
+
:: ─────────────────────────────────────────
|
|
192
|
+
echo.
|
|
193
|
+
echo Setting up src directory...
|
|
194
|
+
|
|
195
|
+
cd src
|
|
196
|
+
|
|
197
|
+
del /f /q App.css index.css 2>nul
|
|
198
|
+
|
|
199
|
+
(
|
|
200
|
+
echo import { createRoot } from 'react-dom/client';
|
|
201
|
+
echo import '../style/index.css';
|
|
202
|
+
echo import App from './App.tsx';
|
|
203
|
+
echo.
|
|
204
|
+
echo createRoot(document.getElementById('root'^)!^).render(^<App /^>^);
|
|
205
|
+
) > main.tsx
|
|
206
|
+
|
|
207
|
+
(
|
|
208
|
+
echo export default function App(^) {
|
|
209
|
+
echo return ^<^>app file loaded^<^/^>;
|
|
210
|
+
echo }
|
|
211
|
+
) > App.tsx
|
|
212
|
+
|
|
213
|
+
mkdir style
|
|
214
|
+
(echo @import "tailwindcss";) > style\index.css
|
|
215
|
+
|
|
216
|
+
mkdir components
|
|
217
|
+
mkdir components\base
|
|
218
|
+
type nul > components\base\index.ts
|
|
219
|
+
mkdir components\global
|
|
220
|
+
type nul > components\global\index.ts
|
|
221
|
+
|
|
222
|
+
mkdir hooks
|
|
223
|
+
type nul > hooks\index.ts
|
|
224
|
+
|
|
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
|
+
mkdir utils
|
|
266
|
+
type nul > utils\index.ts
|
|
267
|
+
|
|
268
|
+
cd ..
|
|
269
|
+
|
|
270
|
+
echo.
|
|
271
|
+
echo Project '%projectName%' setup complete!
|
|
272
|
+
endlocal
|
|
273
|
+
exit /b 0
|
|
274
|
+
|
|
275
|
+
:: ─────────────────────────────────────────
|
|
276
|
+
:: Helper: ask y/n for a package
|
|
277
|
+
:: ─────────────────────────────────────────
|
|
278
|
+
:ask
|
|
279
|
+
set "pkg=%~1"
|
|
280
|
+
set /p "ans= Install %pkg%? (y/n): "
|
|
281
|
+
if /i "!ans!"=="y" (
|
|
282
|
+
set "packages=!packages! %pkg%"
|
|
283
|
+
)
|
|
284
|
+
exit /b 0
|
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
$ErrorActionPreference = "Stop"
|
|
2
|
+
|
|
3
|
+
function Show-MultiSelect {
|
|
4
|
+
param([string[]]$Options, [string]$Title)
|
|
5
|
+
|
|
6
|
+
$selected = @($false) * $Options.Length
|
|
7
|
+
$cursor = 0
|
|
8
|
+
|
|
9
|
+
while ($true) {
|
|
10
|
+
Clear-Host
|
|
11
|
+
Write-Host $Title
|
|
12
|
+
|
|
13
|
+
for ($i = 0; $i -lt $Options.Length; $i++) {
|
|
14
|
+
$checkbox = if ($selected[$i]) { "[x]" } else { "[ ]" }
|
|
15
|
+
if ($i -eq $cursor) {
|
|
16
|
+
Write-Host " > $checkbox $($Options[$i])" -ForegroundColor Cyan
|
|
17
|
+
} else {
|
|
18
|
+
Write-Host " $checkbox $($Options[$i])"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
$key = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
|
|
23
|
+
|
|
24
|
+
switch ($key.VirtualKeyCode) {
|
|
25
|
+
38 { if ($cursor -gt 0) { $cursor-- } }
|
|
26
|
+
40 { if ($cursor -lt $Options.Length - 1) { $cursor++ } }
|
|
27
|
+
32 { $selected[$cursor] = !$selected[$cursor] }
|
|
28
|
+
13 {
|
|
29
|
+
$result = @()
|
|
30
|
+
for ($i = 0; $i -lt $Options.Length; $i++) {
|
|
31
|
+
if ($selected[$i]) { $result += $Options[$i] }
|
|
32
|
+
}
|
|
33
|
+
Clear-Host
|
|
34
|
+
return $result
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
# rest of your script below...
|
|
41
|
+
<#
|
|
42
|
+
The following command prompts for the project name
|
|
43
|
+
#>
|
|
44
|
+
|
|
45
|
+
Write-Output "Enter project name:"
|
|
46
|
+
$projectName = Read-Host
|
|
47
|
+
|
|
48
|
+
if (Test-Path $projectName) {
|
|
49
|
+
Write-Output "Project '$projectName' already exists. Exiting."
|
|
50
|
+
exit 1
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
Write-Output "Initializing vite project '$projectName' "
|
|
54
|
+
npm create vite@latest $projectName -- --template react-ts
|
|
55
|
+
|
|
56
|
+
Set-Location $projectName
|
|
57
|
+
|
|
58
|
+
<#
|
|
59
|
+
The following command installs all the required dependencies
|
|
60
|
+
#>
|
|
61
|
+
|
|
62
|
+
Write-Output "Installing dependencies"
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
$availablePackages = @(
|
|
66
|
+
"@reduxjs/toolkit",
|
|
67
|
+
"@tailwindcss/vite",
|
|
68
|
+
"clsx",
|
|
69
|
+
"date-fns",
|
|
70
|
+
"dayjs",
|
|
71
|
+
"floating-ui",
|
|
72
|
+
"lucide-react",
|
|
73
|
+
"react-form-hook",
|
|
74
|
+
"react-redux",
|
|
75
|
+
"react-router-dom",
|
|
76
|
+
"tailwind-merge",
|
|
77
|
+
"tailwindcss",
|
|
78
|
+
"tanstack-query",
|
|
79
|
+
"zod",
|
|
80
|
+
"zustand"
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
$selectedPackages = Show-MultiSelect -Options $availablePackages -Title "Select packages to install (SPACE to toggle, ENTER to confirm):"
|
|
84
|
+
|
|
85
|
+
if ($selectedPackages.Count -gt 0) {
|
|
86
|
+
npm install
|
|
87
|
+
npm install $selectedPackages
|
|
88
|
+
} else {
|
|
89
|
+
Write-Output "No packages selected, skipping..."
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
<#
|
|
93
|
+
The following command creates environment variables
|
|
94
|
+
#>
|
|
95
|
+
|
|
96
|
+
Write-Output "Creating environment variables"
|
|
97
|
+
Set-Content ".env" ""
|
|
98
|
+
|
|
99
|
+
Set-Content ".env.development" @"
|
|
100
|
+
VITE_HOST=0.0.0.0
|
|
101
|
+
VITE_PORT=3030
|
|
102
|
+
#VITE_API_URL=
|
|
103
|
+
"@
|
|
104
|
+
|
|
105
|
+
Set-Content ".env.staging" @"
|
|
106
|
+
VITE_HOST=0.0.0.0
|
|
107
|
+
VITE_PORT=3031
|
|
108
|
+
#VITE_API_URL=
|
|
109
|
+
"@
|
|
110
|
+
|
|
111
|
+
Set-Content ".env.production" @"
|
|
112
|
+
VITE_HOST=0.0.0.0
|
|
113
|
+
VITE_PORT=3032
|
|
114
|
+
#VITE_API_URL=
|
|
115
|
+
"@
|
|
116
|
+
|
|
117
|
+
<#
|
|
118
|
+
The following command updates the scripts section of package.json
|
|
119
|
+
#>
|
|
120
|
+
|
|
121
|
+
Write-Output "Updating scripts section"
|
|
122
|
+
$pkg = Get-Content "package.json" -Raw | ConvertFrom-Json
|
|
123
|
+
|
|
124
|
+
$pkg.scripts = [ordered]@{
|
|
125
|
+
lint = "eslint ."
|
|
126
|
+
preview = "vite preview"
|
|
127
|
+
dev = "vite"
|
|
128
|
+
stage = "vite --mode staging"
|
|
129
|
+
build = "vite build"
|
|
130
|
+
"build-stage" = "vite build --mode staging"
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
$pkg | ConvertTo-Json -Depth 10 | Set-Content "package.json"
|
|
134
|
+
|
|
135
|
+
<#
|
|
136
|
+
The following command sets up the vite config
|
|
137
|
+
#>
|
|
138
|
+
|
|
139
|
+
Write-Output "Setting up vite config"
|
|
140
|
+
Set-Content "vite.config.ts" @'
|
|
141
|
+
import { defineConfig, loadEnv } from 'vite';
|
|
142
|
+
import react from '@vitejs/plugin-react';
|
|
143
|
+
import tailwindcss from '@tailwindcss/vite';
|
|
144
|
+
import path from 'path';
|
|
145
|
+
|
|
146
|
+
export default defineConfig(({ mode }) => {
|
|
147
|
+
const env = loadEnv(mode, process.cwd(), '');
|
|
148
|
+
return {
|
|
149
|
+
plugins: [react(), tailwindcss()],
|
|
150
|
+
resolve: {
|
|
151
|
+
alias: {
|
|
152
|
+
'@': path.resolve(__dirname, './src'),
|
|
153
|
+
},
|
|
154
|
+
},
|
|
155
|
+
server: {
|
|
156
|
+
host: '0.0.0.0',
|
|
157
|
+
port: Number(env.VITE_PORT),
|
|
158
|
+
},
|
|
159
|
+
};
|
|
160
|
+
});
|
|
161
|
+
'@
|
|
162
|
+
|
|
163
|
+
<#
|
|
164
|
+
The following command sets up the tsconfig paths
|
|
165
|
+
#>
|
|
166
|
+
|
|
167
|
+
Write-Output "Setting up tsconfig paths"
|
|
168
|
+
Set-Content "tsconfig.app.json" @'
|
|
169
|
+
{
|
|
170
|
+
"compilerOptions": {
|
|
171
|
+
"baseUrl": ".",
|
|
172
|
+
"paths": {
|
|
173
|
+
"@/*": ["src/*"]
|
|
174
|
+
},
|
|
175
|
+
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
|
|
176
|
+
"target": "es2023",
|
|
177
|
+
"lib": ["ES2023", "DOM"],
|
|
178
|
+
"module": "esnext",
|
|
179
|
+
"types": ["vite/client"],
|
|
180
|
+
"skipLibCheck": true,
|
|
181
|
+
"moduleResolution": "bundler",
|
|
182
|
+
"allowImportingTsExtensions": true,
|
|
183
|
+
"verbatimModuleSyntax": true,
|
|
184
|
+
"moduleDetection": "force",
|
|
185
|
+
"noEmit": true,
|
|
186
|
+
"jsx": "react-jsx",
|
|
187
|
+
"noUnusedLocals": true,
|
|
188
|
+
"noUnusedParameters": true,
|
|
189
|
+
"erasableSyntaxOnly": true,
|
|
190
|
+
"noFallthroughCasesInSwitch": true
|
|
191
|
+
},
|
|
192
|
+
"include": ["src"]
|
|
193
|
+
}
|
|
194
|
+
'@
|
|
195
|
+
|
|
196
|
+
<#
|
|
197
|
+
The following command sets up the tailwind config
|
|
198
|
+
#>
|
|
199
|
+
|
|
200
|
+
Write-Output "Setting up tailwind config"
|
|
201
|
+
Set-Content "tailwind.config.ts" @'
|
|
202
|
+
/** @type {import('tailwindcss').Config} */
|
|
203
|
+
export default {
|
|
204
|
+
content: ['./index.html', './src/**/*.{js,ts,jsx,tsx}'],
|
|
205
|
+
theme: {
|
|
206
|
+
extend: {},
|
|
207
|
+
},
|
|
208
|
+
plugins: [],
|
|
209
|
+
};
|
|
210
|
+
'@
|
|
211
|
+
|
|
212
|
+
<#
|
|
213
|
+
The following command formats README.md and .gitignore
|
|
214
|
+
#>
|
|
215
|
+
|
|
216
|
+
Write-Output "Formatting README.md and .gitignore"
|
|
217
|
+
Clear-Content "README.md"
|
|
218
|
+
Add-Content ".gitignore" @"
|
|
219
|
+
.env
|
|
220
|
+
.env.*
|
|
221
|
+
.sixth*
|
|
222
|
+
"@
|
|
223
|
+
|
|
224
|
+
<#
|
|
225
|
+
The following command sets up the src directory
|
|
226
|
+
#>
|
|
227
|
+
|
|
228
|
+
Write-Output "Setting up src directory"
|
|
229
|
+
Set-Location src
|
|
230
|
+
|
|
231
|
+
<#
|
|
232
|
+
The following command sets up the main.tsx and App.tsx files
|
|
233
|
+
#>
|
|
234
|
+
|
|
235
|
+
Write-Output "Setting up main.tsx and App.tsx files"
|
|
236
|
+
Remove-Item "App.css", "index.css" -Force
|
|
237
|
+
Clear-Content "main.tsx", "App.tsx"
|
|
238
|
+
|
|
239
|
+
Set-Content "main.tsx" @'
|
|
240
|
+
import { createRoot } from 'react-dom/client';
|
|
241
|
+
import '../style/index.css';
|
|
242
|
+
import App from './App.tsx';
|
|
243
|
+
|
|
244
|
+
createRoot(document.getElementById('root')!).render(<App />);
|
|
245
|
+
'@
|
|
246
|
+
|
|
247
|
+
Set-Content "App.tsx" @'
|
|
248
|
+
export default function App() {
|
|
249
|
+
return <>app file loaded</>;
|
|
250
|
+
}
|
|
251
|
+
'@
|
|
252
|
+
|
|
253
|
+
<#
|
|
254
|
+
The following command sets up all directories and files
|
|
255
|
+
#>
|
|
256
|
+
|
|
257
|
+
Write-Output "Creating directories and files"
|
|
258
|
+
|
|
259
|
+
mkdir style
|
|
260
|
+
Set-Content "style/index.css" @'
|
|
261
|
+
@import "tailwindcss";
|
|
262
|
+
'@
|
|
263
|
+
|
|
264
|
+
mkdir components
|
|
265
|
+
mkdir components/base
|
|
266
|
+
Set-Content "components/base/index.ts" ""
|
|
267
|
+
mkdir components/global
|
|
268
|
+
Set-Content "components/global/index.ts" ""
|
|
269
|
+
|
|
270
|
+
mkdir hooks
|
|
271
|
+
Set-Content "hooks/index.ts" ""
|
|
272
|
+
|
|
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
|
+
mkdir utils
|
|
314
|
+
Set-Content "utils/index.ts" ""
|
|
315
|
+
|
|
316
|
+
Set-Location ..
|
|
317
|
+
|
|
318
|
+
Write-Output "✅ Project '$projectName' setup complete!"
|