Skip to content

Commit 971759f

Browse files
committed
Update README and project files to support React v19 and Tailwind CSS v4; switch frontend setup to Vite
1 parent adaee43 commit 971759f

File tree

4 files changed

+40
-26
lines changed

4 files changed

+40
-26
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
This tool eliminates the need for manual configurations, boilerplate code copying, and repetitive tasks, allowing developers to start building their apps right away with best practices in place. Perfect for both beginners and experienced developers, it saves time and ensures a solid project foundation.
1818

19+
### It complies with latest React v19 and tailwindcss v4
20+
1921
## ✨ Features
2022

2123
- **One Command Setup**: Generate both frontend and backend with a single command
@@ -137,6 +139,11 @@ npm start # Start React App
137139

138140
Option:
139141

142+
To create only backend directory.
143+
```bash
144+
devcli create my_backend --backend
145+
```
146+
140147
```bash
141148
devcli create my_project --next
142149
```

commands/createMERNProject.js

Lines changed: 31 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,7 @@ Create a \`.env\` file based on \`.env.example\`.`
277277
);
278278
}
279279

280+
const frontendDir = path.join(rootDir, 'frontend');
280281
// Install backend dependencies
281282
console.log('📦 Installing backend dependencies...');
282283
try {
@@ -289,37 +290,39 @@ Create a \`.env\` file based on \`.env.example\`.`
289290
process.exit(1);
290291
}
291292

292-
// Create frontend using create-react-app
293-
console.log('📦 Creating React frontend app...');
294-
const frontendDir = path.join(rootDir, 'frontend');
295-
try {
296-
execSync(`npx create-react-app "${frontendDir}"`, { stdio: 'inherit' });
297-
console.log('✅ React frontend created successfully.');
298-
} catch (error) {
299-
console.error(`❌ Failed to create React app: ${error.message}`);
300-
process.exit(1);
301-
}
302-
303-
// Create frontend .env.example
293+
// Create frontend using Vite
294+
console.log('📦 Creating React frontend app with Vite...');
304295
try {
296+
// Ensure frontend directory exists and is empty
297+
fs.emptyDirSync(frontendDir);
298+
299+
// Use npm create vite to generate the project
300+
execSync(`npm create vite@latest frontend -- --template react`, {
301+
cwd: rootDir,
302+
stdio: 'inherit',
303+
});
304+
305+
// Install dependencies
306+
console.log('📦 Installing frontend dependencies...');
307+
execSync('npm install', {
308+
cwd: frontendDir,
309+
stdio: 'inherit',
310+
});
311+
console.log('✅ Frontend dependencies installed.');
312+
313+
// Create .env.example
305314
fs.writeFileSync(
306315
path.join(frontendDir, '.env.example'),
307316
`# Sample .env file for frontend
308317
REACT_APP_API_URL=http://localhost:5000/api`
309318
);
310319
console.log('✅ Frontend .env.example file created.');
311-
} catch (error) {
312-
console.error(
313-
`❌ Failed to create frontend .env.example file: ${error.message}`
314-
);
315-
process.exit(1);
316-
}
317320

318-
// Final success message
319-
console.log(`\n🎉 MERN project "${projectName}" created successfully!`);
321+
// Final success message
322+
console.log(`\n🎉 MERN project "${projectName}" created successfully!`);
320323

321-
console.log(
322-
`${chalk.green.bold('To get started:')}
324+
console.log(
325+
`${chalk.green.bold('To get started:')}
323326
${chalk.blue(`cd "${projectName}"`)}
324327
325328
${chalk.magenta.bold('Backend:')}
@@ -330,7 +333,11 @@ ${chalk.magenta.bold('Backend:')}
330333
331334
${chalk.magenta.bold('Frontend:')}
332335
${chalk.blue('cd frontend')}
333-
${chalk.yellow('npm start')}`
334-
);
336+
${chalk.yellow('npm run dev')}`
337+
);
338+
} catch (error) {
339+
console.error(`❌ Failed to create frontend: ${error.message}`);
340+
process.exit(1);
341+
}
335342
});
336343
}

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "mern-project-cli",
3-
"version": "2.1.3",
3+
"version": "2.1.4",
44
"description": "A developer-friendly CLI tool that streamlines MERN stack development by automating project setup, database configuration, and boilerplate generation by implementing MVC Architecture. Create production-ready MongoDB, Express, React, and Node.js applications with best practices built-in",
55
"main": "index.js",
66
"type": "module",

0 commit comments

Comments
 (0)