create-reactivite 1.1.0 → 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/README.md +235 -197
- package/index.js +48 -1
- package/package.json +7 -4
- package/template/_gitignore +24 -0
- package/template/src/App.tsx +7 -2
- package/template/src/components/author-credit.tsx +25 -0
- package/template2/.env.example +8 -0
- package/template2/.husky/pre-commit +4 -0
- package/template2/.prettierrc +5 -0
- package/template2/README.md +73 -0
- package/template2/__tests__/example.test.ts +20 -0
- package/template2/_gitignore +37 -0
- package/template2/app/[locale]/(private)/dashboard/page.tsx +52 -0
- package/template2/app/[locale]/(public)/login/page.tsx +83 -0
- package/template2/app/[locale]/layout.tsx +58 -0
- package/template2/app/[locale]/locales.ts +10 -0
- package/template2/app/[locale]/page.tsx +38 -0
- package/template2/app/api/clear-session/route.ts +10 -0
- package/template2/app/globals.css +127 -0
- package/template2/app/layout.tsx +7 -0
- package/template2/app/page.tsx +6 -0
- package/template2/components/AuthEventListener.tsx +22 -0
- package/template2/components/author-credit.tsx +25 -0
- package/template2/components/theme-provider.tsx +78 -0
- package/template2/components/ui/button.tsx +60 -0
- package/template2/components/ui/card.tsx +92 -0
- package/template2/components/ui/input.tsx +21 -0
- package/template2/components/ui/label.tsx +24 -0
- package/template2/components/ui/sonner.tsx +40 -0
- package/template2/components.json +22 -0
- package/template2/config/constants.ts +7 -0
- package/template2/config/env.ts +5 -0
- package/template2/contexts/translation-context.tsx +70 -0
- package/template2/eslint.config.mjs +18 -0
- package/template2/hoc/provider.tsx +27 -0
- package/template2/lib/paramsSerializer.ts +40 -0
- package/template2/lib/utils.ts +6 -0
- package/template2/locales/az.json +20 -0
- package/template2/locales/en.json +20 -0
- package/template2/next-env.d.ts +6 -0
- package/template2/next.config.ts +17 -0
- package/template2/orval.config.ts +66 -0
- package/template2/package.json +62 -0
- package/template2/postcss.config.mjs +7 -0
- package/template2/public/.gitkeep +0 -0
- package/template2/scripts/fix-generated-types.mjs +13 -0
- package/template2/services/generated/.gitkeep +2 -0
- package/template2/services/httpClient/httpClient.ts +70 -0
- package/template2/services/httpClient/orvalMutator.ts +10 -0
- package/template2/store/example-store.tsx +16 -0
- package/template2/store/user-store.tsx +29 -0
- package/template2/testing/msw/handlers/index.ts +6 -0
- package/template2/testing/msw/server.ts +4 -0
- package/template2/tsconfig.json +34 -0
- package/template2/tsconfig.tsbuildinfo +1 -0
- package/template2/vitest.config.ts +17 -0
- package/template2/vitest.setup.ts +7 -0
- package/template3/README.md +34 -0
- package/template3/_gitignore +16 -0
- package/template3/index.html +11 -0
- package/template3/package.json +22 -0
- package/template3/rspack.config.mjs +51 -0
- package/template3/src/App.tsx +16 -0
- package/template3/src/components/author-credit.tsx +42 -0
- package/template3/src/index.css +46 -0
- package/template3/src/main.tsx +10 -0
- package/template3/tsconfig.json +20 -0
package/README.md
CHANGED
|
@@ -1,197 +1,235 @@
|
|
|
1
|
-
# create-reactivite
|
|
2
|
-
|
|
3
|
-
A modern
|
|
4
|
-
|
|
5
|
-
## 🚀
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
npx
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
- **
|
|
61
|
-
- **
|
|
62
|
-
- **
|
|
63
|
-
- **
|
|
64
|
-
- **
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
-
|
|
71
|
-
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
├──
|
|
80
|
-
|
|
81
|
-
│ ├── components/
|
|
82
|
-
│ │ ├── ui/ # shadcn/ui components
|
|
83
|
-
│ │ ├── home-page-components/
|
|
84
|
-
│ │ └── admin-page-components/
|
|
85
|
-
│ ├── lib/
|
|
86
|
-
│
|
|
87
|
-
│ ├──
|
|
88
|
-
│ │
|
|
89
|
-
│
|
|
90
|
-
│ ├──
|
|
91
|
-
│
|
|
92
|
-
|
|
93
|
-
├──
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
-
|
|
123
|
-
-
|
|
124
|
-
-
|
|
125
|
-
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
1
|
+
# create-reactivite
|
|
2
|
+
|
|
3
|
+
A modern frontend boilerplate generator. On run it asks which template you want, then scaffolds a production-ready app with TypeScript, Tailwind CSS v4 and shadcn/ui pre-wired.
|
|
4
|
+
|
|
5
|
+
## 🚀 Templates
|
|
6
|
+
|
|
7
|
+
When you run the CLI you pick one of two templates:
|
|
8
|
+
|
|
9
|
+
| Template | Stack |
|
|
10
|
+
| --- | --- |
|
|
11
|
+
| **React + Vite** | React 19, Vite 8 (Rolldown), Tailwind v4, shadcn/ui, React Router v7, Recharts |
|
|
12
|
+
| **Next.js 16** | Next.js 16 (App Router), React 19, Tailwind v4, shadcn/ui, i18n, TanStack Query, axios + orval, Zustand, react-hook-form + zod, husky, Vitest + MSW |
|
|
13
|
+
| **Rspack** | React 19 + TypeScript, Rspack bundler (SWC). Minimal starter — grow it yourself. |
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
$ npx create-reactivite my-app
|
|
17
|
+
|
|
18
|
+
? Project name: my-app
|
|
19
|
+
? Pick a template: ›
|
|
20
|
+
❯ React + Vite (Tailwind v4, shadcn/ui, React Router)
|
|
21
|
+
Next.js 16 (App Router, i18n, TanStack Query, orval, Zustand, husky)
|
|
22
|
+
Rspack (minimal React + TypeScript starter)
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## 📦 Installation
|
|
26
|
+
|
|
27
|
+
### Using npx (Recommended)
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
npx create-reactivite my-app
|
|
31
|
+
cd my-app
|
|
32
|
+
pnpm dev
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Using npm
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
npm create reactivite my-app
|
|
39
|
+
cd my-app
|
|
40
|
+
npm run dev
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Install in current directory
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
npx create-reactivite .
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Dependencies install automatically (`pnpm`, falling back to `npm`).
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## ⚛️ Template 1 — React + Vite
|
|
54
|
+
|
|
55
|
+
### Features
|
|
56
|
+
|
|
57
|
+
- **⚡ Vite 8** — Lightning-fast build tool and dev server (Rolldown bundler)
|
|
58
|
+
- **⚛️ React 19** — Latest React with modern features
|
|
59
|
+
- **📘 TypeScript 6** — Full TypeScript with strict configuration
|
|
60
|
+
- **🎨 Tailwind CSS v4** — Config-less, CSS-variable driven theme
|
|
61
|
+
- **🧩 shadcn/ui** — Beautiful, accessible UI components (new-york)
|
|
62
|
+
- **🧭 React Router v7** — Client-side routing with `createBrowserRouter`
|
|
63
|
+
- **📊 Recharts** — Composable charts for the admin dashboard
|
|
64
|
+
- **🌙 Dark Mode** — Built-in theme switching
|
|
65
|
+
- **🔔 Toasts** — Sonner notifications
|
|
66
|
+
- **🎯 ESLint** — Modern flat config
|
|
67
|
+
|
|
68
|
+
### Scripts
|
|
69
|
+
|
|
70
|
+
- `pnpm dev` — dev server (port 5173)
|
|
71
|
+
- `pnpm build` — `tsc -b && vite build`
|
|
72
|
+
- `pnpm preview` — serve the production build
|
|
73
|
+
- `pnpm lint` — ESLint
|
|
74
|
+
|
|
75
|
+
### Structure
|
|
76
|
+
|
|
77
|
+
```
|
|
78
|
+
my-app/
|
|
79
|
+
├── public/
|
|
80
|
+
├── src/
|
|
81
|
+
│ ├── components/
|
|
82
|
+
│ │ ├── ui/ # shadcn/ui components
|
|
83
|
+
│ │ ├── home-page-components/
|
|
84
|
+
│ │ └── admin-page-components/
|
|
85
|
+
│ ├── lib/utils.ts
|
|
86
|
+
│ ├── pages/
|
|
87
|
+
│ │ ├── Homepage/
|
|
88
|
+
│ │ └── Dashboard/
|
|
89
|
+
│ ├── App.tsx # createBrowserRouter route shell
|
|
90
|
+
│ ├── main.tsx
|
|
91
|
+
│ └── global.css
|
|
92
|
+
├── components.json
|
|
93
|
+
├── vite.config.ts
|
|
94
|
+
└── eslint.config.js
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Routing
|
|
98
|
+
|
|
99
|
+
Routes live in `App.tsx` via `createBrowserRouter` from **react-router** v7 (not `react-router-dom`):
|
|
100
|
+
|
|
101
|
+
```typescript
|
|
102
|
+
import { createBrowserRouter } from "react-router"
|
|
103
|
+
|
|
104
|
+
const router = createBrowserRouter([
|
|
105
|
+
{ path: "/", element: <Homepage /> },
|
|
106
|
+
{ path: "/dashboard", element: <Dashboard /> },
|
|
107
|
+
])
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
## ▲ Template 2 — Next.js 16
|
|
113
|
+
|
|
114
|
+
A locale-scoped App Router boilerplate with a full data layer and tooling.
|
|
115
|
+
|
|
116
|
+
### Features
|
|
117
|
+
|
|
118
|
+
- **▲ Next.js 16** — App Router, `output: "standalone"`
|
|
119
|
+
- **🌍 i18n** — `app/[locale]` routing, lightweight `TranslationProvider` + `locales/*.json`
|
|
120
|
+
- **🔁 TanStack Query** — `QueryClientProvider` + Devtools
|
|
121
|
+
- **🔌 axios + orval** — typed API hooks generated from your OpenAPI schema
|
|
122
|
+
- **🐻 Zustand** — state stores (persisted `user-store`)
|
|
123
|
+
- **📝 react-hook-form + zod** — typed forms
|
|
124
|
+
- **🧪 Vitest + MSW** — unit tests with mocked network
|
|
125
|
+
- **🐶 husky** — pre-commit: lint + format + tests
|
|
126
|
+
- **🎨 Tailwind v4 + shadcn/ui**
|
|
127
|
+
|
|
128
|
+
### Scripts
|
|
129
|
+
|
|
130
|
+
- `pnpm dev` — dev server (port 3000, redirects `/` → `/az`)
|
|
131
|
+
- `pnpm build` — `next build`
|
|
132
|
+
- `pnpm test` / `pnpm test:run` — Vitest
|
|
133
|
+
- `pnpm generate:api` — orval codegen into `services/generated/`
|
|
134
|
+
- `pnpm lint` / `pnpm format`
|
|
135
|
+
|
|
136
|
+
### Structure
|
|
137
|
+
|
|
138
|
+
```
|
|
139
|
+
my-app/
|
|
140
|
+
├── app/
|
|
141
|
+
│ ├── layout.tsx # root passthrough
|
|
142
|
+
│ ├── page.tsx # redirects to /{DEFAULT_LOCALE}
|
|
143
|
+
│ ├── globals.css
|
|
144
|
+
│ ├── api/clear-session/
|
|
145
|
+
│ └── [locale]/
|
|
146
|
+
│ ├── layout.tsx # html/body shell + providers
|
|
147
|
+
│ ├── locales.ts # server-only dictionary loader
|
|
148
|
+
│ ├── page.tsx # Home
|
|
149
|
+
│ ├── (public)/login/
|
|
150
|
+
│ └── (private)/dashboard/
|
|
151
|
+
├── components/ui/ # shadcn/ui
|
|
152
|
+
├── config/ # env + constants (LOCALES)
|
|
153
|
+
├── contexts/ # translation-context
|
|
154
|
+
├── hoc/ # QueryProvider
|
|
155
|
+
├── lib/ # utils, paramsSerializer
|
|
156
|
+
├── services/
|
|
157
|
+
│ ├── httpClient/ # axios + orval mutator
|
|
158
|
+
│ └── generated/ # orval output
|
|
159
|
+
├── store/ # zustand
|
|
160
|
+
├── locales/ # az.json, en.json
|
|
161
|
+
├── testing/msw/
|
|
162
|
+
└── orval.config.ts
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### API codegen (orval)
|
|
166
|
+
|
|
167
|
+
1. Point `orval.config.ts` `input.target` at your OpenAPI schema (or set `OPENAPI_TARGET`).
|
|
168
|
+
2. `pnpm generate:api` → writes react-query hooks + models to `services/generated/`.
|
|
169
|
+
|
|
170
|
+
> The `@/` path alias maps to the **project root** in this template (not `src/`).
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
## 🦀 Template 3 — Rspack (minimal)
|
|
175
|
+
|
|
176
|
+
A deliberately bare **React + TypeScript** starter on [Rspack](https://rspack.dev/) (Rust-based bundler, built-in SWC). No router, no UI kit — a clean base to build on.
|
|
177
|
+
|
|
178
|
+
### Scripts
|
|
179
|
+
|
|
180
|
+
- `pnpm dev` — dev server (port 5174)
|
|
181
|
+
- `pnpm build` — production build → `dist/`
|
|
182
|
+
- `pnpm preview` — serve the production build
|
|
183
|
+
|
|
184
|
+
### Structure
|
|
185
|
+
|
|
186
|
+
```
|
|
187
|
+
my-app/
|
|
188
|
+
├── index.html
|
|
189
|
+
├── rspack.config.mjs # entry, swc loader, html plugin, native CSS
|
|
190
|
+
├── tsconfig.json
|
|
191
|
+
└── src/
|
|
192
|
+
├── main.tsx
|
|
193
|
+
├── App.tsx
|
|
194
|
+
├── index.css
|
|
195
|
+
└── components/author-credit.tsx
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
---
|
|
199
|
+
|
|
200
|
+
## 👤 Author
|
|
201
|
+
|
|
202
|
+
Every template renders a small credit linking to the author. Built by **Javid Salimov** —
|
|
203
|
+
[GitHub](https://github.com/javidselimov) ·
|
|
204
|
+
[LinkedIn](https://www.linkedin.com/in/javidsalim/) ·
|
|
205
|
+
[npm](https://www.npmjs.com/~ubuligan).
|
|
206
|
+
|
|
207
|
+
---
|
|
208
|
+
|
|
209
|
+
## 🎨 Adding shadcn/ui Components
|
|
210
|
+
|
|
211
|
+
The React + Vite and Next.js templates use shadcn/ui (new-york, lucide icons):
|
|
212
|
+
|
|
213
|
+
```bash
|
|
214
|
+
npx shadcn@latest add button
|
|
215
|
+
npx shadcn@latest add form
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
## 🤝 Contributing
|
|
219
|
+
|
|
220
|
+
Contributions welcome — open a PR.
|
|
221
|
+
|
|
222
|
+
## 📄 License
|
|
223
|
+
|
|
224
|
+
MIT
|
|
225
|
+
|
|
226
|
+
## 🔗 Links
|
|
227
|
+
|
|
228
|
+
- [React](https://react.dev/) · [Next.js](https://nextjs.org/) · [Vite](https://vite.dev/) · [Rspack](https://rspack.dev/)
|
|
229
|
+
- [Tailwind CSS](https://tailwindcss.com/) · [shadcn/ui](https://ui.shadcn.com/)
|
|
230
|
+
- [React Router](https://reactrouter.com/) · [TanStack Query](https://tanstack.com/query) · [orval](https://orval.dev/)
|
|
231
|
+
- [Zustand](https://zustand.docs.pmnd.rs/) · [Recharts](https://recharts.org/) · [TypeScript](https://www.typescriptlang.org/)
|
|
232
|
+
|
|
233
|
+
---
|
|
234
|
+
|
|
235
|
+
**Happy coding! 🎉**
|
package/index.js
CHANGED
|
@@ -6,11 +6,29 @@ import { fileURLToPath } from "url";
|
|
|
6
6
|
import { copy } from "fs-extra";
|
|
7
7
|
import prompts from "prompts";
|
|
8
8
|
import { execa } from "execa";
|
|
9
|
+
import figlet from "figlet";
|
|
9
10
|
|
|
10
11
|
const __filename = fileURLToPath(import.meta.url);
|
|
11
12
|
const __dirname = path.dirname(__filename);
|
|
12
13
|
|
|
14
|
+
// ANSI rəng köməkçiləri (xarici asılılıq olmadan)
|
|
15
|
+
const cyan = (s) => `\x1b[36m${s}\x1b[0m`;
|
|
16
|
+
const dim = (s) => `\x1b[2m${s}\x1b[0m`;
|
|
17
|
+
|
|
18
|
+
// 🧩 Banner — CLI açılışında göstərilir
|
|
19
|
+
const printBanner = () => {
|
|
20
|
+
try {
|
|
21
|
+
console.log(cyan(figlet.textSync("Reactivite", { font: "Standard" })));
|
|
22
|
+
} catch {
|
|
23
|
+
// figlet uğursuz olsa sadə mətnə keç
|
|
24
|
+
console.log(cyan("\n create-reactivite"));
|
|
25
|
+
}
|
|
26
|
+
console.log(dim(" Scaffold React / Next.js / Rspack apps · by Javid Salimov\n"));
|
|
27
|
+
};
|
|
28
|
+
|
|
13
29
|
(async () => {
|
|
30
|
+
printBanner();
|
|
31
|
+
|
|
14
32
|
const { projectName } = await prompts({
|
|
15
33
|
type: "text",
|
|
16
34
|
name: "projectName",
|
|
@@ -18,13 +36,42 @@ const __dirname = path.dirname(__filename);
|
|
|
18
36
|
initial: "my-react-app",
|
|
19
37
|
});
|
|
20
38
|
|
|
39
|
+
// 🧩 0. Hansı template istifadə olunacaq — istifadəçi seçir
|
|
40
|
+
const { template } = await prompts({
|
|
41
|
+
type: "select",
|
|
42
|
+
name: "template",
|
|
43
|
+
message: "Pick a template:",
|
|
44
|
+
choices: [
|
|
45
|
+
{
|
|
46
|
+
title: "React + Vite (Tailwind v4, shadcn/ui, React Router)",
|
|
47
|
+
value: "template",
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
title:
|
|
51
|
+
"Next.js 16 (App Router, i18n, TanStack Query, orval, Zustand, husky)",
|
|
52
|
+
value: "template2",
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
title: "Rspack (minimal React + TypeScript starter)",
|
|
56
|
+
value: "template3",
|
|
57
|
+
},
|
|
58
|
+
],
|
|
59
|
+
initial: 0,
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
// İstifadəçi seçimi ləğv etdisə (Ctrl+C) — çıx
|
|
63
|
+
if (!template) {
|
|
64
|
+
console.log("❌ Operation cancelled.");
|
|
65
|
+
process.exit(1);
|
|
66
|
+
}
|
|
67
|
+
|
|
21
68
|
// 🧩 1. Target folderı müəyyən edirik
|
|
22
69
|
const isCurrentDir = projectName === "." || projectName === "./";
|
|
23
70
|
const targetPath = isCurrentDir
|
|
24
71
|
? process.cwd()
|
|
25
72
|
: path.resolve(process.cwd(), projectName);
|
|
26
73
|
|
|
27
|
-
const templatePath = path.resolve(__dirname,
|
|
74
|
+
const templatePath = path.resolve(__dirname, template);
|
|
28
75
|
|
|
29
76
|
// 🧩 2. Əgər current folderdirsə — içi boşdursa davam et, yoxsa xəbərdarlıq ver
|
|
30
77
|
if (isCurrentDir) {
|
package/package.json
CHANGED
|
@@ -1,19 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-reactivite",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "⚡
|
|
3
|
+
"version": "1.3.0",
|
|
4
|
+
"description": "⚡ Scaffold modern frontend projects in seconds — pick a template: React + Vite or Next.js 16 (App Router). Both ship Tailwind v4, shadcn/ui, TypeScript and a clean, production-ready structure. The Next.js template adds i18n, TanStack Query, axios/orval, Zustand, husky and Vitest. Zero setup hassle.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"create-reactivite": "./index.js"
|
|
7
7
|
},
|
|
8
8
|
"type": "module",
|
|
9
9
|
"files": [
|
|
10
10
|
"index.js",
|
|
11
|
-
"template/"
|
|
11
|
+
"template/",
|
|
12
|
+
"template2/",
|
|
13
|
+
"template3/"
|
|
12
14
|
],
|
|
13
15
|
"dependencies": {
|
|
14
16
|
"prompts": "^2.4.2",
|
|
15
17
|
"fs-extra": "^11.2.0",
|
|
16
|
-
"execa": "^7.1.0"
|
|
18
|
+
"execa": "^7.1.0",
|
|
19
|
+
"figlet": "^1.9.3"
|
|
17
20
|
},
|
|
18
21
|
"repository": {
|
|
19
22
|
"type": "git",
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Logs
|
|
2
|
+
logs
|
|
3
|
+
*.log
|
|
4
|
+
npm-debug.log*
|
|
5
|
+
yarn-debug.log*
|
|
6
|
+
yarn-error.log*
|
|
7
|
+
pnpm-debug.log*
|
|
8
|
+
lerna-debug.log*
|
|
9
|
+
|
|
10
|
+
node_modules
|
|
11
|
+
dist
|
|
12
|
+
dist-ssr
|
|
13
|
+
*.local
|
|
14
|
+
|
|
15
|
+
# Editor directories and files
|
|
16
|
+
.vscode/*
|
|
17
|
+
!.vscode/extensions.json
|
|
18
|
+
.idea
|
|
19
|
+
.DS_Store
|
|
20
|
+
*.suo
|
|
21
|
+
*.ntvs*
|
|
22
|
+
*.njsproj
|
|
23
|
+
*.sln
|
|
24
|
+
*.sw?
|
package/template/src/App.tsx
CHANGED
|
@@ -5,6 +5,7 @@ import { createBrowserRouter } from "react-router";
|
|
|
5
5
|
import { RouterProvider } from "react-router/dom";
|
|
6
6
|
import Home from './pages/Homepage/Homepage';
|
|
7
7
|
import DashboardPage from './pages/Dashboard/Dashboard';
|
|
8
|
+
import { AuthorCredit } from './components/author-credit';
|
|
8
9
|
const router = createBrowserRouter([
|
|
9
10
|
{
|
|
10
11
|
path: "/",
|
|
@@ -20,8 +21,12 @@ const router = createBrowserRouter([
|
|
|
20
21
|
},
|
|
21
22
|
]);
|
|
22
23
|
function App() {
|
|
23
|
-
return
|
|
24
|
-
|
|
24
|
+
return (
|
|
25
|
+
<>
|
|
26
|
+
<RouterProvider router={router} />
|
|
27
|
+
<AuthorCredit />
|
|
28
|
+
</>
|
|
29
|
+
);
|
|
25
30
|
}
|
|
26
31
|
|
|
27
32
|
export default App
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
const links = [
|
|
2
|
+
{ label: "GitHub", href: "https://github.com/javidselimov" },
|
|
3
|
+
{ label: "LinkedIn", href: "https://www.linkedin.com/in/javidsalim/" },
|
|
4
|
+
{ label: "npm", href: "https://www.npmjs.com/~ubuligan" },
|
|
5
|
+
];
|
|
6
|
+
|
|
7
|
+
export function AuthorCredit() {
|
|
8
|
+
return (
|
|
9
|
+
<div className="fixed bottom-4 right-4 z-50 flex items-center gap-3 rounded-full border bg-background/80 px-4 py-2 text-sm shadow-lg backdrop-blur">
|
|
10
|
+
<span className="font-medium">Javid Salimov</span>
|
|
11
|
+
<span className="text-muted-foreground">·</span>
|
|
12
|
+
{links.map((l) => (
|
|
13
|
+
<a
|
|
14
|
+
key={l.label}
|
|
15
|
+
href={l.href}
|
|
16
|
+
target="_blank"
|
|
17
|
+
rel="noreferrer"
|
|
18
|
+
className="text-muted-foreground transition-colors hover:text-foreground"
|
|
19
|
+
>
|
|
20
|
+
{l.label}
|
|
21
|
+
</a>
|
|
22
|
+
))}
|
|
23
|
+
</div>
|
|
24
|
+
);
|
|
25
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# Public API base URL used by the browser (axios httpClient).
|
|
2
|
+
NEXT_PUBLIC_API_BASE_URL=/api/backend
|
|
3
|
+
|
|
4
|
+
# Server-side backend URL proxied via next.config.ts rewrites.
|
|
5
|
+
API_BASE_URL=http://localhost:8080/api
|
|
6
|
+
|
|
7
|
+
# OpenAPI schema used by orval (npm run generate:api).
|
|
8
|
+
OPENAPI_TARGET=http://localhost:8080/v3/api-docs
|