create-reactivite 1.0.4 → 1.2.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 +119 -98
- package/index.js +33 -1
- package/package.json +4 -3
- package/template/README.md +73 -73
- package/template/_gitignore +24 -0
- package/template/components.json +22 -22
- package/template/eslint.config.js +30 -23
- package/template/index.html +13 -13
- package/template/package.json +53 -53
- package/template/pnpm-lock.yaml +1281 -1856
- package/template/src/App.tsx +27 -27
- package/template/src/components/home-page-components/header.tsx +2 -2
- package/template/src/components/ui/accordion.tsx +64 -64
- package/template/src/components/ui/alert.tsx +66 -66
- package/template/src/components/ui/avatar.tsx +51 -51
- package/template/src/components/ui/badge.tsx +46 -46
- package/template/src/components/ui/button-group.tsx +83 -83
- package/template/src/components/ui/button.tsx +60 -60
- package/template/src/components/ui/calendar.tsx +210 -211
- package/template/src/components/ui/card.tsx +92 -92
- package/template/src/components/ui/checkbox.tsx +30 -30
- package/template/src/components/ui/collapsible.tsx +31 -31
- package/template/src/components/ui/dialog.tsx +141 -141
- package/template/src/components/ui/input.tsx +21 -21
- package/template/src/components/ui/select.tsx +185 -185
- package/template/src/components/ui/separator.tsx +26 -26
- package/template/src/components/ui/sonner.tsx +38 -38
- package/template/src/components/ui/spinner.tsx +16 -16
- package/template/src/components/ui/table.tsx +114 -114
- package/template/src/components/ui/toggle.tsx +45 -45
- package/template/src/components/ui/tooltip.tsx +59 -59
- package/template/src/lib/utils.ts +6 -6
- package/template/src/main.tsx +10 -10
- package/template/tsconfig.app.json +31 -28
- package/template/tsconfig.json +2 -4
- package/template/tsconfig.node.json +26 -26
- 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 +56 -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/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/pnpm-lock.yaml +6804 -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/README.md
CHANGED
|
@@ -1,21 +1,24 @@
|
|
|
1
1
|
# create-reactivite
|
|
2
2
|
|
|
3
|
-
A modern
|
|
4
|
-
|
|
5
|
-
## 🚀
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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
|
+
|
|
14
|
+
```
|
|
15
|
+
$ npx create-reactivite my-app
|
|
16
|
+
|
|
17
|
+
? Project name: my-app
|
|
18
|
+
? Pick a template: ›
|
|
19
|
+
❯ React + Vite (Tailwind v4, shadcn/ui, React Router)
|
|
20
|
+
Next.js 16 (App Router, i18n, TanStack Query, orval, Zustand, husky)
|
|
21
|
+
```
|
|
19
22
|
|
|
20
23
|
## 📦 Installation
|
|
21
24
|
|
|
@@ -41,136 +44,154 @@ npm run dev
|
|
|
41
44
|
npx create-reactivite .
|
|
42
45
|
```
|
|
43
46
|
|
|
44
|
-
|
|
47
|
+
Dependencies install automatically (`pnpm`, falling back to `npm`).
|
|
45
48
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
- **React 19.1.1** - Latest React with concurrent features
|
|
49
|
-
- **TypeScript 5.9.3** - Strict type checking
|
|
50
|
-
- **Vite 7.1.7** - Fast build tool and dev server
|
|
51
|
-
- **Tailwind CSS 4.1.14** - Utility-first CSS framework
|
|
49
|
+
---
|
|
52
50
|
|
|
53
|
-
|
|
51
|
+
## ⚛️ Template 1 — React + Vite
|
|
54
52
|
|
|
55
|
-
|
|
53
|
+
### Features
|
|
56
54
|
|
|
57
|
-
- **
|
|
58
|
-
- **
|
|
59
|
-
- **
|
|
60
|
-
- **
|
|
61
|
-
- **
|
|
55
|
+
- **⚡ Vite 8** — Lightning-fast build tool and dev server (Rolldown bundler)
|
|
56
|
+
- **⚛️ React 19** — Latest React with modern features
|
|
57
|
+
- **📘 TypeScript 6** — Full TypeScript with strict configuration
|
|
58
|
+
- **🎨 Tailwind CSS v4** — Config-less, CSS-variable driven theme
|
|
59
|
+
- **🧩 shadcn/ui** — Beautiful, accessible UI components (new-york)
|
|
60
|
+
- **🧭 React Router v7** — Client-side routing with `createBrowserRouter`
|
|
61
|
+
- **📊 Recharts** — Composable charts for the admin dashboard
|
|
62
|
+
- **🌙 Dark Mode** — Built-in theme switching
|
|
63
|
+
- **🔔 Toasts** — Sonner notifications
|
|
64
|
+
- **🎯 ESLint** — Modern flat config
|
|
62
65
|
|
|
63
|
-
###
|
|
66
|
+
### Scripts
|
|
64
67
|
|
|
65
|
-
-
|
|
66
|
-
-
|
|
67
|
-
-
|
|
68
|
-
-
|
|
68
|
+
- `pnpm dev` — dev server (port 5173)
|
|
69
|
+
- `pnpm build` — `tsc -b && vite build`
|
|
70
|
+
- `pnpm preview` — serve the production build
|
|
71
|
+
- `pnpm lint` — ESLint
|
|
69
72
|
|
|
70
|
-
|
|
73
|
+
### Structure
|
|
71
74
|
|
|
72
75
|
```
|
|
73
76
|
my-app/
|
|
74
77
|
├── public/
|
|
75
|
-
│ └── vite.svg
|
|
76
78
|
├── src/
|
|
77
|
-
│ ├── assets/
|
|
78
79
|
│ ├── components/
|
|
79
|
-
│ │ ├── ui/
|
|
80
|
-
│ │
|
|
81
|
-
│
|
|
82
|
-
│
|
|
80
|
+
│ │ ├── ui/ # shadcn/ui components
|
|
81
|
+
│ │ ├── home-page-components/
|
|
82
|
+
│ │ └── admin-page-components/
|
|
83
|
+
│ ├── lib/utils.ts
|
|
83
84
|
│ ├── pages/
|
|
84
|
-
│ │
|
|
85
|
-
│
|
|
85
|
+
│ │ ├── Homepage/
|
|
86
|
+
│ │ └── Dashboard/
|
|
87
|
+
│ ├── App.tsx # createBrowserRouter route shell
|
|
86
88
|
│ ├── main.tsx
|
|
87
89
|
│ └── global.css
|
|
88
|
-
├── components.json
|
|
89
|
-
├── package.json
|
|
90
|
-
├── tsconfig.json
|
|
90
|
+
├── components.json
|
|
91
91
|
├── vite.config.ts
|
|
92
92
|
└── eslint.config.js
|
|
93
93
|
```
|
|
94
94
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
1. **Create your project**:
|
|
98
|
-
```bash
|
|
99
|
-
npx create-reactivite my-awesome-app
|
|
100
|
-
cd my-awesome-app
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
2. **Install dependencies** (automatically done):
|
|
104
|
-
```bash
|
|
105
|
-
pnpm install # or npm install
|
|
106
|
-
```
|
|
95
|
+
### Routing
|
|
107
96
|
|
|
108
|
-
|
|
109
|
-
```bash
|
|
110
|
-
pnpm dev # or npm run dev
|
|
111
|
-
```
|
|
97
|
+
Routes live in `App.tsx` via `createBrowserRouter` from **react-router** v7 (not `react-router-dom`):
|
|
112
98
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
## 📝 Available Scripts
|
|
99
|
+
```typescript
|
|
100
|
+
import { createBrowserRouter } from "react-router"
|
|
116
101
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
102
|
+
const router = createBrowserRouter([
|
|
103
|
+
{ path: "/", element: <Homepage /> },
|
|
104
|
+
{ path: "/dashboard", element: <Dashboard /> },
|
|
105
|
+
])
|
|
106
|
+
```
|
|
121
107
|
|
|
122
|
-
|
|
108
|
+
---
|
|
123
109
|
|
|
124
|
-
|
|
110
|
+
## ▲ Template 2 — Next.js 16
|
|
125
111
|
|
|
126
|
-
|
|
127
|
-
npx shadcn@latest add button
|
|
128
|
-
npx shadcn@latest add input
|
|
129
|
-
npx shadcn@latest add form
|
|
130
|
-
```
|
|
112
|
+
A locale-scoped App Router boilerplate with a full data layer and tooling.
|
|
131
113
|
|
|
132
|
-
|
|
114
|
+
### Features
|
|
133
115
|
|
|
134
|
-
|
|
116
|
+
- **▲ Next.js 16** — App Router, `output: "standalone"`
|
|
117
|
+
- **🌍 i18n** — `app/[locale]` routing, lightweight `TranslationProvider` + `locales/*.json`
|
|
118
|
+
- **🔁 TanStack Query** — `QueryClientProvider` + Devtools
|
|
119
|
+
- **🔌 axios + orval** — typed API hooks generated from your OpenAPI schema
|
|
120
|
+
- **🐻 Zustand** — state stores (persisted `user-store`)
|
|
121
|
+
- **📝 react-hook-form + zod** — typed forms
|
|
122
|
+
- **🧪 Vitest + MSW** — unit tests with mocked network
|
|
123
|
+
- **🐶 husky** — pre-commit: lint + format + tests
|
|
124
|
+
- **🎨 Tailwind v4 + shadcn/ui**
|
|
135
125
|
|
|
136
|
-
|
|
126
|
+
### Scripts
|
|
137
127
|
|
|
138
|
-
|
|
128
|
+
- `pnpm dev` — dev server (port 3000, redirects `/` → `/az`)
|
|
129
|
+
- `pnpm build` — `next build`
|
|
130
|
+
- `pnpm test` / `pnpm test:run` — Vitest
|
|
131
|
+
- `pnpm generate:api` — orval codegen into `services/generated/`
|
|
132
|
+
- `pnpm lint` / `pnpm format`
|
|
139
133
|
|
|
140
|
-
|
|
134
|
+
### Structure
|
|
141
135
|
|
|
142
|
-
```typescript
|
|
143
|
-
import { Button } from "@/components/ui/button"
|
|
144
|
-
import { utils } from "@/lib/utils"
|
|
145
136
|
```
|
|
137
|
+
my-app/
|
|
138
|
+
├── app/
|
|
139
|
+
│ ├── layout.tsx # root passthrough
|
|
140
|
+
│ ├── page.tsx # redirects to /{DEFAULT_LOCALE}
|
|
141
|
+
│ ├── globals.css
|
|
142
|
+
│ ├── api/clear-session/
|
|
143
|
+
│ └── [locale]/
|
|
144
|
+
│ ├── layout.tsx # html/body shell + providers
|
|
145
|
+
│ ├── locales.ts # server-only dictionary loader
|
|
146
|
+
│ ├── page.tsx # Home
|
|
147
|
+
│ ├── (public)/login/
|
|
148
|
+
│ └── (private)/dashboard/
|
|
149
|
+
├── components/ui/ # shadcn/ui
|
|
150
|
+
├── config/ # env + constants (LOCALES)
|
|
151
|
+
├── contexts/ # translation-context
|
|
152
|
+
├── hoc/ # QueryProvider
|
|
153
|
+
├── lib/ # utils, paramsSerializer
|
|
154
|
+
├── services/
|
|
155
|
+
│ ├── httpClient/ # axios + orval mutator
|
|
156
|
+
│ └── generated/ # orval output
|
|
157
|
+
├── store/ # zustand
|
|
158
|
+
├── locales/ # az.json, en.json
|
|
159
|
+
├── testing/msw/
|
|
160
|
+
└── orval.config.ts
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
### API codegen (orval)
|
|
146
164
|
|
|
147
|
-
|
|
165
|
+
1. Point `orval.config.ts` `input.target` at your OpenAPI schema (or set `OPENAPI_TARGET`).
|
|
166
|
+
2. `pnpm generate:api` → writes react-query hooks + models to `services/generated/`.
|
|
148
167
|
|
|
149
|
-
|
|
168
|
+
> The `@/` path alias maps to the **project root** in this template (not `src/`).
|
|
150
169
|
|
|
151
|
-
|
|
170
|
+
---
|
|
152
171
|
|
|
153
|
-
|
|
172
|
+
## 🎨 Adding shadcn/ui Components
|
|
154
173
|
|
|
155
|
-
|
|
174
|
+
Both templates use shadcn/ui (new-york, lucide icons):
|
|
156
175
|
|
|
157
|
-
|
|
176
|
+
```bash
|
|
177
|
+
npx shadcn@latest add button
|
|
178
|
+
npx shadcn@latest add form
|
|
179
|
+
```
|
|
158
180
|
|
|
159
181
|
## 🤝 Contributing
|
|
160
182
|
|
|
161
|
-
Contributions
|
|
183
|
+
Contributions welcome — open a PR.
|
|
162
184
|
|
|
163
185
|
## 📄 License
|
|
164
186
|
|
|
165
|
-
MIT
|
|
187
|
+
MIT
|
|
166
188
|
|
|
167
189
|
## 🔗 Links
|
|
168
190
|
|
|
169
|
-
- [React](https://react.dev/)
|
|
170
|
-
- [
|
|
171
|
-
- [
|
|
172
|
-
- [
|
|
173
|
-
- [TypeScript](https://www.typescriptlang.org/)
|
|
191
|
+
- [React](https://react.dev/) · [Next.js](https://nextjs.org/) · [Vite](https://vite.dev/)
|
|
192
|
+
- [Tailwind CSS](https://tailwindcss.com/) · [shadcn/ui](https://ui.shadcn.com/)
|
|
193
|
+
- [React Router](https://reactrouter.com/) · [TanStack Query](https://tanstack.com/query) · [orval](https://orval.dev/)
|
|
194
|
+
- [Zustand](https://zustand.docs.pmnd.rs/) · [Recharts](https://recharts.org/) · [TypeScript](https://www.typescriptlang.org/)
|
|
174
195
|
|
|
175
196
|
---
|
|
176
197
|
|
package/index.js
CHANGED
|
@@ -18,13 +18,38 @@ const __dirname = path.dirname(__filename);
|
|
|
18
18
|
initial: "my-react-app",
|
|
19
19
|
});
|
|
20
20
|
|
|
21
|
+
// 🧩 0. Hansı template istifadə olunacaq — istifadəçi seçir
|
|
22
|
+
const { template } = await prompts({
|
|
23
|
+
type: "select",
|
|
24
|
+
name: "template",
|
|
25
|
+
message: "Pick a template:",
|
|
26
|
+
choices: [
|
|
27
|
+
{
|
|
28
|
+
title: "React + Vite (Tailwind v4, shadcn/ui, React Router)",
|
|
29
|
+
value: "template",
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
title:
|
|
33
|
+
"Next.js 16 (App Router, i18n, TanStack Query, orval, Zustand, husky)",
|
|
34
|
+
value: "template2",
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
initial: 0,
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
// İstifadəçi seçimi ləğv etdisə (Ctrl+C) — çıx
|
|
41
|
+
if (!template) {
|
|
42
|
+
console.log("❌ Operation cancelled.");
|
|
43
|
+
process.exit(1);
|
|
44
|
+
}
|
|
45
|
+
|
|
21
46
|
// 🧩 1. Target folderı müəyyən edirik
|
|
22
47
|
const isCurrentDir = projectName === "." || projectName === "./";
|
|
23
48
|
const targetPath = isCurrentDir
|
|
24
49
|
? process.cwd()
|
|
25
50
|
: path.resolve(process.cwd(), projectName);
|
|
26
51
|
|
|
27
|
-
const templatePath = path.resolve(__dirname,
|
|
52
|
+
const templatePath = path.resolve(__dirname, template);
|
|
28
53
|
|
|
29
54
|
// 🧩 2. Əgər current folderdirsə — içi boşdursa davam et, yoxsa xəbərdarlıq ver
|
|
30
55
|
if (isCurrentDir) {
|
|
@@ -54,6 +79,13 @@ const __dirname = path.dirname(__filename);
|
|
|
54
79
|
console.log("📦 Creating project...");
|
|
55
80
|
await copy(templatePath, targetPath);
|
|
56
81
|
|
|
82
|
+
// npm publish `.gitignore` faylını tarball-dan silir, ona görə
|
|
83
|
+
// template-də `_gitignore` saxlanılır və kopyadan sonra adı dəyişdirilir.
|
|
84
|
+
const gitignoreSrc = path.join(targetPath, "_gitignore");
|
|
85
|
+
if (fs.existsSync(gitignoreSrc)) {
|
|
86
|
+
fs.renameSync(gitignoreSrc, path.join(targetPath, ".gitignore"));
|
|
87
|
+
}
|
|
88
|
+
|
|
57
89
|
// 🧩 4. Asılılıqları quraşdırırıq
|
|
58
90
|
console.log("📥 Installing dependencies...");
|
|
59
91
|
try {
|
package/package.json
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-reactivite",
|
|
3
|
-
"version": "1.0
|
|
4
|
-
"description": "⚡
|
|
3
|
+
"version": "1.2.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/"
|
|
12
13
|
],
|
|
13
14
|
"dependencies": {
|
|
14
15
|
"prompts": "^2.4.2",
|
package/template/README.md
CHANGED
|
@@ -1,73 +1,73 @@
|
|
|
1
|
-
# React + TypeScript + Vite
|
|
2
|
-
|
|
3
|
-
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
|
|
4
|
-
|
|
5
|
-
Currently, two official plugins are available:
|
|
6
|
-
|
|
7
|
-
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) (or [oxc](https://oxc.rs) when used in [rolldown-vite](https://vite.dev/guide/rolldown)) for Fast Refresh
|
|
8
|
-
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
|
|
9
|
-
|
|
10
|
-
## React Compiler
|
|
11
|
-
|
|
12
|
-
The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see [this documentation](https://react.dev/learn/react-compiler/installation).
|
|
13
|
-
|
|
14
|
-
## Expanding the ESLint configuration
|
|
15
|
-
|
|
16
|
-
If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
|
|
17
|
-
|
|
18
|
-
```js
|
|
19
|
-
export default defineConfig([
|
|
20
|
-
globalIgnores(['dist']),
|
|
21
|
-
{
|
|
22
|
-
files: ['**/*.{ts,tsx}'],
|
|
23
|
-
extends: [
|
|
24
|
-
// Other configs...
|
|
25
|
-
|
|
26
|
-
// Remove tseslint.configs.recommended and replace with this
|
|
27
|
-
tseslint.configs.recommendedTypeChecked,
|
|
28
|
-
// Alternatively, use this for stricter rules
|
|
29
|
-
tseslint.configs.strictTypeChecked,
|
|
30
|
-
// Optionally, add this for stylistic rules
|
|
31
|
-
tseslint.configs.stylisticTypeChecked,
|
|
32
|
-
|
|
33
|
-
// Other configs...
|
|
34
|
-
],
|
|
35
|
-
languageOptions: {
|
|
36
|
-
parserOptions: {
|
|
37
|
-
project: ['./tsconfig.node.json', './tsconfig.app.json'],
|
|
38
|
-
tsconfigRootDir: import.meta.dirname,
|
|
39
|
-
},
|
|
40
|
-
// other options...
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
])
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules:
|
|
47
|
-
|
|
48
|
-
```js
|
|
49
|
-
// eslint.config.js
|
|
50
|
-
import reactX from 'eslint-plugin-react-x'
|
|
51
|
-
import reactDom from 'eslint-plugin-react-dom'
|
|
52
|
-
|
|
53
|
-
export default defineConfig([
|
|
54
|
-
globalIgnores(['dist']),
|
|
55
|
-
{
|
|
56
|
-
files: ['**/*.{ts,tsx}'],
|
|
57
|
-
extends: [
|
|
58
|
-
// Other configs...
|
|
59
|
-
// Enable lint rules for React
|
|
60
|
-
reactX.configs['recommended-typescript'],
|
|
61
|
-
// Enable lint rules for React DOM
|
|
62
|
-
reactDom.configs.recommended,
|
|
63
|
-
],
|
|
64
|
-
languageOptions: {
|
|
65
|
-
parserOptions: {
|
|
66
|
-
project: ['./tsconfig.node.json', './tsconfig.app.json'],
|
|
67
|
-
tsconfigRootDir: import.meta.dirname,
|
|
68
|
-
},
|
|
69
|
-
// other options...
|
|
70
|
-
},
|
|
71
|
-
},
|
|
72
|
-
])
|
|
73
|
-
```
|
|
1
|
+
# React + TypeScript + Vite
|
|
2
|
+
|
|
3
|
+
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
|
|
4
|
+
|
|
5
|
+
Currently, two official plugins are available:
|
|
6
|
+
|
|
7
|
+
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) (or [oxc](https://oxc.rs) when used in [rolldown-vite](https://vite.dev/guide/rolldown)) for Fast Refresh
|
|
8
|
+
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
|
|
9
|
+
|
|
10
|
+
## React Compiler
|
|
11
|
+
|
|
12
|
+
The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see [this documentation](https://react.dev/learn/react-compiler/installation).
|
|
13
|
+
|
|
14
|
+
## Expanding the ESLint configuration
|
|
15
|
+
|
|
16
|
+
If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
|
|
17
|
+
|
|
18
|
+
```js
|
|
19
|
+
export default defineConfig([
|
|
20
|
+
globalIgnores(['dist']),
|
|
21
|
+
{
|
|
22
|
+
files: ['**/*.{ts,tsx}'],
|
|
23
|
+
extends: [
|
|
24
|
+
// Other configs...
|
|
25
|
+
|
|
26
|
+
// Remove tseslint.configs.recommended and replace with this
|
|
27
|
+
tseslint.configs.recommendedTypeChecked,
|
|
28
|
+
// Alternatively, use this for stricter rules
|
|
29
|
+
tseslint.configs.strictTypeChecked,
|
|
30
|
+
// Optionally, add this for stylistic rules
|
|
31
|
+
tseslint.configs.stylisticTypeChecked,
|
|
32
|
+
|
|
33
|
+
// Other configs...
|
|
34
|
+
],
|
|
35
|
+
languageOptions: {
|
|
36
|
+
parserOptions: {
|
|
37
|
+
project: ['./tsconfig.node.json', './tsconfig.app.json'],
|
|
38
|
+
tsconfigRootDir: import.meta.dirname,
|
|
39
|
+
},
|
|
40
|
+
// other options...
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
])
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules:
|
|
47
|
+
|
|
48
|
+
```js
|
|
49
|
+
// eslint.config.js
|
|
50
|
+
import reactX from 'eslint-plugin-react-x'
|
|
51
|
+
import reactDom from 'eslint-plugin-react-dom'
|
|
52
|
+
|
|
53
|
+
export default defineConfig([
|
|
54
|
+
globalIgnores(['dist']),
|
|
55
|
+
{
|
|
56
|
+
files: ['**/*.{ts,tsx}'],
|
|
57
|
+
extends: [
|
|
58
|
+
// Other configs...
|
|
59
|
+
// Enable lint rules for React
|
|
60
|
+
reactX.configs['recommended-typescript'],
|
|
61
|
+
// Enable lint rules for React DOM
|
|
62
|
+
reactDom.configs.recommended,
|
|
63
|
+
],
|
|
64
|
+
languageOptions: {
|
|
65
|
+
parserOptions: {
|
|
66
|
+
project: ['./tsconfig.node.json', './tsconfig.app.json'],
|
|
67
|
+
tsconfigRootDir: import.meta.dirname,
|
|
68
|
+
},
|
|
69
|
+
// other options...
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
])
|
|
73
|
+
```
|
|
@@ -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/components.json
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://ui.shadcn.com/schema.json",
|
|
3
|
-
"style": "new-york",
|
|
4
|
-
"rsc": false,
|
|
5
|
-
"tsx": true,
|
|
6
|
-
"tailwind": {
|
|
7
|
-
"config": "",
|
|
8
|
-
"css": "src/index.css",
|
|
9
|
-
"baseColor": "neutral",
|
|
10
|
-
"cssVariables": true,
|
|
11
|
-
"prefix": ""
|
|
12
|
-
},
|
|
13
|
-
"iconLibrary": "lucide",
|
|
14
|
-
"aliases": {
|
|
15
|
-
"components": "@/components",
|
|
16
|
-
"utils": "@/lib/utils",
|
|
17
|
-
"ui": "@/components/ui",
|
|
18
|
-
"lib": "@/lib",
|
|
19
|
-
"hooks": "@/hooks"
|
|
20
|
-
},
|
|
21
|
-
"registries": {}
|
|
22
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://ui.shadcn.com/schema.json",
|
|
3
|
+
"style": "new-york",
|
|
4
|
+
"rsc": false,
|
|
5
|
+
"tsx": true,
|
|
6
|
+
"tailwind": {
|
|
7
|
+
"config": "",
|
|
8
|
+
"css": "src/index.css",
|
|
9
|
+
"baseColor": "neutral",
|
|
10
|
+
"cssVariables": true,
|
|
11
|
+
"prefix": ""
|
|
12
|
+
},
|
|
13
|
+
"iconLibrary": "lucide",
|
|
14
|
+
"aliases": {
|
|
15
|
+
"components": "@/components",
|
|
16
|
+
"utils": "@/lib/utils",
|
|
17
|
+
"ui": "@/components/ui",
|
|
18
|
+
"lib": "@/lib",
|
|
19
|
+
"hooks": "@/hooks"
|
|
20
|
+
},
|
|
21
|
+
"registries": {}
|
|
22
|
+
}
|
|
@@ -1,23 +1,30 @@
|
|
|
1
|
-
import js from '@eslint/js'
|
|
2
|
-
import globals from 'globals'
|
|
3
|
-
import reactHooks from 'eslint-plugin-react-hooks'
|
|
4
|
-
import reactRefresh from 'eslint-plugin-react-refresh'
|
|
5
|
-
import tseslint from 'typescript-eslint'
|
|
6
|
-
import { defineConfig, globalIgnores } from 'eslint/config'
|
|
7
|
-
|
|
8
|
-
export default defineConfig([
|
|
9
|
-
globalIgnores(['dist']),
|
|
10
|
-
{
|
|
11
|
-
files: ['**/*.{ts,tsx}'],
|
|
12
|
-
extends: [
|
|
13
|
-
js.configs.recommended,
|
|
14
|
-
tseslint.configs.recommended,
|
|
15
|
-
reactHooks.configs['recommended-latest'],
|
|
16
|
-
reactRefresh.configs.vite,
|
|
17
|
-
],
|
|
18
|
-
languageOptions: {
|
|
19
|
-
ecmaVersion: 2020,
|
|
20
|
-
globals: globals.browser,
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
|
|
1
|
+
import js from '@eslint/js'
|
|
2
|
+
import globals from 'globals'
|
|
3
|
+
import reactHooks from 'eslint-plugin-react-hooks'
|
|
4
|
+
import reactRefresh from 'eslint-plugin-react-refresh'
|
|
5
|
+
import tseslint from 'typescript-eslint'
|
|
6
|
+
import { defineConfig, globalIgnores } from 'eslint/config'
|
|
7
|
+
|
|
8
|
+
export default defineConfig([
|
|
9
|
+
globalIgnores(['dist']),
|
|
10
|
+
{
|
|
11
|
+
files: ['**/*.{ts,tsx}'],
|
|
12
|
+
extends: [
|
|
13
|
+
js.configs.recommended,
|
|
14
|
+
tseslint.configs.recommended,
|
|
15
|
+
reactHooks.configs.flat['recommended-latest'],
|
|
16
|
+
reactRefresh.configs.vite,
|
|
17
|
+
],
|
|
18
|
+
languageOptions: {
|
|
19
|
+
ecmaVersion: 2020,
|
|
20
|
+
globals: globals.browser,
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
// shadcn/ui components co-locate cva variant helpers with components.
|
|
25
|
+
files: ['src/components/ui/**/*.{ts,tsx}'],
|
|
26
|
+
rules: {
|
|
27
|
+
'react-refresh/only-export-components': 'off',
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
])
|
package/template/index.html
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
<!doctype html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8" />
|
|
5
|
-
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
|
6
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
-
<title>reactivite-plate</title>
|
|
8
|
-
</head>
|
|
9
|
-
<body>
|
|
10
|
-
<div id="root"></div>
|
|
11
|
-
<script type="module" src="/src/main.tsx"></script>
|
|
12
|
-
</body>
|
|
13
|
-
</html>
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
+
<title>reactivite-plate</title>
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
<div id="root"></div>
|
|
11
|
+
<script type="module" src="/src/main.tsx"></script>
|
|
12
|
+
</body>
|
|
13
|
+
</html>
|