create-base-react-app 2.0.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.
Files changed (4) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +128 -0
  3. package/index.js +497 -0
  4. package/package.json +50 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Akshay Yadav
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,128 @@
1
+ # create-base-react-app
2
+
3
+ A modern React starter CLI powered by:
4
+
5
+ - React 19
6
+ - Vite 8
7
+ - Rolldown
8
+ - Tailwind CSS v4
9
+ - React Compiler
10
+ - Bun-powered ultra fast installs
11
+ - JavaScript & TypeScript support
12
+
13
+ ---
14
+
15
+ ## Features
16
+
17
+ - ⚡ Extremely fast project setup using Bun
18
+ - ⚛️ React 19 ready
19
+ - 🎨 Tailwind CSS v4 configured
20
+ - 🚀 Vite 8 + Rolldown
21
+ - 🧠 React Compiler enabled
22
+ - 📦 npm compatible (`package-lock.json` generated)
23
+ - 🔥 Modern ESLint setup
24
+ - 🟦 TypeScript support
25
+ - 🟨 JavaScript support
26
+
27
+ ---
28
+
29
+ ## Usage
30
+
31
+ ### Create TypeScript app (default)
32
+
33
+ ```bash
34
+ npx create-base-react-app my-app
35
+ ```
36
+
37
+ or
38
+
39
+ ```bash
40
+ npx create-base-react-app my-app --ts
41
+ ```
42
+
43
+ ---
44
+
45
+ ### Create JavaScript app
46
+
47
+ ```bash
48
+ npx create-base-react-app my-app --js
49
+ ```
50
+
51
+ ---
52
+
53
+ ## Run Project
54
+
55
+ ```bash
56
+ cd my-app
57
+ npm run dev
58
+ ```
59
+
60
+ ---
61
+
62
+ ## Generated Stack
63
+
64
+ ### TypeScript Template
65
+
66
+ - React 19
67
+ - TypeScript 6
68
+ - Vite 8
69
+ - Rolldown
70
+ - Tailwind CSS v4
71
+ - React Compiler
72
+ - ESLint
73
+
74
+ ### JavaScript Template
75
+
76
+ - React 19
77
+ - Vite 8
78
+ - Rolldown
79
+ - Tailwind CSS v4
80
+ - React Compiler
81
+ - ESLint
82
+
83
+ ---
84
+
85
+ ## Why This CLI?
86
+
87
+ Most React starters are:
88
+ - outdated
89
+ - slow
90
+ - overconfigured
91
+ - still using old Tailwind/PostCSS setups
92
+
93
+ `create-base-react-app` gives you a clean modern setup with the latest tooling and near-instant installs using Bun.
94
+
95
+ ---
96
+
97
+ ## Examples
98
+
99
+ ### TypeScript
100
+
101
+ ```bash
102
+ npx create-base-react-app dashboard-app
103
+ ```
104
+
105
+ ### JavaScript
106
+
107
+ ```bash
108
+ npx create-base-react-app landing-page --js
109
+ ```
110
+
111
+ ---
112
+
113
+ ## Tech
114
+
115
+ Built with:
116
+
117
+ - React
118
+ - Vite
119
+ - Rolldown
120
+ - Tailwind CSS
121
+ - Bun
122
+ - ESLint
123
+
124
+ ---
125
+
126
+ ## License
127
+
128
+ MIT
package/index.js ADDED
@@ -0,0 +1,497 @@
1
+ #!/usr/bin/env node
2
+ import { execSync } from "child_process";
3
+ import fs from "fs";
4
+ import path from "path";
5
+
6
+ const args = process.argv.slice(2);
7
+
8
+ const projectName =
9
+ args.find((arg) => !arg.startsWith("--")) || ".";
10
+
11
+ const flags = args.filter((arg) =>
12
+ arg.startsWith("--"),
13
+ );
14
+
15
+ const isTS = flags.includes("--ts");
16
+ const isJS = flags.includes("--js");
17
+
18
+ const useTypeScript = isTS || !isJS;
19
+
20
+ const projectPath =
21
+ projectName === "."
22
+ ? process.cwd()
23
+ : path.join(process.cwd(), projectName);
24
+
25
+ if (
26
+ projectName !== "." &&
27
+ fs.existsSync(projectPath)
28
+ ) {
29
+ console.error(
30
+ `Error: The folder '${projectName}' already exists!`,
31
+ );
32
+
33
+ process.exit(1);
34
+ }
35
+
36
+ if (projectName !== ".") {
37
+ fs.mkdirSync(projectPath);
38
+ }
39
+
40
+ console.log(
41
+ `Creating ${
42
+ useTypeScript
43
+ ? "React + TypeScript"
44
+ : "React + JavaScript"
45
+ } app in ${projectPath}...`,
46
+ );
47
+
48
+ process.chdir(projectPath);
49
+
50
+ const runCommand = (command) =>
51
+ execSync(command, {
52
+ stdio: "inherit",
53
+ });
54
+
55
+ try {
56
+ runCommand("npm init -y");
57
+
58
+ const packageJsonPath = path.join(
59
+ projectPath,
60
+ "package.json",
61
+ );
62
+
63
+ const packageJson = JSON.parse(
64
+ fs.readFileSync(packageJsonPath, "utf-8"),
65
+ );
66
+
67
+ packageJson.name =
68
+ projectName === "."
69
+ ? path.basename(projectPath)
70
+ : projectName;
71
+
72
+ packageJson.private = true;
73
+
74
+ packageJson.version = "0.0.0";
75
+
76
+ packageJson.type = "module";
77
+
78
+ packageJson.scripts = {
79
+ dev: "vite",
80
+ build: "vite build",
81
+ lint: "eslint .",
82
+ preview: "vite preview",
83
+ };
84
+
85
+ packageJson.dependencies = {
86
+ react: "^19.2.6",
87
+ "react-dom": "^19.2.6",
88
+ };
89
+
90
+ if (useTypeScript) {
91
+ packageJson.devDependencies = {
92
+ "@babel/core": "^7.29.0",
93
+ "@eslint/js": "^10.0.1",
94
+ "@rolldown/plugin-babel": "^0.2.3",
95
+ "@tailwindcss/vite": "^4.1.7",
96
+ "@types/babel__core": "^7.20.5",
97
+ "@types/node": "^24.12.3",
98
+ "@types/react": "^19.2.14",
99
+ "@types/react-dom": "^19.2.3",
100
+ "@vitejs/plugin-react": "^6.0.1",
101
+ "babel-plugin-react-compiler":
102
+ "^1.0.0",
103
+ eslint: "^10.3.0",
104
+ "eslint-plugin-react-hooks":
105
+ "^7.1.1",
106
+ "eslint-plugin-react-refresh":
107
+ "^0.5.2",
108
+ globals: "^17.6.0",
109
+ tailwindcss: "^4.1.7",
110
+ typescript: "~6.0.2",
111
+ "typescript-eslint": "^8.59.2",
112
+ vite: "^8.0.12",
113
+ };
114
+ } else {
115
+ packageJson.devDependencies = {
116
+ "@babel/core": "^7.29.0",
117
+ "@eslint/js": "^10.0.1",
118
+ "@rolldown/plugin-babel": "^0.2.3",
119
+ "@tailwindcss/vite": "^4.1.7",
120
+ "@types/react": "^19.2.14",
121
+ "@types/react-dom": "^19.2.3",
122
+ "@vitejs/plugin-react": "^6.0.1",
123
+ "babel-plugin-react-compiler":
124
+ "^1.0.0",
125
+ eslint: "^10.3.0",
126
+ "eslint-plugin-react-hooks":
127
+ "^7.1.1",
128
+ "eslint-plugin-react-refresh":
129
+ "^0.5.2",
130
+ globals: "^17.6.0",
131
+ tailwindcss: "^4.1.7",
132
+ vite: "^8.0.12",
133
+ };
134
+ }
135
+
136
+ fs.writeFileSync(
137
+ packageJsonPath,
138
+ JSON.stringify(packageJson, null, 2),
139
+ );
140
+
141
+ ["public", "src", "src/assets"].forEach(
142
+ (dir) => {
143
+ fs.mkdirSync(
144
+ path.join(projectPath, dir),
145
+ {
146
+ recursive: true,
147
+ },
148
+ );
149
+ },
150
+ );
151
+
152
+ const files = useTypeScript
153
+ ? {
154
+ "src/App.tsx": `function App() {
155
+ return (
156
+ <div className="min-h-screen flex items-center justify-center bg-black text-white">
157
+ <h1 className="text-5xl font-bold">
158
+ React + TypeScript + Tailwind v4
159
+ </h1>
160
+ </div>
161
+ );
162
+ }
163
+
164
+ export default App;
165
+ `,
166
+
167
+ "src/main.tsx": `import React from 'react';
168
+ import ReactDOM from 'react-dom/client';
169
+ import './index.css';
170
+ import App from './App.tsx';
171
+
172
+ ReactDOM.createRoot(document.getElementById('root')!).render(
173
+ <React.StrictMode>
174
+ <App />
175
+ </React.StrictMode>,
176
+ );
177
+ `,
178
+
179
+ "src/index.css": `@import "tailwindcss";
180
+ `,
181
+
182
+ "vite.config.ts": `import { defineConfig } from 'vite';
183
+ import react, { reactCompilerPreset } from '@vitejs/plugin-react';
184
+ import babel from '@rolldown/plugin-babel';
185
+ import tailwindcss from '@tailwindcss/vite';
186
+
187
+ export default defineConfig({
188
+ plugins: [
189
+ react(),
190
+ babel({
191
+ presets: [reactCompilerPreset()],
192
+ }),
193
+ tailwindcss(),
194
+ ],
195
+ });
196
+ `,
197
+
198
+ "tsconfig.json": `{
199
+ "files": [],
200
+ "references": [
201
+ { "path": "./tsconfig.app.json" },
202
+ { "path": "./tsconfig.node.json" }
203
+ ]
204
+ }
205
+ `,
206
+
207
+ "tsconfig.app.json": `{
208
+ "compilerOptions": {
209
+ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
210
+ "target": "es2023",
211
+ "lib": ["ES2023", "DOM"],
212
+ "module": "esnext",
213
+ "types": ["vite/client"],
214
+ "skipLibCheck": true,
215
+ "moduleResolution": "bundler",
216
+ "allowImportingTsExtensions": true,
217
+ "verbatimModuleSyntax": true,
218
+ "moduleDetection": "force",
219
+ "noEmit": true,
220
+ "jsx": "react-jsx",
221
+ "noUnusedLocals": true,
222
+ "noUnusedParameters": true,
223
+ "erasableSyntaxOnly": true,
224
+ "noFallthroughCasesInSwitch": true
225
+ },
226
+ "include": ["src"]
227
+ }
228
+ `,
229
+
230
+ "tsconfig.node.json": `{
231
+ "compilerOptions": {
232
+ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
233
+ "target": "es2023",
234
+ "lib": ["ES2023"],
235
+ "module": "esnext",
236
+ "types": ["node"],
237
+ "skipLibCheck": true,
238
+ "moduleResolution": "bundler",
239
+ "allowImportingTsExtensions": true,
240
+ "verbatimModuleSyntax": true,
241
+ "moduleDetection": "force",
242
+ "noEmit": true,
243
+ "noUnusedLocals": true,
244
+ "noUnusedParameters": true,
245
+ "erasableSyntaxOnly": true,
246
+ "noFallthroughCasesInSwitch": true
247
+ },
248
+ "include": ["vite.config.ts"]
249
+ }
250
+ `,
251
+
252
+ "eslint.config.js": `import js from '@eslint/js';
253
+ import globals from 'globals';
254
+ import reactHooks from 'eslint-plugin-react-hooks';
255
+ import reactRefresh from 'eslint-plugin-react-refresh';
256
+ import tseslint from 'typescript-eslint';
257
+ import {
258
+ defineConfig,
259
+ globalIgnores,
260
+ } from 'eslint/config';
261
+
262
+ export default defineConfig([
263
+ globalIgnores(['dist']),
264
+ {
265
+ files: ['**/*.{ts,tsx}'],
266
+ extends: [
267
+ js.configs.recommended,
268
+ tseslint.configs.recommended,
269
+ reactHooks.configs.flat.recommended,
270
+ reactRefresh.configs.vite,
271
+ ],
272
+ languageOptions: {
273
+ globals: globals.browser,
274
+ },
275
+ },
276
+ ]);
277
+ `,
278
+
279
+ "index.html": `<!doctype html>
280
+ <html lang="en">
281
+ <head>
282
+ <meta charset="UTF-8" />
283
+ <meta
284
+ name="viewport"
285
+ content="width=device-width, initial-scale=1.0"
286
+ />
287
+ <title>React App</title>
288
+ </head>
289
+
290
+ <body>
291
+ <div id="root"></div>
292
+
293
+ <script
294
+ type="module"
295
+ src="/src/main.tsx"
296
+ ></script>
297
+ </body>
298
+ </html>
299
+ `,
300
+ }
301
+ : {
302
+ "src/App.jsx": `function App() {
303
+ return (
304
+ <div className="min-h-screen flex items-center justify-center bg-black text-white">
305
+ <h1 className="text-5xl font-bold">
306
+ React + JavaScript + Tailwind v4
307
+ </h1>
308
+ </div>
309
+ );
310
+ }
311
+
312
+ export default App;
313
+ `,
314
+
315
+ "src/main.jsx": `import React from 'react';
316
+ import ReactDOM from 'react-dom/client';
317
+ import './index.css';
318
+ import App from './App.jsx';
319
+
320
+ ReactDOM.createRoot(document.getElementById('root')).render(
321
+ <React.StrictMode>
322
+ <App />
323
+ </React.StrictMode>,
324
+ );
325
+ `,
326
+
327
+ "src/index.css": `@import "tailwindcss";
328
+ `,
329
+
330
+ "vite.config.js": `import { defineConfig } from 'vite';
331
+ import react, { reactCompilerPreset } from '@vitejs/plugin-react';
332
+ import babel from '@rolldown/plugin-babel';
333
+ import tailwindcss from '@tailwindcss/vite';
334
+
335
+ export default defineConfig({
336
+ plugins: [
337
+ react(),
338
+ babel({
339
+ presets: [reactCompilerPreset()],
340
+ }),
341
+ tailwindcss(),
342
+ ],
343
+ });
344
+ `,
345
+
346
+ "eslint.config.js": `import js from '@eslint/js';
347
+ import globals from 'globals';
348
+ import reactHooks from 'eslint-plugin-react-hooks';
349
+ import reactRefresh from 'eslint-plugin-react-refresh';
350
+
351
+ export default [
352
+ {
353
+ ignores: ['dist'],
354
+ },
355
+ {
356
+ files: ['**/*.{js,jsx}'],
357
+ languageOptions: {
358
+ ecmaVersion: 'latest',
359
+ sourceType: 'module',
360
+ globals: globals.browser,
361
+ parserOptions: {
362
+ ecmaFeatures: {
363
+ jsx: true,
364
+ },
365
+ },
366
+ },
367
+ plugins: {
368
+ 'react-hooks': reactHooks,
369
+ 'react-refresh': reactRefresh,
370
+ },
371
+ rules: {
372
+ ...js.configs.recommended.rules,
373
+ ...reactHooks.configs.recommended.rules,
374
+ 'react-refresh/only-export-components': [
375
+ 'warn',
376
+ { allowConstantExport: true },
377
+ ],
378
+ },
379
+ },
380
+ ];
381
+ `,
382
+
383
+ "index.html": `<!doctype html>
384
+ <html lang="en">
385
+ <head>
386
+ <meta charset="UTF-8" />
387
+ <meta
388
+ name="viewport"
389
+ content="width=device-width, initial-scale=1.0"
390
+ />
391
+ <title>React App</title>
392
+ </head>
393
+
394
+ <body>
395
+ <div id="root"></div>
396
+
397
+ <script
398
+ type="module"
399
+ src="/src/main.jsx"
400
+ ></script>
401
+ </body>
402
+ </html>
403
+ `,
404
+ };
405
+
406
+ const sharedFiles = {
407
+ ".gitignore": `node_modules
408
+ dist
409
+ .DS_Store
410
+ .vscode
411
+ .idea
412
+ `,
413
+
414
+ "README.md": `# ${
415
+ useTypeScript
416
+ ? "React + TypeScript"
417
+ : "React + JavaScript"
418
+ } + Vite
419
+
420
+ Modern React starter powered by:
421
+
422
+ - React 19
423
+ - Vite 8
424
+ - Rolldown
425
+ - Tailwind CSS v4
426
+ - React Compiler
427
+ - ESLint
428
+ `,
429
+ };
430
+
431
+ Object.entries({
432
+ ...files,
433
+ ...sharedFiles,
434
+ }).forEach(([filePath, content]) => {
435
+ fs.writeFileSync(
436
+ path.join(projectPath, filePath),
437
+ content,
438
+ );
439
+ });
440
+
441
+ try {
442
+ execSync("bun --version", {
443
+ stdio: "ignore",
444
+ });
445
+
446
+ console.log(
447
+ "Bun is installed. Running 'bun install'...",
448
+ );
449
+
450
+ runCommand("bun install");
451
+ } catch {
452
+ console.log("Bun not found. Installing...");
453
+
454
+ runCommand("npm install -g bun");
455
+
456
+ runCommand("bun install");
457
+ }
458
+
459
+ ["bun.lock", "bun.lockb"].forEach(
460
+ (file) => {
461
+ const lockPath = path.join(
462
+ projectPath,
463
+ file,
464
+ );
465
+
466
+ if (fs.existsSync(lockPath)) {
467
+ fs.unlinkSync(lockPath);
468
+ }
469
+ },
470
+ );
471
+
472
+ runCommand(
473
+ "npm install --package-lock-only",
474
+ );
475
+
476
+ console.log("");
477
+ console.log(
478
+ "Project setup complete!",
479
+ );
480
+ console.log("");
481
+
482
+ if (projectName === ".") {
483
+ console.log("Run:");
484
+ console.log("npm run dev");
485
+ } else {
486
+ console.log("Run:");
487
+ console.log(`cd ${projectName}`);
488
+ console.log("npm run dev");
489
+ }
490
+ } catch (error) {
491
+ console.error(
492
+ "Error setting up project:",
493
+ error,
494
+ );
495
+
496
+ process.exit(1);
497
+ }
package/package.json ADDED
@@ -0,0 +1,50 @@
1
+ {
2
+ "name": "create-base-react-app",
3
+ "version": "2.0.0",
4
+ "main": "index.js",
5
+ "bin": {
6
+ "create-react-js-tailwind": "./index.js"
7
+ },
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "https://github.com/akshaywritescode/create-react-js-tailwind.git"
11
+ },
12
+ "scripts": {
13
+ "dev": "vite",
14
+ "build": "vite build",
15
+ "lint": "eslint .",
16
+ "preview": "vite preview"
17
+ },
18
+ "keywords": [
19
+ "create-react-app",
20
+ "tailwind boilerplate",
21
+ "react boilerplate",
22
+ "react",
23
+ "tailwind",
24
+ "vite",
25
+ "JSX",
26
+ "react tailwind",
27
+ "react + tailwind"
28
+ ],
29
+ "author": "",
30
+ "license": "ISC",
31
+ "dependencies": {
32
+ "react": "^18.2.0",
33
+ "react-dom": "^18.2.0"
34
+ },
35
+ "devDependencies": {
36
+ "@eslint/js": "^9.17.0",
37
+ "@types/react": "^18.3.17",
38
+ "@types/react-dom": "^18.3.5",
39
+ "@vitejs/plugin-react-swc": "^3.5.0",
40
+ "eslint": "^9.17.0",
41
+ "eslint-plugin-react": "^7.37.2",
42
+ "eslint-plugin-react-hooks": "^5.0.0",
43
+ "eslint-plugin-react-refresh": "^0.4.16",
44
+ "globals": "^15.13.0",
45
+ "vite": "^6.0.3",
46
+ "tailwindcss": "^3.0.0",
47
+ "postcss": "^8.4.6",
48
+ "autoprefixer": "^10.4.4"
49
+ }
50
+ }