diff --git a/src/generate.js b/src/generate.js index 63b64ee..6ae2b40 100644 --- a/src/generate.js +++ b/src/generate.js @@ -5,6 +5,12 @@ import ora from 'ora'; import tiged from 'tiged'; import Handlebars from 'handlebars'; import { execSync } from 'child_process'; +import { resolveDependencies } from './dependencies.js'; + +// Register custom Handlebars helpers +Handlebars.registerHelper('eq', function (a, b) { + return a === b; +}); // Helper function to recursively find all files in a directory function getAllFiles(dirPath, arrayOfFiles = []) { @@ -68,7 +74,7 @@ export async function generateProject(config) { const allFiles = getAllFiles(projectPath); for (const file of allFiles) { - if (file.match(/\.(tsx|ts|json|md|html|css)$/)) { + if (file.match(/\.(tsx|ts|json|md|html|css|mjs)$/)) { let content = fs.readFileSync(file, 'utf-8'); if (content.includes('{{')) { const template = Handlebars.compile(content); @@ -83,7 +89,10 @@ export async function generateProject(config) { const configFilePath = path.join(projectPath, 'opusify.config.json'); fs.writeFileSync(configFilePath, JSON.stringify(config, null, 2)); - // 5. AUTOMATION PHASE: Install Dependencies + // 5. Resolve dynamic dependencies based on user choices + resolveDependencies(projectPath, config); + + // 6. AUTOMATION PHASE: Install Dependencies const installSpinner = ora('Installing dependencies (this might take a minute)...').start(); try { execSync('npm install', { cwd: projectPath, stdio: 'pipe' }); @@ -92,7 +101,7 @@ export async function generateProject(config) { installSpinner.fail('Could not install dependencies. You may need to run npm install manually.'); } - // 6. Git Initialization + // 7. Git Initialization if (config.initGit) { const gitSpinner = ora('Initializing Git repository...').start(); try { diff --git a/templates/ecommerce/nextjs-monolith/app/layout.tsx b/templates/ecommerce/nextjs-monolith/app/layout.tsx index d4c0344..f51a6dc 100644 --- a/templates/ecommerce/nextjs-monolith/app/layout.tsx +++ b/templates/ecommerce/nextjs-monolith/app/layout.tsx @@ -1,6 +1,10 @@ import type { Metadata } from 'next'; import Link from 'next/link'; import './globals.css'; +import AnimationProvider from '../components/AnimationProvider'; +{{#if (eq design "Dark Terminal")}} +import { Terminal } from 'lucide-react'; +{{/if}} export const metadata: Metadata = { title: '{{projectName}} - Store', @@ -18,7 +22,10 @@ function Navbar() { return (