Skip to content

Commit 09dfe9e

Browse files
committed
refactor(createFrontend): clean up index.css and update path resolution
Remove the unnecessary tw-animate-css import from index.css to ensure a cleaner CSS file. Additionally, update the path resolution in the Vite config to use `path.dirname(new URL(import.meta.url).pathname)` for better compatibility and accuracy.
1 parent 9ea039d commit 09dfe9e

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

commands/createFrontend.js

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,22 @@ export default defineConfig({
147147
process.exit(1);
148148
}
149149

150+
// Step 9.5: Clean up index.css (remove tw-animate-css if added by Shadcn)
151+
try {
152+
const indexCssPath = path.join(rootDir, 'src', 'index.css');
153+
let indexCssContent = fs.readFileSync(indexCssPath, 'utf8');
154+
155+
// Remove the tw-animate-css import if it exists
156+
indexCssContent = indexCssContent.replace('@import "tw-animate-css";', '');
157+
158+
// Write the cleaned content back
159+
fs.writeFileSync(indexCssPath, indexCssContent);
160+
console.log('✅ index.css cleaned up.');
161+
} catch (error) {
162+
console.error(`❌ Warning: Could not clean up index.css: ${error.message}`);
163+
// Don't exit on this error, continue with the process
164+
}
165+
150166
// Step 10: Add button component
151167
console.log('📦 Adding button component...');
152168
try {
@@ -339,14 +355,14 @@ export default defineConfig({
339355
import react from '@vitejs/plugin-react-swc'
340356
import tailwindcss from '@tailwindcss/vite'
341357
import path from 'path'
342-
import default from './../eslint.config';
358+
343359
344360
// https://vite.dev/config/
345361
export default defineConfig({
346362
plugins: [react(), tailwindcss()],
347363
resolve: {
348364
alias: {
349-
"@": path.resolve(__dirname, "./src"),
365+
"@": path.resolve(path.dirname(new URL(import.meta.url).pathname), "./src"),
350366
},
351367
},
352368
})`;

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.6",
3+
"version": "2.1.7",
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)