create-reactivite 1.3.0 → 1.6.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 +326 -235
- package/index.js +157 -34
- package/package.json +5 -3
- package/template/package.json +22 -22
- package/template/pnpm-lock.yaml +3274 -3274
- package/template/src/components/author-credit.tsx +25 -25
- package/template2/.env.example +8 -8
- package/template2/.husky/pre-commit +4 -4
- package/template2/.prettierrc +5 -5
- package/template2/README.md +73 -73
- package/template2/__tests__/example.test.ts +20 -20
- package/template2/_gitignore +37 -37
- package/template2/app/[locale]/(private)/dashboard/page.tsx +52 -52
- package/template2/app/[locale]/(public)/login/page.tsx +83 -83
- package/template2/app/[locale]/layout.tsx +58 -58
- package/template2/app/[locale]/locales.ts +10 -10
- package/template2/app/[locale]/page.tsx +38 -38
- package/template2/app/api/clear-session/route.ts +10 -10
- package/template2/app/globals.css +127 -127
- package/template2/app/layout.tsx +7 -7
- package/template2/app/page.tsx +6 -6
- package/template2/components/AuthEventListener.tsx +22 -22
- package/template2/components/author-credit.tsx +25 -25
- package/template2/components/theme-provider.tsx +78 -78
- package/template2/components/ui/button.tsx +60 -60
- package/template2/components/ui/card.tsx +92 -92
- package/template2/components/ui/input.tsx +21 -21
- package/template2/components/ui/label.tsx +24 -24
- package/template2/components/ui/sonner.tsx +40 -40
- package/template2/components.json +22 -22
- package/template2/config/constants.ts +7 -7
- package/template2/config/env.ts +5 -5
- package/template2/contexts/translation-context.tsx +70 -70
- package/template2/eslint.config.mjs +18 -18
- package/template2/hoc/provider.tsx +27 -27
- package/template2/lib/paramsSerializer.ts +40 -40
- package/template2/lib/utils.ts +6 -6
- package/template2/locales/az.json +20 -20
- package/template2/locales/en.json +20 -20
- package/template2/next-env.d.ts +1 -1
- package/template2/next.config.ts +17 -17
- package/template2/orval.config.ts +66 -66
- package/template2/package.json +62 -62
- package/template2/postcss.config.mjs +7 -7
- package/template2/scripts/fix-generated-types.mjs +13 -13
- package/template2/services/generated/.gitkeep +2 -2
- package/template2/services/httpClient/httpClient.ts +70 -70
- package/template2/services/httpClient/orvalMutator.ts +10 -10
- package/template2/store/example-store.tsx +16 -16
- package/template2/store/user-store.tsx +29 -29
- package/template2/testing/msw/handlers/index.ts +6 -6
- package/template2/testing/msw/server.ts +4 -4
- package/template2/tsconfig.json +34 -34
- package/template2/vitest.config.ts +17 -17
- package/template2/vitest.setup.ts +7 -7
- package/template3/README.md +34 -34
- package/template3/_gitignore +16 -16
- package/template3/components.json +21 -0
- package/template3/index.html +8 -2
- package/template3/package-lock.json +3934 -0
- package/template3/package.json +48 -22
- package/template3/postcss.config.mjs +5 -0
- package/template3/rspack.config.mjs +59 -51
- package/template3/src/App.tsx +16 -11
- package/template3/src/components/author-credit.tsx +42 -42
- package/template3/src/components/layout.tsx +59 -0
- package/template3/src/components/matrix-rain.tsx +71 -0
- package/template3/src/components/ui/accordion.tsx +64 -0
- package/template3/src/components/ui/alert-dialog.tsx +196 -0
- package/template3/src/components/ui/alert.tsx +66 -0
- package/template3/src/components/ui/aspect-ratio.tsx +11 -0
- package/template3/src/components/ui/avatar.tsx +107 -0
- package/template3/src/components/ui/badge.tsx +48 -0
- package/template3/src/components/ui/breadcrumb.tsx +109 -0
- package/template3/src/components/ui/button-group.tsx +83 -0
- package/template3/src/components/ui/button.tsx +64 -0
- package/template3/src/components/ui/calendar.tsx +218 -0
- package/template3/src/components/ui/card.tsx +92 -0
- package/template3/src/components/ui/carousel.tsx +241 -0
- package/template3/src/components/ui/chart.tsx +372 -0
- package/template3/src/components/ui/checkbox.tsx +32 -0
- package/template3/src/components/ui/collapsible.tsx +31 -0
- package/template3/src/components/ui/combobox.tsx +310 -0
- package/template3/src/components/ui/command.tsx +184 -0
- package/template3/src/components/ui/context-menu.tsx +252 -0
- package/template3/src/components/ui/dialog.tsx +156 -0
- package/template3/src/components/ui/direction.tsx +22 -0
- package/template3/src/components/ui/drawer.tsx +133 -0
- package/template3/src/components/ui/dropdown-menu.tsx +257 -0
- package/template3/src/components/ui/empty.tsx +104 -0
- package/template3/src/components/ui/field.tsx +248 -0
- package/template3/src/components/ui/form.tsx +165 -0
- package/template3/src/components/ui/hover-card.tsx +42 -0
- package/template3/src/components/ui/input-group.tsx +168 -0
- package/template3/src/components/ui/input-otp.tsx +77 -0
- package/template3/src/components/ui/input.tsx +21 -0
- package/template3/src/components/ui/item.tsx +193 -0
- package/template3/src/components/ui/kbd.tsx +28 -0
- package/template3/src/components/ui/label.tsx +22 -0
- package/template3/src/components/ui/menubar.tsx +276 -0
- package/template3/src/components/ui/native-select.tsx +62 -0
- package/template3/src/components/ui/navigation-menu.tsx +168 -0
- package/template3/src/components/ui/pagination.tsx +127 -0
- package/template3/src/components/ui/popover.tsx +87 -0
- package/template3/src/components/ui/progress.tsx +31 -0
- package/template3/src/components/ui/radio-group.tsx +43 -0
- package/template3/src/components/ui/resizable.tsx +53 -0
- package/template3/src/components/ui/scroll-area.tsx +56 -0
- package/template3/src/components/ui/select.tsx +190 -0
- package/template3/src/components/ui/separator.tsx +26 -0
- package/template3/src/components/ui/sheet.tsx +143 -0
- package/template3/src/components/ui/sidebar.tsx +724 -0
- package/template3/src/components/ui/skeleton.tsx +13 -0
- package/template3/src/components/ui/slider.tsx +61 -0
- package/template3/src/components/ui/sonner.tsx +40 -0
- package/template3/src/components/ui/spinner.tsx +16 -0
- package/template3/src/components/ui/switch.tsx +33 -0
- package/template3/src/components/ui/table.tsx +116 -0
- package/template3/src/components/ui/tabs.tsx +89 -0
- package/template3/src/components/ui/textarea.tsx +18 -0
- package/template3/src/components/ui/toggle-group.tsx +83 -0
- package/template3/src/components/ui/toggle.tsx +47 -0
- package/template3/src/components/ui/tooltip.tsx +55 -0
- package/template3/src/hooks/use-mobile.ts +19 -0
- package/template3/src/index.css +175 -32
- package/template3/src/lib/utils.ts +6 -0
- package/template3/src/main.tsx +10 -10
- package/template3/src/pages/about.tsx +113 -0
- package/template3/src/pages/contact.tsx +111 -0
- package/template3/src/pages/home.tsx +81 -0
- package/template3/tsconfig.json +24 -20
- package/template2/tsconfig.tsbuildinfo +0 -1
package/index.js
CHANGED
|
@@ -15,6 +15,53 @@ const __dirname = path.dirname(__filename);
|
|
|
15
15
|
const cyan = (s) => `\x1b[36m${s}\x1b[0m`;
|
|
16
16
|
const dim = (s) => `\x1b[2m${s}\x1b[0m`;
|
|
17
17
|
|
|
18
|
+
// Mövcud template-lər (CLI seçim + --template flag validasiyası üçün)
|
|
19
|
+
const TEMPLATES = ["template", "template2", "template3"];
|
|
20
|
+
|
|
21
|
+
// 🧩 argv parse — `name` positional + `--template/-t <val>` + `--help/--version`
|
|
22
|
+
const parseArgs = (argv) => {
|
|
23
|
+
const args = { _: [], template: undefined, help: false, version: false };
|
|
24
|
+
for (let i = 0; i < argv.length; i++) {
|
|
25
|
+
const a = argv[i];
|
|
26
|
+
if (a === "--help" || a === "-h") args.help = true;
|
|
27
|
+
else if (a === "--version" || a === "-v") args.version = true;
|
|
28
|
+
else if (a === "--template" || a === "-t") args.template = argv[++i];
|
|
29
|
+
else if (a.startsWith("--template=")) args.template = a.split("=")[1];
|
|
30
|
+
else if (!a.startsWith("-")) args._.push(a);
|
|
31
|
+
}
|
|
32
|
+
return args;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const printHelp = () => {
|
|
36
|
+
console.log(`
|
|
37
|
+
${cyan("create-reactivite")} — scaffold React / Next.js / Rspack apps
|
|
38
|
+
|
|
39
|
+
${dim("Usage:")}
|
|
40
|
+
npx create-reactivite [name] [options]
|
|
41
|
+
|
|
42
|
+
${dim("Options:")}
|
|
43
|
+
-t, --template <name> ${TEMPLATES.join(" | ")}
|
|
44
|
+
-h, --help Show this help
|
|
45
|
+
-v, --version Show version
|
|
46
|
+
|
|
47
|
+
${dim("Examples:")}
|
|
48
|
+
npx create-reactivite my-app
|
|
49
|
+
npx create-reactivite my-app --template template2
|
|
50
|
+
npx create-reactivite .
|
|
51
|
+
`);
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
const getVersion = () => {
|
|
55
|
+
try {
|
|
56
|
+
const pkg = JSON.parse(
|
|
57
|
+
fs.readFileSync(path.join(__dirname, "package.json"), "utf8")
|
|
58
|
+
);
|
|
59
|
+
return pkg.version;
|
|
60
|
+
} catch {
|
|
61
|
+
return "unknown";
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
|
|
18
65
|
// 🧩 Banner — CLI açılışında göstərilir
|
|
19
66
|
const printBanner = () => {
|
|
20
67
|
try {
|
|
@@ -27,42 +74,92 @@ const printBanner = () => {
|
|
|
27
74
|
};
|
|
28
75
|
|
|
29
76
|
(async () => {
|
|
77
|
+
const argv = parseArgs(process.argv.slice(2));
|
|
78
|
+
|
|
79
|
+
// --version / --help erkən çıxış (banner olmadan)
|
|
80
|
+
if (argv.version) {
|
|
81
|
+
console.log(getVersion());
|
|
82
|
+
process.exit(0);
|
|
83
|
+
}
|
|
84
|
+
if (argv.help) {
|
|
85
|
+
printHelp();
|
|
86
|
+
process.exit(0);
|
|
87
|
+
}
|
|
88
|
+
|
|
30
89
|
printBanner();
|
|
31
90
|
|
|
32
|
-
const
|
|
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
|
-
|
|
91
|
+
const nameRegex = /^[a-z0-9-~][a-z0-9-._~]*$/;
|
|
92
|
+
|
|
93
|
+
// 🧩 Layihə adı — argv-dən gəlirsə validasiya et, yoxsa soruş
|
|
94
|
+
let projectName = argv._[0];
|
|
95
|
+
if (projectName !== undefined) {
|
|
96
|
+
if (
|
|
97
|
+
projectName !== "." &&
|
|
98
|
+
projectName !== "./" &&
|
|
99
|
+
!nameRegex.test(projectName)
|
|
100
|
+
) {
|
|
101
|
+
console.error(
|
|
102
|
+
`❌ Invalid project name "${projectName}" (lowercase letters, digits, - . _ ~ only)`
|
|
103
|
+
);
|
|
104
|
+
process.exit(1);
|
|
105
|
+
}
|
|
106
|
+
} else {
|
|
107
|
+
const res = await prompts({
|
|
108
|
+
type: "text",
|
|
109
|
+
name: "projectName",
|
|
110
|
+
message: "Project name:",
|
|
111
|
+
initial: "my-react-app",
|
|
112
|
+
// npm paket adı qaydası: kiçik hərf, rəqəm, - . _ ~ (və `.` current dir)
|
|
113
|
+
validate: (name) =>
|
|
114
|
+
name === "." || name === "./" || nameRegex.test(name)
|
|
115
|
+
? true
|
|
116
|
+
: "Invalid name (lowercase letters, digits, - . _ ~ only)",
|
|
117
|
+
});
|
|
118
|
+
projectName = res.projectName;
|
|
119
|
+
// Ctrl+C name promptunda — çıx
|
|
120
|
+
if (projectName === undefined) {
|
|
121
|
+
console.log("❌ Operation cancelled.");
|
|
122
|
+
process.exit(1);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// 🧩 0. Template — argv-dən gəlirsə validasiya et, yoxsa soruş
|
|
127
|
+
let template = argv.template;
|
|
128
|
+
if (template !== undefined) {
|
|
129
|
+
if (!TEMPLATES.includes(template)) {
|
|
130
|
+
console.error(
|
|
131
|
+
`❌ Unknown template "${template}". Valid: ${TEMPLATES.join(", ")}`
|
|
132
|
+
);
|
|
133
|
+
process.exit(1);
|
|
134
|
+
}
|
|
135
|
+
} else {
|
|
136
|
+
const res = await prompts({
|
|
137
|
+
type: "select",
|
|
138
|
+
name: "template",
|
|
139
|
+
message: "Pick a template:",
|
|
140
|
+
choices: [
|
|
141
|
+
{
|
|
142
|
+
title: "React + Vite (Tailwind v4, shadcn/ui, React Router)",
|
|
143
|
+
value: "template",
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
title:
|
|
147
|
+
"Next.js 16 (App Router, i18n, TanStack Query, orval, Zustand, husky)",
|
|
148
|
+
value: "template2",
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
title: "Rspack (Tailwind v4, shadcn/ui, React Router, Matrix theme)",
|
|
152
|
+
value: "template3",
|
|
153
|
+
},
|
|
154
|
+
],
|
|
155
|
+
initial: 0,
|
|
156
|
+
});
|
|
157
|
+
template = res.template;
|
|
158
|
+
// İstifadəçi seçimi ləğv etdisə (Ctrl+C) — çıx
|
|
159
|
+
if (!template) {
|
|
160
|
+
console.log("❌ Operation cancelled.");
|
|
161
|
+
process.exit(1);
|
|
162
|
+
}
|
|
66
163
|
}
|
|
67
164
|
|
|
68
165
|
// 🧩 1. Target folderı müəyyən edirik
|
|
@@ -108,6 +205,32 @@ const printBanner = () => {
|
|
|
108
205
|
fs.renameSync(gitignoreSrc, path.join(targetPath, ".gitignore"));
|
|
109
206
|
}
|
|
110
207
|
|
|
208
|
+
// 🧩 3a. Layihənin adını target package.json-a yazırıq
|
|
209
|
+
// (template-dən gələn ad `template`/`template2`/`template3` olur)
|
|
210
|
+
const pkgPath = path.join(targetPath, "package.json");
|
|
211
|
+
if (!isCurrentDir && fs.existsSync(pkgPath)) {
|
|
212
|
+
try {
|
|
213
|
+
const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf8"));
|
|
214
|
+
pkg.name = projectName;
|
|
215
|
+
fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + "\n");
|
|
216
|
+
} catch {
|
|
217
|
+
// package.json oxunmadı — keç
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
// 🧩 3b. Köhnə lockfile-ları silirik ki, fresh resolve olsun
|
|
222
|
+
for (const lock of ["pnpm-lock.yaml", "package-lock.json", "yarn.lock"]) {
|
|
223
|
+
const lockPath = path.join(targetPath, lock);
|
|
224
|
+
if (fs.existsSync(lockPath)) fs.rmSync(lockPath);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
// 🧩 3c. git repo init (husky `prepare` skriptinin də işləməsi üçün)
|
|
228
|
+
try {
|
|
229
|
+
await execa("git", ["init"], { cwd: targetPath });
|
|
230
|
+
} catch {
|
|
231
|
+
// git yoxdursa — keç
|
|
232
|
+
}
|
|
233
|
+
|
|
111
234
|
// 🧩 4. Asılılıqları quraşdırırıq
|
|
112
235
|
console.log("📥 Installing dependencies...");
|
|
113
236
|
try {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-reactivite",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "⚡ Scaffold modern frontend projects in seconds — pick a template: React + Vite
|
|
3
|
+
"version": "1.6.0",
|
|
4
|
+
"description": "⚡ Scaffold modern frontend projects in seconds — pick a template: React + Vite, Next.js 16 (App Router), or Rspack. All 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
|
},
|
|
@@ -29,6 +29,8 @@
|
|
|
29
29
|
"keywords": [
|
|
30
30
|
"react",
|
|
31
31
|
"vite",
|
|
32
|
+
"nextjs",
|
|
33
|
+
"rspack",
|
|
32
34
|
"tailwind",
|
|
33
35
|
"tailwindcss",
|
|
34
36
|
"shadcn",
|
|
@@ -51,4 +53,4 @@
|
|
|
51
53
|
"url": "https://github.com/jsznpm"
|
|
52
54
|
},
|
|
53
55
|
"license": "MIT"
|
|
54
|
-
}
|
|
56
|
+
}
|
package/template/package.json
CHANGED
|
@@ -10,44 +10,44 @@
|
|
|
10
10
|
"preview": "vite preview"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@radix-ui/react-accordion": "^1.2.
|
|
14
|
-
"@radix-ui/react-avatar": "^1.
|
|
15
|
-
"@radix-ui/react-checkbox": "^1.3.
|
|
16
|
-
"@radix-ui/react-collapsible": "^1.1.
|
|
17
|
-
"@radix-ui/react-dialog": "^1.1.
|
|
18
|
-
"@radix-ui/react-select": "^2.3.
|
|
19
|
-
"@radix-ui/react-separator": "^1.1.
|
|
20
|
-
"@radix-ui/react-slot": "^1.
|
|
21
|
-
"@radix-ui/react-toggle": "^1.1.
|
|
22
|
-
"@radix-ui/react-tooltip": "^1.2.
|
|
23
|
-
"@tailwindcss/vite": "^4.3.
|
|
13
|
+
"@radix-ui/react-accordion": "^1.2.14",
|
|
14
|
+
"@radix-ui/react-avatar": "^1.2.0",
|
|
15
|
+
"@radix-ui/react-checkbox": "^1.3.5",
|
|
16
|
+
"@radix-ui/react-collapsible": "^1.1.14",
|
|
17
|
+
"@radix-ui/react-dialog": "^1.1.17",
|
|
18
|
+
"@radix-ui/react-select": "^2.3.1",
|
|
19
|
+
"@radix-ui/react-separator": "^1.1.10",
|
|
20
|
+
"@radix-ui/react-slot": "^1.3.0",
|
|
21
|
+
"@radix-ui/react-toggle": "^1.1.12",
|
|
22
|
+
"@radix-ui/react-tooltip": "^1.2.10",
|
|
23
|
+
"@tailwindcss/vite": "^4.3.1",
|
|
24
24
|
"class-variance-authority": "^0.7.1",
|
|
25
25
|
"clsx": "^2.1.1",
|
|
26
26
|
"date-fns": "^4.4.0",
|
|
27
|
-
"lucide-react": "^1.
|
|
27
|
+
"lucide-react": "^1.21.0",
|
|
28
28
|
"next-themes": "^0.4.6",
|
|
29
29
|
"react": "^19.2.7",
|
|
30
30
|
"react-day-picker": "^10.0.1",
|
|
31
31
|
"react-dom": "^19.2.7",
|
|
32
|
-
"react-router": "^
|
|
33
|
-
"recharts": "^3.
|
|
32
|
+
"react-router": "^8.0.1",
|
|
33
|
+
"recharts": "^3.9.0",
|
|
34
34
|
"sonner": "^2.0.7",
|
|
35
35
|
"tailwind-merge": "^3.6.0",
|
|
36
|
-
"tailwindcss": "^4.3.
|
|
36
|
+
"tailwindcss": "^4.3.1"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@eslint/js": "^10.0.1",
|
|
40
|
-
"@types/node": "^
|
|
40
|
+
"@types/node": "^26.0.0",
|
|
41
41
|
"@types/react": "^19.2.17",
|
|
42
42
|
"@types/react-dom": "^19.2.3",
|
|
43
|
-
"@vitejs/plugin-react": "^6.0.
|
|
44
|
-
"eslint": "^10.
|
|
43
|
+
"@vitejs/plugin-react": "^6.0.3",
|
|
44
|
+
"eslint": "^10.5.0",
|
|
45
45
|
"eslint-plugin-react-hooks": "^7.1.1",
|
|
46
|
-
"eslint-plugin-react-refresh": "^0.5.
|
|
47
|
-
"globals": "^17.
|
|
46
|
+
"eslint-plugin-react-refresh": "^0.5.3",
|
|
47
|
+
"globals": "^17.7.0",
|
|
48
48
|
"tw-animate-css": "^1.4.0",
|
|
49
49
|
"typescript": "~6.0.3",
|
|
50
|
-
"typescript-eslint": "^8.
|
|
51
|
-
"vite": "^8.0
|
|
50
|
+
"typescript-eslint": "^8.62.0",
|
|
51
|
+
"vite": "^8.1.0"
|
|
52
52
|
}
|
|
53
53
|
}
|