@teispace/next-maker 1.2.0 → 1.3.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/CHANGELOG.md +7 -0
- package/dist/index.js +154 -104
- package/dist/index.js.map +4 -4
- package/dist/src/commands/setup.d.ts.map +1 -1
- package/dist/src/services/setup/i18n/assets.d.ts +4 -0
- package/dist/src/services/setup/i18n/assets.d.ts.map +1 -0
- package/dist/src/services/setup/i18n/checks.d.ts +6 -0
- package/dist/src/services/setup/i18n/checks.d.ts.map +1 -0
- package/dist/src/services/setup/i18n/index.d.ts +2 -0
- package/dist/src/services/setup/i18n/index.d.ts.map +1 -0
- package/dist/src/services/setup/i18n/injectors.d.ts +6 -0
- package/dist/src/services/setup/i18n/injectors.d.ts.map +1 -0
- package/package.json +1 -1
package/dist/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../src/index.ts", "../src/commands/app.ts", "../src/config/spinner.ts", "../src/prompts/create-app.prompt.ts", "../src/core/files.ts", "../src/core/git.ts", "../src/core/package-manager.ts", "../src/config/output.ts", "../src/config/errorHandlers.ts", "../src/config/utils.ts", "../src/config/index.ts", "../src/services/init/template.service.ts", "../src/services/init/config.service.ts", "../src/config/paths.ts", "../src/config/packages.ts", "../src/services/init/cleanup.service.ts", "../src/services/init/providers.service.ts", "../src/services/init/devtools.service.ts", "../src/commands/feature.ts", "../src/prompts/feature.prompt.ts", "../src/services/feature/detection.service.ts", "../src/services/feature/templates.service.ts", "../src/services/feature/registration.service.ts", "../src/services/common/api-registration.service.ts", "../src/commands/slice.ts", "../src/prompts/slice.prompt.ts", "../src/services/slice/slice.service.ts", "../src/services/slice/detection.service.ts", "../src/commands/service.ts", "../src/prompts/service.prompt.ts", "../src/services/service/service.service.ts", "../src/services/service/detection.service.ts", "../src/commands/setup.ts", "../src/services/setup/dark-theme/index.ts", "../src/services/setup/dark-theme/checks.ts", "../src/services/setup/dark-theme/utils.ts", "../src/services/setup/dark-theme/assets.ts", "../src/services/setup/dark-theme/injectors.ts", "../src/services/setup/redux/index.ts", "../src/services/setup/redux/checks.ts", "../src/services/setup/redux/assets.ts", "../src/services/setup/redux/injectors.ts", "../src/commands/index.ts"],
|
|
4
|
-
"sourcesContent": ["import { Command } from 'commander';\nimport { registerCommands } from './commands/index';\nimport { error, setupCancellationHandlers } from './config';\n\nasync function main() {\n setupCancellationHandlers({ logger: (m: string) => error(m) });\n\n const program = new Command();\n\n program.name('next-maker').description('Teispace Next.js Project Generator').version('1.0.0');\n\n registerCommands(program);\n\n program.parse();\n}\n\nmain().catch((err) => {\n const message =\n err && typeof err === 'object' && 'message' in err ? (err as Error).message : String(err);\n error(`Unexpected error: ${message}`);\n});\n", "import { Command } from 'commander';\nimport path from 'node:path';\nimport pc from 'picocolors';\nimport { startSpinner } from '../config/spinner';\nimport { promptForProjectDetails } from '../prompts/create-app.prompt';\nimport { deleteDirectory, fileExists } from '../core/files';\nimport { initializeGit } from '../core/git';\nimport { installDependencies, runScript } from '../core/package-manager';\nimport { log, printBanner } from '../config';\nimport { cloneTemplate } from '../services/init/template.service';\nimport { configurePackageJson } from '../services/init/config.service';\nimport { cleanupFeatures } from '../services/init/cleanup.service';\nimport { generateRootProvider, generateLayout } from '../services/init/providers.service';\nimport { setupDevTools } from '../services/init/devtools.service';\n\nexport const registerAppCommand = (program: Command) => {\n program\n .command('init')\n .description('Initialize a new Next.js project')\n .argument('[name]', 'Project name')\n .action(async (name) => {\n await createApp(name);\n });\n};\n\nconst createApp = async (initialName?: string): Promise<void> => {\n printBanner();\n log('Welcome to the Teispace Next.js App Creator!');\n log('');\n\n const answers = await promptForProjectDetails(initialName);\n const projectPath = path.resolve(process.cwd(), answers.projectName);\n\n if (fileExists(projectPath)) {\n console.error(pc.red(`Error: Directory ${answers.projectName} already exists.`));\n process.exit(1);\n }\n\n const spinner = startSpinner('Initializing project...');\n\n // Cleanup helper\n const performCleanup = async () => {\n if (fileExists(projectPath)) {\n spinner.stop(); // Stop spinner if running\n console.log(pc.yellow(`\\nCleaning up: Deleting directory ${answers.projectName}...`));\n try {\n await deleteDirectory(projectPath);\n console.log(pc.green('Cleanup successful.'));\n } catch (cleanupErr) {\n console.error(pc.red(`Failed to clean up directory ${answers.projectName}:`), cleanupErr);\n }\n }\n };\n\n // Signal handler\n const handleSignal = async () => {\n console.log(pc.red('\\nProcess interrupted. Cleaning up...'));\n await performCleanup();\n process.exit(1);\n };\n\n // Register signal listeners\n process.on('SIGINT', handleSignal);\n process.on('SIGTERM', handleSignal);\n\n try {\n // 1. Clone template\n await cloneTemplate(projectPath);\n\n // 2. Update package.json\n await configurePackageJson(projectPath, answers);\n\n // 3. Customize Features (Cleanup)\n await cleanupFeatures(projectPath, answers);\n\n // 4. Generate Code (Providers, Layout)\n spinner.text = 'Generating code...';\n await generateRootProvider(projectPath, answers);\n await generateLayout(projectPath, answers);\n\n // 5. Setup DevTools & Community Files\n spinner.text = 'Setting up developer tools...';\n await setupDevTools(projectPath, answers);\n\n // 6. Initialize Git\n spinner.text = 'Initializing Git...';\n // Pass gitRemote to initialize git with remote if provided\n await initializeGit(projectPath, answers.gitRemote);\n\n // 7. Install Dependencies\n spinner.text = 'Installing dependencies...';\n await installDependencies(projectPath, answers.packageManager);\n\n // 8. Format and Lint\n spinner.text = 'Formatting and Linting...';\n await runScript(projectPath, answers.packageManager, 'format');\n await runScript(projectPath, answers.packageManager, 'lint:fix');\n\n // 9. Copy .env.example to .env if requested\n if (answers.copyEnv) {\n spinner.text = 'Creating .env file...';\n const envExamplePath = path.join(projectPath, '.env.example');\n const envPath = path.join(projectPath, '.env');\n if (fileExists(envExamplePath)) {\n const fs = await import('node:fs/promises');\n await fs.copyFile(envExamplePath, envPath);\n }\n }\n\n // Remove signal listeners on success\n process.off('SIGINT', handleSignal);\n process.off('SIGTERM', handleSignal);\n\n spinner.succeed(pc.green(`Project ${answers.projectName} created successfully!`));\n log('');\n log('To get started:');\n log(pc.cyan(` cd ${answers.projectName}`));\n log(\n pc.cyan(\n ` ${answers.packageManager === 'npm' ? 'npm run dev' : answers.packageManager + ' dev'}`,\n ),\n );\n log('');\n } catch (err) {\n spinner.fail('Failed to create project.');\n console.error(err);\n await performCleanup();\n process.exit(1);\n }\n};\n", "import ora, { Ora, Options } from 'ora';\n\n// Create and start a spinner\nexport function startSpinner(text = '', options?: Options): Ora {\n const spinner = ora({ text, ...options });\n spinner.start();\n return spinner;\n}\n\n// Stop a spinner without changing its status\nexport function stopSpinner(spinner: Ora): void {\n spinner.stop();\n}\n\n// Mark spinner as succeeded\nexport function succeedSpinner(spinner: Ora, text?: string): void {\n spinner.succeed(text);\n}\n\n// Mark spinner as failed\nexport function failSpinner(spinner: Ora, text?: string): void {\n spinner.fail(text);\n}\n\n// Run an async function while showing a spinner; auto-succeed/fail\nexport async function withSpinner<T>(\n text: string,\n fn: () => Promise<T>,\n {\n successText,\n failText,\n options,\n }: { successText?: string; failText?: string; options?: Options } = {},\n): Promise<T> {\n const spinner = startSpinner(text, options);\n try {\n const result = await fn();\n spinner.succeed(successText ?? 'Done');\n return result;\n } catch (err) {\n spinner.fail(failText ?? 'Failed');\n throw err;\n }\n}\n\nexport default startSpinner;\n", "import Enquirer from 'enquirer';\nimport { PackageManager } from '../core/package-manager';\n\nconst { prompt } = Enquirer;\n\ntype PromptContext = {\n state?: { answers?: Partial<ProjectPrompts> };\n enquirer?: { answers?: Partial<ProjectPrompts> };\n};\n\nexport interface ProjectPrompts {\n projectName: string;\n description: string;\n author: string;\n version: string;\n packageManager: PackageManager;\n gitRemote: string;\n gitIssues: string;\n gitHomepage: string;\n httpClient: 'axios' | 'fetch' | 'both' | 'none';\n reactSecureStorage?: boolean;\n email: string;\n company: string;\n keepTemplates: boolean;\n darkMode: boolean;\n redux: boolean;\n i18n: boolean;\n communityFiles: string[];\n readme: boolean;\n docker: boolean;\n containerName?: string;\n imageName?: string;\n imageTag?: string;\n ci: boolean;\n preCommitHooks: boolean;\n commitizen: boolean;\n copyEnv: boolean;\n}\n\nexport const promptForProjectDetails = async (initialName?: string): Promise<ProjectPrompts> => {\n const response = await prompt<ProjectPrompts>([\n {\n type: 'input',\n name: 'projectName',\n message: 'What is the project name?',\n initial: initialName || 'my-app',\n skip: !!initialName,\n validate: (value: string) => {\n if (!/^[a-z0-9-_]+$/.test(value)) {\n return 'Project name must be lowercase and contain only alphanumeric characters, hyphens, and underscores.';\n }\n return true;\n },\n },\n {\n type: 'input',\n name: 'description',\n message: 'Project description:',\n initial: 'A Next.js application',\n },\n {\n type: 'input',\n name: 'author',\n message: 'Author:',\n initial: 'Teispace',\n },\n {\n type: 'input',\n name: 'version',\n message: 'Version:',\n initial: '0.1.0',\n validate: (value: string) => {\n if (!/^\\d+\\.\\d+\\.\\d+$/.test(value)) {\n return 'Version must be a valid semantic version (x.y.z).';\n }\n return true;\n },\n },\n {\n type: 'input',\n name: 'email',\n message: 'Support email:',\n initial: 'support@example.com',\n validate: (value: string) => {\n if (!/^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/.test(value)) {\n return 'Please enter a valid email address.';\n }\n return true;\n },\n },\n {\n type: 'select',\n name: 'packageManager',\n message: 'Which package manager would you like to use?',\n choices: ['npm', 'yarn', 'pnpm', 'bun'],\n initial: 1,\n },\n {\n type: 'input',\n name: 'gitRemote',\n message: 'GitHub repository URL (optional):',\n validate: (value: string) => {\n if (!value) return true;\n // GitHub URL patterns: https://github.com/user/repo or git@github.com:user/repo.git\n const httpsPattern = /^https:\\/\\/github\\.com\\/[\\w-]+\\/[\\w.-]+$/;\n const sshPattern = /^git@github\\.com:[\\w-]+\\/[\\w.-]+\\.git$/;\n if (!httpsPattern.test(value) && !sshPattern.test(value)) {\n return 'Please enter a valid GitHub repository URL (e.g., https://github.com/user/repo)';\n }\n return true;\n },\n },\n {\n type: 'confirm',\n name: 'keepTemplates',\n message: 'Do you want to keep GitHub issue and pull request templates?',\n initial: false,\n },\n {\n type: 'select',\n name: 'httpClient',\n message: 'Which HTTP client do you want to use?',\n choices: ['axios', 'fetch', 'both', 'none'],\n initial: 1,\n },\n {\n type: 'confirm',\n name: 'reactSecureStorage',\n message: 'Do you want to include react-secure-storage?',\n initial: true,\n skip: function (this: PromptContext) {\n // Access answers from the prompt instance safely across versions\n const answers = this.state?.answers ?? this.enquirer?.answers ?? {};\n // If HTTP client is selected (not 'none'), we skip this question (it will be auto-included)\n return !!(answers.httpClient && answers.httpClient !== 'none');\n },\n },\n {\n type: 'confirm',\n name: 'darkMode',\n message: 'Do you want to include Dark Mode (Tailwind + next-themes)?',\n initial: true,\n },\n {\n type: 'confirm',\n name: 'redux',\n message: 'Do you want to include Redux Toolkit?',\n initial: true,\n },\n {\n type: 'confirm',\n name: 'i18n',\n message: 'Do you want to include Internationalization (next-intl)?',\n initial: true,\n },\n {\n type: 'multiselect',\n name: 'communityFiles',\n message: 'Select community files to include:',\n choices: [\n { name: 'CODE_OF_CONDUCT.md', value: 'CODE_OF_CONDUCT.md' },\n { name: 'CONTRIBUTING.md', value: 'CONTRIBUTING.md' },\n { name: 'SECURITY.md', value: 'SECURITY.md' },\n ],\n initial: [],\n },\n {\n type: 'confirm',\n name: 'readme',\n message: 'Do you want to create a README.md?',\n initial: true,\n },\n {\n type: 'confirm',\n name: 'docker',\n message: 'Do you want to include Docker configuration?',\n initial: false,\n },\n {\n type: 'input',\n name: 'containerName',\n message: 'Docker Container Name:',\n initial: 'next-app',\n skip: function (this: PromptContext) {\n const answers = this.state?.answers ?? this.enquirer?.answers ?? {};\n return !answers.docker;\n },\n validate: (value: string) => {\n if (!/^[a-zA-Z0-9][a-zA-Z0-9_.-]*$/.test(value)) {\n return 'Invalid Docker container name.';\n }\n return true;\n },\n },\n {\n type: 'input',\n name: 'imageName',\n message: 'Docker Image Name:',\n initial: 'nextjs-starter',\n skip: function (this: PromptContext) {\n const answers = this.state?.answers ?? this.enquirer?.answers ?? {};\n return !answers.docker;\n },\n validate: (value: string) => {\n if (!/^[a-z0-9]+(?:[._-][a-z0-9]+)*$/.test(value)) {\n return 'Invalid Docker image name (must be lowercase).';\n }\n return true;\n },\n },\n {\n type: 'input',\n name: 'imageTag',\n message: 'Docker Image Tag:',\n initial: 'latest',\n skip: function (this: PromptContext) {\n const answers = this.state?.answers ?? this.enquirer?.answers ?? {};\n return !answers.docker;\n },\n validate: (value: string) => {\n if (!/^[a-zA-Z0-9_][a-zA-Z0-9_.-]{0,127}$/.test(value)) {\n return 'Invalid Docker image tag.';\n }\n return true;\n },\n },\n {\n type: 'confirm',\n name: 'ci',\n message: 'Do you want to include GitHub Actions (CI/CD)?',\n initial: false,\n },\n {\n type: 'confirm',\n name: 'preCommitHooks',\n message: 'Do you want to setup pre-commit hooks (Husky, Commitlint, Lint-staged)?',\n initial: true,\n },\n {\n type: 'confirm',\n name: 'commitizen',\n message: 'Do you want to setup Commitizen?',\n initial: true,\n },\n {\n type: 'confirm',\n name: 'copyEnv',\n message: 'Want to copy .env.example to .env?',\n initial: true,\n },\n ] as any);\n\n // Set company to be the same as author\n response.company = response.author;\n\n // Generate git URLs from gitRemote if provided\n if (response.gitRemote && !response.gitHomepage) {\n const baseUrl = response.gitRemote\n .replace('git@github.com:', 'https://github.com/')\n .replace(/\\.git$/, '');\n response.gitHomepage = `${baseUrl}#readme`;\n response.gitIssues = `${baseUrl}/issues`;\n }\n\n return response;\n};\n", "import fs from 'node:fs/promises';\nimport path from 'node:path';\nimport { existsSync } from 'node:fs';\n\nexport const readFile = async (filePath: string): Promise<string> => {\n return fs.readFile(filePath, 'utf-8');\n};\n\nexport const writeFile = async (filePath: string, content: string): Promise<void> => {\n await fs.mkdir(path.dirname(filePath), { recursive: true });\n await fs.writeFile(filePath, content, 'utf-8');\n};\n\nexport const copyFile = async (source: string, destination: string): Promise<void> => {\n await fs.mkdir(path.dirname(destination), { recursive: true });\n await fs.copyFile(source, destination);\n};\n\nexport const deleteFile = async (filePath: string): Promise<void> => {\n if (existsSync(filePath)) {\n await fs.unlink(filePath);\n }\n};\n\nexport const deleteDirectory = async (dirPath: string): Promise<void> => {\n if (existsSync(dirPath)) {\n await fs.rm(dirPath, { recursive: true, force: true });\n }\n};\n\nexport const updateJson = async <T = any>(\n filePath: string,\n update: (json: T) => T,\n): Promise<void> => {\n const content = await readFile(filePath);\n const json = JSON.parse(content) as T;\n const updatedJson = update(json);\n await writeFile(filePath, JSON.stringify(updatedJson, null, 2));\n};\n\nexport const fileExists = (filePath: string): boolean => {\n return existsSync(filePath);\n};\n", "import { exec } from 'node:child_process';\nimport { promisify } from 'node:util';\n\nconst execAsync = promisify(exec);\n\nexport const initializeGit = async (cwd: string, gitRemote?: string): Promise<void> => {\n try {\n // Initialize git repository\n await execAsync('git init', { cwd });\n await execAsync('git add .', { cwd });\n await execAsync('git commit -m \"Initial commit from @teispace/next-maker\"', { cwd });\n\n // Add remote origin if GitHub URL is provided\n if (gitRemote) {\n await execAsync(`git remote add origin ${gitRemote}`, { cwd });\n }\n } catch (error) {\n // Ignore error if git is not installed or fails\n console.warn('Failed to initialize git repository', error);\n }\n};\n\nexport const addRemote = async (cwd: string, url: string): Promise<void> => {\n try {\n await execAsync(`git remote add origin ${url}`, { cwd });\n } catch (error) {\n console.warn('Failed to add remote origin', error);\n }\n};\n\nexport const isGitInstalled = async (): Promise<boolean> => {\n try {\n await execAsync('git --version');\n return true;\n } catch {\n return false;\n }\n};\n", "import { exec } from 'node:child_process';\nimport { promisify } from 'node:util';\n\nconst execAsync = promisify(exec);\n\nexport type PackageManager = 'npm' | 'yarn' | 'pnpm' | 'bun';\n\nexport const installDependencies = async (cwd: string, manager: PackageManager): Promise<void> => {\n const command = `${manager} install`;\n try {\n await execAsync(command, { cwd });\n } catch (error) {\n throw new Error(`Failed to install dependencies with ${manager}: ${error}`);\n }\n};\n\nexport const runScript = async (\n cwd: string,\n manager: PackageManager,\n script: string,\n): Promise<void> => {\n // npm requires 'run' keyword, but yarn/pnpm/bun don't\n const command = manager === 'npm' ? `${manager} run ${script}` : `${manager} ${script}`;\n try {\n await execAsync(command, { cwd });\n } catch (error) {\n // We don't want to fail the whole setup if linting fails, just warn\n console.warn(`Warning: Failed to run script '${script}': ${error}`);\n }\n};\n\nexport const getPackageManager = (): PackageManager => {\n const userAgent = process.env.npm_config_user_agent;\n if (userAgent) {\n if (userAgent.startsWith('yarn')) return 'yarn';\n if (userAgent.startsWith('pnpm')) return 'pnpm';\n if (userAgent.startsWith('bun')) return 'bun';\n }\n return 'npm';\n};\n\nexport const detectPackageManager = async (cwd: string): Promise<PackageManager> => {\n const { existsSync } = await import('node:fs');\n const path = await import('node:path');\n\n // Check for lock files\n if (existsSync(path.join(cwd, 'pnpm-lock.yaml'))) return 'pnpm';\n if (existsSync(path.join(cwd, 'yarn.lock'))) return 'yarn';\n if (existsSync(path.join(cwd, 'bun.lockb'))) return 'bun';\n if (existsSync(path.join(cwd, 'package-lock.json'))) return 'npm';\n\n // Fallback to environment variable\n return getPackageManager();\n};\n\nexport const installPackages = async (\n cwd: string,\n manager: PackageManager,\n packages: string[],\n): Promise<void> => {\n if (packages.length === 0) return;\n\n const installCommand = getInstallCommand(manager);\n const command = `${installCommand} ${packages.join(' ')}`;\n\n try {\n await execAsync(command, { cwd });\n } catch (error) {\n throw new Error(`Failed to install packages with ${manager}: ${error}`);\n }\n};\n\nconst getInstallCommand = (manager: PackageManager): string => {\n switch (manager) {\n case 'npm':\n return 'npm install';\n case 'yarn':\n return 'yarn add';\n case 'pnpm':\n return 'pnpm add';\n case 'bun':\n return 'bun add';\n default:\n return 'npm install';\n }\n};\n\nexport const installPackage = async (cwd: string, packageName: string): Promise<void> => {\n const manager = await detectPackageManager(cwd);\n await installPackages(cwd, manager, [packageName]);\n};\n", "import pc from 'picocolors';\n\n// Define a type for allowed colors explicitly\nexport type Color =\n | 'reset'\n | 'red'\n | 'green'\n | 'yellow'\n | 'blue'\n | 'cyan'\n | 'magenta'\n | 'white'\n | 'gray'\n | 'bright'\n | 'dim';\n\nconst colorMap: Record<Color, (s: string) => string> = {\n reset: (s: string) => s,\n red: pc.red,\n green: pc.green,\n yellow: pc.yellow,\n blue: pc.blue,\n cyan: pc.cyan,\n magenta: pc.magenta,\n white: pc.white,\n gray: pc.gray,\n bright: pc.bold,\n dim: pc.dim,\n};\n\n// Print with color\nexport function print(message: string, color: Color = 'reset'): void {\n const colorFn = colorMap[color] ?? ((text: string) => text);\n console.log(colorFn(message));\n}\n\n// Print section header\nexport function printHeader(title: string): void {\n console.log('');\n print('\u2550'.repeat(60), 'cyan');\n print(` ${title}`, 'bright');\n print('\u2550'.repeat(60), 'cyan');\n console.log('');\n}\n\n// Print success message\nexport function success(message: string): void {\n print(`\u2713 ${message}`, 'green');\n}\n\n// Print error message\nexport function error(message: string): void {\n print(`\u2716 ${message}`, 'red');\n}\n\n// Alias for error\nexport const logError = error;\n\n// Print warning message\nexport function warning(message: string): void {\n print(`\u26A0 ${message}`, 'yellow');\n}\n\n// Print info message\nexport function info(message: string): void {\n print(`\u2139 ${message}`, 'cyan');\n}\n\nexport function log(message: string): void {\n print(message);\n}\n\n// Print banner\nexport function printBanner(): void {\n console.log('');\n print('\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557', 'cyan');\n print('\u2551 \u2551', 'cyan');\n print('\u2551 \uD83D\uDE80 Create Teispace Next.js App \uD83D\uDE80 \u2551', 'cyan');\n print('\u2551 \u2551', 'cyan');\n print('\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D', 'cyan');\n console.log('');\n}\n", "export type SetupOptions = {\n logger?: (msg: string) => void;\n exitOnCancel?: boolean;\n};\n\nexport function setupCancellationHandlers(options?: SetupOptions): () => void {\n const {\n logger = (m: string) => console.error(m),\n exitOnCancel = process.env.NODE_ENV !== 'test',\n } = options ?? {};\n\n const onCancel = (): void => {\n console.log('');\n console.log('');\n logger('Setup cancelled by user');\n console.log('');\n if (exitOnCancel) process.exit(0);\n };\n\n const onUncaught = (err: unknown): void => {\n if (err !== null && typeof err === 'object' && 'code' in err) {\n const maybeErrWithCode = err as { code?: unknown };\n if (maybeErrWithCode.code === 'ERR_USE_AFTER_CLOSE') {\n onCancel();\n return;\n }\n }\n\n // Log uncaught exceptions instead of throwing so the CLI can report\n // the error and exit gracefully when appropriate.\n if (err instanceof Error) {\n logger(`Uncaught exception: ${err.message}`);\n return;\n }\n logger(`Uncaught exception: ${String(err)}`);\n };\n\n const onRejection = (reason: unknown): void => {\n // Log unhandled promise rejections rather than letting them crash the\n // process. This converts the reason to a readable string safely.\n if (reason instanceof Error) {\n logger(`Unhandled promise rejection: ${reason.message}`);\n return;\n }\n logger(`Unhandled promise rejection: ${String(reason)}`);\n };\n\n process.on('SIGINT', onCancel);\n process.on('SIGTERM', onCancel);\n process.on('uncaughtException', onUncaught);\n process.on('unhandledRejection', onRejection as (...args: unknown[]) => void);\n\n // Return a cleanup function to remove listeners (useful in tests).\n return (): void => {\n process.off('SIGINT', onCancel);\n process.off('SIGTERM', onCancel);\n process.off('uncaughtException', onUncaught);\n process.off('unhandledRejection', onRejection as (...args: unknown[]) => void);\n };\n}\n\nexport default setupCancellationHandlers;\n", "export const capitalize = (str: string): string => {\n return str.charAt(0).toUpperCase() + str.slice(1);\n};\n\nexport const kebabToCamel = (str: string): string => {\n return str.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase());\n};\n\nexport const kebabToPascal = (str: string): string => {\n return capitalize(kebabToCamel(str));\n};\n\nexport const camelToKebab = (str: string): string => {\n return str.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();\n};\n", "export * from './output';\nexport * from './errorHandlers';\nexport * from './spinner';\nexport * from './utils';\n\n// Re-export spinner instance\nimport ora from 'ora';\nexport const spinner = ora();\n", "import degit from 'degit';\nimport { startSpinner } from '../../config/spinner';\n\nexport const cloneTemplate = async (projectPath: string): Promise<void> => {\n const spinner = startSpinner('Downloading template...');\n try {\n const emitter = degit('teispace/nextjs-starter', {\n cache: false,\n force: true,\n verbose: true,\n });\n await emitter.clone(projectPath);\n spinner.succeed('Template downloaded successfully.');\n } catch (error) {\n spinner.fail('Failed to download template.');\n throw error;\n }\n};\n", "import path from 'node:path';\nimport { updateJson } from '../../core/files';\nimport { ProjectPrompts } from '../../prompts/create-app.prompt';\nimport { startSpinner } from '../../config/spinner';\nimport { PROJECT_PATHS } from '../../config/paths';\nimport { PACKAGES } from '../../config/packages';\n\nexport const configurePackageJson = async (\n projectPath: string,\n answers: ProjectPrompts,\n): Promise<void> => {\n const spinner = startSpinner('Configuring package.json...');\n try {\n // Generate URLs from GitHub repository URL if provided\n let gitRemote = answers.gitRemote;\n let gitHomepage = answers.gitHomepage;\n let gitIssues = answers.gitIssues;\n\n if (answers.gitRemote) {\n // Convert SSH to HTTPS if needed\n if (answers.gitRemote.startsWith('git@github.com:')) {\n gitRemote = answers.gitRemote\n .replace('git@github.com:', 'https://github.com/')\n .replace(/\\.git$/, '');\n }\n\n // Generate homepage and issues URLs if not provided\n if (!gitHomepage) {\n gitHomepage = `${gitRemote.replace(/\\.git$/, '')}#readme`;\n }\n if (!gitIssues) {\n gitIssues = `${gitRemote.replace(/\\.git$/, '')}/issues`;\n }\n\n // Add .git suffix for repository URL if not present\n if (!gitRemote.endsWith('.git')) {\n gitRemote = `${gitRemote}.git`;\n }\n }\n\n await updateJson(path.join(projectPath, PROJECT_PATHS.PACKAGE_JSON), (pkg) => {\n pkg.name = answers.projectName;\n pkg.version = answers.version;\n pkg.description = answers.description;\n pkg.author = answers.author;\n\n // Remove packageManager field to avoid \"configured to use yarn\" errors\n // and let the user's environment handle it.\n delete pkg.packageManager;\n\n // Handle git-related fields based on whether GitHub URL was provided\n if (answers.gitRemote) {\n if (gitHomepage) pkg.homepage = gitHomepage;\n if (gitIssues) pkg.bugs = { url: gitIssues };\n if (gitRemote) pkg.repository = { type: 'git', url: gitRemote };\n } else {\n // If no GitHub URL provided, remove template's git-related fields\n delete pkg.homepage;\n delete pkg.bugs;\n delete pkg.repository;\n }\n\n // Remove dependencies based on choices\n if (!answers.redux) {\n delete pkg.dependencies[PACKAGES.REDUX_TOOLKIT];\n delete pkg.dependencies[PACKAGES.REACT_REDUX];\n delete pkg.dependencies[PACKAGES.REDUX_PERSIST];\n }\n\n // Handle react-secure-storage\n const keepSecureStorage = answers.httpClient !== 'none' || answers.reactSecureStorage;\n if (!keepSecureStorage) {\n delete pkg.dependencies[PACKAGES.REACT_SECURE_STORAGE];\n }\n if (!answers.i18n) {\n delete pkg.dependencies[PACKAGES.NEXT_INTL];\n }\n if (!answers.darkMode) {\n delete pkg.dependencies[PACKAGES.NEXT_THEMES];\n }\n if (answers.httpClient === 'none') {\n delete pkg.dependencies[PACKAGES.AXIOS];\n } else if (answers.httpClient === 'fetch') {\n delete pkg.dependencies[PACKAGES.AXIOS];\n }\n\n return pkg;\n });\n spinner.succeed('package.json configured.');\n } catch (error) {\n spinner.fail('Failed to configure package.json.');\n throw error;\n }\n};\n", "export const PROJECT_PATHS = {\n // Config\n NEXT_CONFIG: 'next.config.ts',\n TAILWIND_CONFIG: 'tailwind.config.ts',\n POSTCSS_CONFIG: 'postcss.config.mjs',\n ESLINT_CONFIG: 'eslint.config.mjs',\n TS_CONFIG: 'tsconfig.json',\n PACKAGE_JSON: 'package.json',\n ENV_EXAMPLE: '.env.example',\n GITIGNORE: '.gitignore',\n README: 'README.md',\n LICENSE: 'LICENSE',\n CHANGELOG: 'CHANGELOG.md',\n NVM_RC: '.nvmrc',\n NPM_RC: '.npmrc',\n\n // Source\n SRC: 'src',\n APP: 'src/app',\n COMPONENTS: 'src/components',\n LIB: 'src/lib',\n PROVIDERS: 'src/providers',\n STYLES: 'src/styles',\n TYPES: 'src/types',\n UTILS: 'src/lib/utils',\n HOOKS: 'src/hooks',\n SERVICES: 'src/services',\n STORE: 'src/store',\n I18N: 'src/i18n',\n\n // Specific Files\n GLOBALS_CSS: 'src/styles/globals.css',\n ROOT_LAYOUT: 'src/app/layout.tsx',\n ROOT_PAGE: 'src/app/page.tsx',\n ROOT_PROVIDER: 'src/providers/RootProvider.tsx',\n PROVIDERS_INDEX: 'src/providers/index.ts',\n COMPONENTS_INDEX: 'src/components/index.ts',\n TYPES_INDEX: 'src/types/index.ts',\n UTILS_INDEX: 'src/lib/utils/index.ts',\n CONFIG_INDEX: 'src/lib/config/index.ts',\n CONSTANTS: 'src/lib/config/constants.ts',\n APP_LOCALES: 'src/lib/config/app-locales.ts',\n MIDDLEWARE: 'src/middleware.ts',\n PROXY: 'src/proxy.ts',\n I18N_TYPES: 'src/types/i18n.ts',\n\n // Directories to Cleanup\n HTTP_UTILS: 'src/lib/utils/http',\n AXIOS_CLIENT: 'src/lib/utils/http/axios-client',\n FETCH_CLIENT: 'src/lib/utils/http/fetch-client',\n CLIENT_UTILS: 'src/lib/utils/http/client-utils.ts',\n APP_APIS: 'src/lib/config/app-apis.ts',\n STORAGE_SERVICE: 'src/services/storage',\n COUNTER_FEATURE: 'src/features/counter',\n I18N_DIR: 'src/i18n',\n LOCALE_DIR: 'src/app/[locale]',\n ERRORS_DIR: 'src/lib/errors',\n UTILITY_TYPES_DIR: 'src/types/utility',\n COMMON_TYPES_DIR: 'src/types/common',\n HTTP_TYPES: 'src/types/common/http.types.ts',\n GITHUB_DIR: '.github',\n HUSKY_DIR: '.husky',\n STORE_PROVIDER: 'src/providers/StoreProvider.tsx',\n THEME_PROVIDER: 'src/providers/CustomThemeProvider.tsx',\n COUNTER_COMPONENT: 'src/features/counter/components/Counter.tsx',\n LOCALE_PAGE: 'src/app/[locale]/page.tsx',\n\n // Config files\n COMMITLINT_CONFIG: 'commitlint.config.mjs',\n LINTSTAGED_RC: '.lintstagedrc.mjs',\n CZRC: '.czrc',\n DOCKERIGNORE: '.dockerignore',\n DOCKERFILE: 'Dockerfile',\n DOCKER_COMPOSE: 'docker-compose.yml',\n\n // GitHub\n GITHUB_WORKFLOWS: '.github/workflows',\n GITHUB_ISSUE_TEMPLATE: 'ISSUE_TEMPLATE',\n GITHUB_PR_TEMPLATE: 'PULL_REQUEST_TEMPLATE.md',\n\n // Community files\n CODE_OF_CONDUCT: 'CODE_OF_CONDUCT.md',\n CONTRIBUTING: 'CONTRIBUTING.md',\n SECURITY: 'SECURITY.md',\n} as const;\n", "export const PACKAGES = {\n // Dependencies\n REDUX_TOOLKIT: '@reduxjs/toolkit',\n REACT_REDUX: 'react-redux',\n REDUX_PERSIST: 'redux-persist',\n REACT_SECURE_STORAGE: 'react-secure-storage',\n NEXT_INTL: 'next-intl',\n NEXT_THEMES: 'next-themes',\n AXIOS: 'axios',\n\n // Dev Dependencies\n HUSKY: 'husky',\n COMMITLINT_CLI: '@commitlint/cli',\n COMMITLINT_CONFIG: '@commitlint/config-conventional',\n LINT_STAGED: 'lint-staged',\n COMMITIZEN: 'commitizen',\n CZ_CONVENTIONAL_CHANGELOG: 'cz-conventional-changelog',\n} as const;\n", "import path from 'node:path';\nimport { deleteDirectory, deleteFile, fileExists, readFile, writeFile } from '../../core/files';\nimport { ProjectPrompts } from '../../prompts/create-app.prompt';\nimport { startSpinner } from '../../config/spinner';\n\nimport { PROJECT_PATHS } from '../../config/paths';\n\n// ... (imports)\n\nexport const cleanupFeatures = async (\n projectPath: string,\n answers: ProjectPrompts,\n): Promise<void> => {\n const spinner = startSpinner('Customizing features...');\n try {\n await cleanupHttpClient(projectPath, answers);\n await cleanupSecureStorage(projectPath, answers);\n await cleanupRedux(projectPath, answers);\n await cleanupDarkMode(projectPath, answers);\n await cleanupI18n(projectPath, answers);\n await cleanupLicense(projectPath);\n await cleanupChangelog(projectPath);\n await cleanupConfig(projectPath);\n spinner.succeed('Features customized.');\n } catch (error) {\n spinner.fail('Failed to customize features.');\n throw error;\n }\n};\n\nconst cleanupHttpClient = async (projectPath: string, answers: ProjectPrompts): Promise<void> => {\n const httpUtilsPath = path.join(projectPath, PROJECT_PATHS.HTTP_UTILS);\n const keepSecureStorage = answers.httpClient !== 'none' || answers.reactSecureStorage;\n\n if (answers.httpClient === 'none') {\n await deleteDirectory(path.join(projectPath, PROJECT_PATHS.AXIOS_CLIENT));\n await deleteDirectory(path.join(projectPath, PROJECT_PATHS.FETCH_CLIENT));\n\n if (keepSecureStorage) {\n await writeFile(path.join(httpUtilsPath, 'index.ts'), \"export * from './token-store';\\n\");\n // token-store.ts does not use client-utils, so we can remove it\n await deleteFile(path.join(projectPath, PROJECT_PATHS.CLIENT_UTILS));\n } else {\n await deleteDirectory(httpUtilsPath);\n const utilsIndexPath = path.join(projectPath, PROJECT_PATHS.UTILS_INDEX);\n if (fileExists(utilsIndexPath)) {\n let content = await readFile(utilsIndexPath);\n content = content.replace(/export \\* from '\\.\\/http';\\n/, '');\n await writeFile(utilsIndexPath, content);\n }\n\n // Remove app-apis.ts if no client and no secure storage (likely no auth)\n await deleteFile(path.join(projectPath, PROJECT_PATHS.APP_APIS));\n const configIndexPath = path.join(projectPath, PROJECT_PATHS.CONFIG_INDEX);\n if (fileExists(configIndexPath)) {\n let content = await readFile(configIndexPath);\n content = content.replace(/export \\* from '\\.\\/app-apis';\\n/, '');\n await writeFile(configIndexPath, content);\n }\n }\n\n // Remove API constants\n const constantsPath = path.join(projectPath, PROJECT_PATHS.CONSTANTS);\n if (fileExists(constantsPath)) {\n let content = await readFile(constantsPath);\n content = content.replace(/export const API_RESPONSE_DATA_KEY = 'data';\\n/, '');\n content = content.replace(/export const SAVE_AUTH_TOKENS = false;\\n/, '');\n await writeFile(constantsPath, content);\n }\n\n // Remove errors and types\n await deleteDirectory(path.join(projectPath, PROJECT_PATHS.ERRORS_DIR));\n\n // Only remove common types if we don't keep secure storage (TokenStore needs common/http.types.ts)\n if (!keepSecureStorage) {\n await deleteDirectory(path.join(projectPath, PROJECT_PATHS.COMMON_TYPES_DIR));\n await deleteDirectory(path.join(projectPath, PROJECT_PATHS.UTILITY_TYPES_DIR));\n\n // Update types/index.ts\n const typesIndexPath = path.join(projectPath, PROJECT_PATHS.TYPES_INDEX);\n if (fileExists(typesIndexPath)) {\n let content = await readFile(typesIndexPath);\n content = content.replace(/export \\* from '\\.\\/utility';\\n/, '');\n content = content.replace(/export \\* from '\\.\\/common';\\n/, '');\n await writeFile(typesIndexPath, content);\n }\n }\n } else if (answers.httpClient === 'axios') {\n await deleteDirectory(path.join(projectPath, PROJECT_PATHS.FETCH_CLIENT));\n let content = await readFile(path.join(httpUtilsPath, 'index.ts'));\n content = content.replace(/export .* from '\\.\\/fetch-client';\\n/g, '');\n await writeFile(path.join(httpUtilsPath, 'index.ts'), content);\n\n // Remove FetchClientOptions and ExtendedRequestInit from http.types.ts\n const httpTypesPath = path.join(projectPath, PROJECT_PATHS.HTTP_TYPES);\n if (fileExists(httpTypesPath)) {\n let typesContent = await readFile(httpTypesPath);\n // Remove FetchClientOptions interface\n typesContent = typesContent.replace(\n /export interface FetchClientOptions \\{[\\s\\S]*?\\}\\n\\n/,\n '',\n );\n // Remove ExtendedRequestInit interface\n typesContent = typesContent.replace(\n /export interface ExtendedRequestInit extends RequestInit \\{[\\s\\S]*?\\}\\n\\n/,\n '',\n );\n await writeFile(httpTypesPath, typesContent);\n }\n } else if (answers.httpClient === 'fetch') {\n await deleteDirectory(path.join(projectPath, PROJECT_PATHS.AXIOS_CLIENT));\n let content = await readFile(path.join(httpUtilsPath, 'index.ts'));\n content = content.replace(/export .* from '\\.\\/axios-client';\\n/g, '');\n await writeFile(path.join(httpUtilsPath, 'index.ts'), content);\n\n // Remove axios module declaration and AxiosClientOptions from http.types.ts\n const httpTypesPath = path.join(projectPath, PROJECT_PATHS.HTTP_TYPES);\n if (fileExists(httpTypesPath)) {\n let typesContent = await readFile(httpTypesPath);\n // Remove axios module declaration\n typesContent = typesContent.replace(/declare module 'axios' \\{[\\s\\S]*?\\}\\n\\n/, '');\n // Remove AxiosClientOptions interface\n typesContent = typesContent.replace(\n /export interface AxiosClientOptions \\{[\\s\\S]*?\\}\\n\\n/,\n '',\n );\n await writeFile(httpTypesPath, typesContent);\n }\n }\n};\n\nconst cleanupSecureStorage = async (\n projectPath: string,\n answers: ProjectPrompts,\n): Promise<void> => {\n const keepSecureStorage = answers.httpClient !== 'none' || answers.reactSecureStorage;\n if (!keepSecureStorage) {\n await deleteDirectory(path.join(projectPath, PROJECT_PATHS.STORAGE_SERVICE));\n }\n};\n\nconst cleanupRedux = async (projectPath: string, answers: ProjectPrompts): Promise<void> => {\n if (!answers.redux) {\n await deleteDirectory(path.join(projectPath, PROJECT_PATHS.STORE));\n await deleteDirectory(path.join(projectPath, PROJECT_PATHS.COUNTER_FEATURE));\n await deleteFile(path.join(projectPath, PROJECT_PATHS.STORE_PROVIDER));\n\n const providersIndexPath = path.join(projectPath, PROJECT_PATHS.PROVIDERS_INDEX);\n let providersIndexContent = await readFile(providersIndexPath);\n providersIndexContent = providersIndexContent.replace(\n /export \\* from '\\.\\/StoreProvider';\\n/,\n '',\n );\n await writeFile(providersIndexPath, providersIndexContent);\n\n // Cleanup usage in pages\n const pagesToClean = [\n path.join(projectPath, PROJECT_PATHS.ROOT_PAGE),\n path.join(projectPath, PROJECT_PATHS.LOCALE_PAGE),\n ];\n\n for (const pagePath of pagesToClean) {\n if (fileExists(pagePath)) {\n let content = await readFile(pagePath);\n content = content.replace(\n /import\\s+\\{\\s*Counter\\s*\\}\\s+from\\s+['\"]@\\/features\\/counter['\"];\\n?/,\n '',\n );\n content = content.replace(/<Counter\\s*\\/>\\n?/g, '');\n await writeFile(pagePath, content);\n }\n }\n }\n};\n\nconst cleanupDarkMode = async (projectPath: string, answers: ProjectPrompts): Promise<void> => {\n if (!answers.darkMode) {\n await deleteFile(path.join(projectPath, PROJECT_PATHS.THEME_PROVIDER));\n const providersIndexPath = path.join(projectPath, PROJECT_PATHS.PROVIDERS_INDEX);\n let providersIndexContent = await readFile(providersIndexPath);\n providersIndexContent = providersIndexContent.replace(\n /export \\* from '\\.\\/CustomThemeProvider';\\n/,\n '',\n );\n await writeFile(providersIndexPath, providersIndexContent);\n\n const globalsCssPath = path.join(projectPath, PROJECT_PATHS.GLOBALS_CSS);\n if (fileExists(globalsCssPath)) {\n let cssContent = await readFile(globalsCssPath);\n // Remove dark mode custom variant\n cssContent = cssContent.replace(/@custom-variant dark \\(.*?\\);\\n\\n/, '');\n // Remove dark and light color definitions\n cssContent = cssContent.replace(/@theme \\{[\\s\\S]*?\\}\\n/, '');\n await writeFile(globalsCssPath, cssContent);\n }\n\n // Remove dark mode classes from layout if not using i18n\n if (!answers.i18n) {\n const layoutPath = path.join(projectPath, PROJECT_PATHS.ROOT_LAYOUT);\n if (fileExists(layoutPath)) {\n let layoutContent = await readFile(layoutPath);\n layoutContent = layoutContent.replace(/bg-light dark:bg-dark /g, '');\n await writeFile(layoutPath, layoutContent);\n }\n }\n }\n};\n\nconst cleanupI18n = async (projectPath: string, answers: ProjectPrompts): Promise<void> => {\n if (!answers.i18n) {\n await deleteDirectory(path.join(projectPath, PROJECT_PATHS.I18N_DIR));\n await deleteDirectory(path.join(projectPath, PROJECT_PATHS.LOCALE_DIR));\n await deleteFile(path.join(projectPath, PROJECT_PATHS.PROXY));\n await deleteFile(path.join(projectPath, PROJECT_PATHS.MIDDLEWARE));\n await deleteFile(path.join(projectPath, PROJECT_PATHS.I18N_TYPES));\n await deleteFile(path.join(projectPath, PROJECT_PATHS.APP_LOCALES));\n\n const typesIndexPath = path.join(projectPath, PROJECT_PATHS.TYPES_INDEX);\n if (fileExists(typesIndexPath)) {\n let content = await readFile(typesIndexPath);\n content = content.replace(/export \\* from '\\.\\/i18n';\\n/, '');\n await writeFile(typesIndexPath, content);\n }\n\n const configIndexPath = path.join(projectPath, PROJECT_PATHS.CONFIG_INDEX);\n if (fileExists(configIndexPath)) {\n let content = await readFile(configIndexPath);\n content = content.replace(/export \\* from '\\.\\/app-locales';\\n/, '');\n await writeFile(configIndexPath, content);\n }\n\n const nextConfigPath = path.join(projectPath, PROJECT_PATHS.NEXT_CONFIG);\n if (fileExists(nextConfigPath)) {\n let configContent = await readFile(nextConfigPath);\n configContent = configContent.replace(\n /import createNextIntlPlugin from 'next-intl\\/plugin';\\n/,\n '',\n );\n configContent = configContent.replace(/const withNextIntl = createNextIntlPlugin\\(\\);\\n/, '');\n configContent = configContent.replace(\n /export default withNextIntl\\(nextConfig\\);/,\n 'export default nextConfig;',\n );\n await writeFile(nextConfigPath, configContent);\n }\n\n // Cleanup Counter.tsx if Redux is enabled - remove i18n from Counter component\n const counterComponentPath = path.join(projectPath, PROJECT_PATHS.COUNTER_COMPONENT);\n if (fileExists(counterComponentPath)) {\n let content = await readFile(counterComponentPath);\n content = content.replace(\n /import\\s+\\{\\s*useTranslations\\s*\\}\\s+from\\s+['\"]next-intl['\"];\\n/,\n '',\n );\n content = content.replace(/\\s*const\\s+t\\s*=\\s*useTranslations\\(['\"]Count['\"]\\);\\n/, '');\n content = content.replace(/\\{t\\('currentCount',\\s*\\{\\s*count:\\s*value\\s*\\}\\)\\}/g, '{value}');\n content = content.replace(/\\{t\\(['\"]increment['\"]\\)\\}/g, 'Increment');\n content = content.replace(/\\{t\\(['\"]decrement['\"]\\)\\}/g, 'Decrement');\n content = content.replace(/\\{t\\(['\"]reset['\"]\\)\\}/g, 'Reset');\n await writeFile(counterComponentPath, content);\n }\n }\n};\n\nconst cleanupLicense = async (projectPath: string): Promise<void> => {\n await deleteFile(path.join(projectPath, PROJECT_PATHS.LICENSE));\n};\n\nconst cleanupChangelog = async (projectPath: string): Promise<void> => {\n await deleteFile(path.join(projectPath, PROJECT_PATHS.CHANGELOG));\n};\n\nconst cleanupConfig = async (projectPath: string): Promise<void> => {\n await deleteFile(path.join(projectPath, PROJECT_PATHS.NVM_RC));\n await deleteFile(path.join(projectPath, PROJECT_PATHS.NPM_RC));\n};\n", "import path from 'node:path';\nimport { writeFile } from '../../core/files';\nimport { ProjectPrompts } from '../../prompts/create-app.prompt';\nimport { PROJECT_PATHS } from '../../config/paths';\n\nexport const generateRootProvider = async (\n projectPath: string,\n answers: ProjectPrompts,\n): Promise<void> => {\n const imports: string[] = [];\n const providers: string[] = [];\n\n if (answers.redux) {\n imports.push(\"import { StoreProvider } from '@/providers';\");\n providers.push('StoreProvider');\n }\n\n if (answers.darkMode) {\n imports.push(\"import { CustomThemeProvider } from '@/providers';\");\n providers.push('CustomThemeProvider');\n }\n\n if (answers.i18n) {\n imports.push(\"import { NextIntlClientProvider, AbstractIntlMessages } from 'next-intl';\");\n imports.push(\"import { SupportedLocale } from '@/types/i18n';\");\n }\n\n let rootProviderContent = `'use client';\n${imports.join('\\n')}\n\nexport const RootProvider = ({\n children,\n ${answers.i18n ? 'locale,\\n messages,' : ''}\n}: {\n children: React.ReactNode;\n ${answers.i18n ? 'locale: SupportedLocale;\\n messages: AbstractIntlMessages;' : ''}\n}) => {\n return (\n`;\n\n // Build the nesting\n let content = '{children}';\n\n if (answers.i18n) {\n content = `<NextIntlClientProvider locale={locale} messages={messages}>\n ${content}\n </NextIntlClientProvider>`;\n }\n\n if (answers.darkMode) {\n content = `<CustomThemeProvider>\n ${content}\n </CustomThemeProvider>`;\n }\n\n if (answers.redux) {\n content = `<StoreProvider>\n ${content}\n </StoreProvider>`;\n }\n\n // If no providers are wrapped, ensure we return a valid JSX element (Fragment)\n if (content === '{children}') {\n content = `<>{children}</>`;\n }\n\n rootProviderContent += ` ${content}\n );\n};\n`;\n\n await writeFile(path.join(projectPath, PROJECT_PATHS.ROOT_PROVIDER), rootProviderContent);\n};\n\nexport const generateLayout = async (\n projectPath: string,\n answers: ProjectPrompts,\n): Promise<void> => {\n if (!answers.i18n) {\n const basicLayout = `import type { Metadata } from 'next';\nimport '@/styles/globals.css';\nimport { Livvic } from 'next/font/google';\nimport { RootProvider } from '@/providers';\n\nconst livvic = Livvic({\n subsets: ['latin'],\n variable: '--font-livvic',\n weight: ['100', '200', '300', '400', '500', '600', '700', '900'],\n display: 'swap',\n});\n\nexport const metadata: Metadata = {\n title: '${answers.projectName}',\n description: '${answers.description}',\n};\n\nexport default function RootLayout({\n children,\n}: Readonly<{\n children: React.ReactNode;\n}>) {\n return (\n <html lang=\"en\" suppressHydrationWarning={${answers.darkMode ? 'true' : 'false'}}>\n <body className={\\`\\${livvic.variable} ${answers.darkMode ? 'bg-light dark:bg-dark ' : ''}antialiased\\`}>\n <RootProvider>\n {children}\n </RootProvider>\n </body>\n </html>\n );\n}\n`;\n await writeFile(path.join(projectPath, PROJECT_PATHS.ROOT_LAYOUT), basicLayout);\n\n // Generate page.tsx with Counter if Redux is enabled\n const counterImport = answers.redux ? \"import { Counter } from '@/features/counter';\\n\\n\" : '';\n const counterComponent = answers.redux ? '\\n <Counter />' : '';\n\n const basicPage = `${counterImport}export default function Home() {\n return (\n <div className=\"flex min-h-screen flex-col items-center justify-center p-24\">\n <h1 className=\"text-4xl font-bold\">Welcome to ${answers.projectName}</h1>\n <p className=\"mt-4 text-xl\">Get started by editing src/app/page.tsx</p>${counterComponent}\n </div>\n );\n}\n`;\n await writeFile(path.join(projectPath, PROJECT_PATHS.ROOT_PAGE), basicPage);\n }\n};\n", "import path from 'node:path';\nimport { readdir } from 'node:fs/promises';\nimport {\n deleteDirectory,\n deleteFile,\n fileExists,\n readFile,\n updateJson,\n writeFile,\n} from '../../core/files';\nimport { ProjectPrompts } from '../../prompts/create-app.prompt';\nimport { PROJECT_PATHS } from '../../config/paths';\nimport { PACKAGES } from '../../config/packages';\n\nexport const setupDevTools = async (\n projectPath: string,\n answers: ProjectPrompts,\n): Promise<void> => {\n await setupPreCommitHooks(projectPath, answers);\n await setupCommitizen(projectPath, answers);\n await setupCiCd(projectPath, answers);\n await setupGithubTemplates(projectPath, answers);\n await setupCommunityFiles(projectPath, answers);\n await setupDocker(projectPath, answers);\n await setupReadme(projectPath, answers);\n};\n\nconst setupPreCommitHooks = async (projectPath: string, answers: ProjectPrompts): Promise<void> => {\n if (!answers.preCommitHooks) {\n await deleteDirectory(path.join(projectPath, PROJECT_PATHS.HUSKY_DIR));\n await deleteFile(path.join(projectPath, PROJECT_PATHS.COMMITLINT_CONFIG));\n await deleteFile(path.join(projectPath, PROJECT_PATHS.LINTSTAGED_RC));\n\n await updateJson(path.join(projectPath, PROJECT_PATHS.PACKAGE_JSON), (pkg) => {\n delete pkg.devDependencies[PACKAGES.HUSKY];\n delete pkg.devDependencies[PACKAGES.COMMITLINT_CLI];\n delete pkg.devDependencies[PACKAGES.COMMITLINT_CONFIG];\n delete pkg.devDependencies[PACKAGES.LINT_STAGED];\n delete pkg.scripts['prepare'];\n delete pkg.scripts['postinstall'];\n delete pkg.commitlint;\n delete pkg['lint-staged'];\n return pkg;\n });\n }\n};\n\nconst setupCommitizen = async (projectPath: string, answers: ProjectPrompts): Promise<void> => {\n if (!answers.commitizen) {\n await deleteFile(path.join(projectPath, PROJECT_PATHS.CZRC));\n\n await updateJson(path.join(projectPath, PROJECT_PATHS.PACKAGE_JSON), (pkg) => {\n delete pkg.devDependencies[PACKAGES.COMMITIZEN];\n delete pkg.devDependencies[PACKAGES.CZ_CONVENTIONAL_CHANGELOG];\n delete pkg.config?.commitizen;\n if (pkg.config && Object.keys(pkg.config).length === 0) {\n delete pkg.config;\n }\n delete pkg.scripts['commit'];\n return pkg;\n });\n }\n};\n\nconst setupCiCd = async (projectPath: string, answers: ProjectPrompts): Promise<void> => {\n if (!answers.ci) {\n await deleteDirectory(path.join(projectPath, PROJECT_PATHS.GITHUB_WORKFLOWS));\n }\n};\n\nconst setupGithubTemplates = async (\n projectPath: string,\n answers: ProjectPrompts,\n): Promise<void> => {\n const githubPath = path.join(projectPath, PROJECT_PATHS.GITHUB_DIR);\n if (!answers.keepTemplates) {\n await deleteDirectory(path.join(githubPath, PROJECT_PATHS.GITHUB_ISSUE_TEMPLATE));\n await deleteFile(path.join(githubPath, PROJECT_PATHS.GITHUB_PR_TEMPLATE));\n } else {\n const issueTemplatePath = path.join(githubPath, PROJECT_PATHS.GITHUB_ISSUE_TEMPLATE);\n const prTemplatePath = path.join(githubPath, PROJECT_PATHS.GITHUB_PR_TEMPLATE);\n\n const replacePlaceholders = (content: string) => {\n return content\n .replace(/Teispace/g, answers.company)\n .replace(/support@teispace\\.com/g, answers.email)\n .replace(/Next\\.js Starter/g, answers.projectName)\n .replace(/\\[AUTHOR\\]/g, answers.author)\n .replace(/\\[COMPANY\\]/g, answers.company)\n .replace(/\\[EMAIL\\]/g, answers.email);\n };\n\n if (fileExists(prTemplatePath)) {\n let content = await readFile(prTemplatePath);\n content = replacePlaceholders(content);\n await writeFile(prTemplatePath, content);\n }\n\n try {\n if (fileExists(issueTemplatePath)) {\n const files = await readdir(issueTemplatePath);\n for (const file of files) {\n const filePath = path.join(issueTemplatePath, file);\n let content = await readFile(filePath);\n content = replacePlaceholders(content);\n await writeFile(filePath, content);\n }\n }\n } catch {\n // Ignore\n }\n }\n};\n\nconst setupCommunityFiles = async (projectPath: string, answers: ProjectPrompts): Promise<void> => {\n const allCommunityFiles = [\n PROJECT_PATHS.CODE_OF_CONDUCT,\n PROJECT_PATHS.CONTRIBUTING,\n PROJECT_PATHS.SECURITY,\n ];\n for (const file of allCommunityFiles) {\n if (!answers.communityFiles.includes(file)) {\n await deleteFile(path.join(projectPath, file));\n }\n }\n};\n\nconst setupDocker = async (projectPath: string, answers: ProjectPrompts): Promise<void> => {\n if (!answers.docker) {\n await deleteFile(path.join(projectPath, PROJECT_PATHS.DOCKERFILE));\n await deleteFile(path.join(projectPath, PROJECT_PATHS.DOCKER_COMPOSE));\n await deleteFile(path.join(projectPath, PROJECT_PATHS.DOCKERIGNORE));\n\n const envPath = path.join(projectPath, PROJECT_PATHS.ENV_EXAMPLE);\n if (fileExists(envPath)) {\n let envContent = await readFile(envPath);\n envContent = envContent.replace(/# Docker Compose Configuration\\n/, '');\n envContent = envContent.replace(/CONTAINER_NAME=.*\\n/, '');\n envContent = envContent.replace(/IMAGE_NAME=.*\\n/, '');\n envContent = envContent.replace(/IMAGE_TAG=.*\\n/, '');\n await writeFile(envPath, envContent);\n }\n } else {\n const envPath = path.join(projectPath, PROJECT_PATHS.ENV_EXAMPLE);\n if (fileExists(envPath)) {\n let envContent = await readFile(envPath);\n const updateEnvVar = (key: string, value: string) => {\n const regex = new RegExp(`${key}=.*`);\n if (regex.test(envContent)) {\n envContent = envContent.replace(regex, `${key}=${value}`);\n } else {\n envContent += `${key}=${value}\\n`;\n }\n };\n\n updateEnvVar('CONTAINER_NAME', answers.containerName || 'next-app');\n updateEnvVar('IMAGE_NAME', answers.imageName || 'nextjs-starter');\n updateEnvVar('IMAGE_TAG', answers.imageTag || 'latest');\n\n await writeFile(envPath, envContent);\n }\n }\n};\n\nconst setupReadme = async (projectPath: string, answers: ProjectPrompts): Promise<void> => {\n const findReadmes = async (dir: string): Promise<string[]> => {\n const entries = await readdir(dir, { withFileTypes: true });\n const files: string[] = [];\n for (const entry of entries) {\n const fullPath = path.join(dir, entry.name);\n if (entry.isDirectory() && entry.name !== 'node_modules' && entry.name !== '.git') {\n files.push(...(await findReadmes(fullPath)));\n } else if (entry.isFile() && entry.name.toLowerCase() === 'readme.md') {\n files.push(fullPath);\n }\n }\n return files;\n };\n\n const allReadmes = await findReadmes(projectPath);\n const rootReadmePath = path.join(projectPath, PROJECT_PATHS.README);\n\n for (const readmePath of allReadmes) {\n if (readmePath !== rootReadmePath) {\n await deleteFile(readmePath);\n }\n }\n\n if (answers.readme) {\n const simpleReadme = `# ${answers.projectName}\n\n${answers.description}\n\n## Getting Started\n\nFirst, run the development server:\n\n\\`\\`\\`bash\n${answers.packageManager === 'npm' ? 'npm run dev' : answers.packageManager + ' dev'}\n\\`\\`\\`\n\nOpen [http://localhost:3000](http://localhost:3000) with your browser to see the result.\n`;\n await writeFile(rootReadmePath, simpleReadme);\n } else {\n await deleteFile(rootReadmePath);\n }\n};\n", "import { Command } from 'commander';\nimport pc from 'picocolors';\nimport path from 'node:path';\nimport { log, logError, spinner } from '../config';\nimport { promptForFeatureDetails } from '../prompts/feature.prompt';\nimport { detectProjectSetup, featureExists } from '../services/feature/detection.service';\nimport { generateFeatureStructure } from '../services/feature/templates.service';\nimport { registerFeatureInRootReducer } from '../services/feature/registration.service';\nimport { registerApiEndpoints } from '../services/common/api-registration.service';\n\ninterface FeatureCommandOptions {\n skipStore?: boolean;\n store?: 'persist' | 'no-persist';\n skipService?: boolean;\n service?: 'axios' | 'fetch';\n path?: string;\n}\n\nexport const registerFeatureCommand = (program: Command) => {\n program\n .command('feature [name]')\n .description('Generate a new feature module')\n .option('--skip-store', 'Skip Redux store generation')\n .option('--store <type>', 'Generate Redux store with persistence option (persist|no-persist)')\n .option('--skip-service', 'Skip API service generation')\n .option('--service <client>', 'Generate API service with specific HTTP client (axios|fetch)')\n .option('--path <path>', 'Custom path for feature generation (default: src/features)')\n .action(async (name: string | undefined, options: FeatureCommandOptions) => {\n try {\n const projectPath = process.cwd();\n\n // Validate store option\n if (options.store && !['persist', 'no-persist'].includes(options.store)) {\n logError('Invalid --store option. Use: persist or no-persist');\n process.exit(1);\n }\n\n // Validate service option\n if (options.service && !['axios', 'fetch'].includes(options.service)) {\n logError('Invalid --service option. Use: axios or fetch');\n process.exit(1);\n }\n\n // Validate conflicting options\n if (options.skipStore && options.store) {\n logError('Cannot use --skip-store and --store together');\n process.exit(1);\n }\n\n if (options.skipService && options.service) {\n logError('Cannot use --skip-service and --service together');\n process.exit(1);\n }\n\n log(pc.cyan('\\n\uD83C\uDFAF Feature Generator\\n'));\n\n // Step 1: Detect project setup\n spinner.start('Detecting project setup...');\n const detection = await detectProjectSetup(projectPath);\n spinner.succeed('Project setup detected');\n\n log(pc.dim(` Redux: ${detection.hasRedux ? '\u2713' : '\u2717'}`));\n log(pc.dim(` HTTP Client: ${detection.httpClient}`));\n log(pc.dim(` i18n: ${detection.hasI18n ? '\u2713' : '\u2717'}\\n`));\n\n // Step 2: Prompt for feature details\n const featureOptions = await promptForFeatureDetails(\n name,\n detection.hasRedux,\n detection.httpClient,\n options.skipStore,\n options.store,\n options.skipService,\n options.service,\n );\n\n // Step 3: Determine feature path\n const basePath = options.path || path.join('src', 'features');\n const featurePath = path.join(projectPath, basePath, featureOptions.featureName);\n\n // Check if feature already exists\n const exists = await featureExists(projectPath, featureOptions.featureName, basePath);\n if (exists) {\n logError(`Feature '${featureOptions.featureName}' already exists at ${basePath}!`);\n process.exit(1);\n }\n\n // Step 4: Generate feature structure\n spinner.start('Generating feature files...');\n\n await generateFeatureStructure({\n featureName: featureOptions.featureName,\n featurePath,\n createStore: featureOptions.createStore,\n persistStore: featureOptions.persistStore,\n createService: featureOptions.createService,\n httpClient: featureOptions.selectedHttpClient,\n });\n\n spinner.succeed('Feature files generated');\n\n // Step 5: Register API endpoints if service was created\n if (featureOptions.createService) {\n spinner.start('Registering API endpoints...');\n await registerApiEndpoints({\n serviceName: featureOptions.featureName,\n projectPath,\n });\n spinner.succeed('API endpoints registered');\n }\n\n // Step 6: Register in rootReducer if store was created\n if (featureOptions.createStore && detection.hasRedux) {\n spinner.start('Registering feature in rootReducer...');\n await registerFeatureInRootReducer(\n projectPath,\n featureOptions.featureName,\n featureOptions.persistStore,\n basePath,\n );\n spinner.succeed('Feature registered in rootReducer');\n }\n\n // Success message\n const displayPath = path.join(basePath, featureOptions.featureName);\n log(pc.green(`\\n\u2728 Feature '${featureOptions.featureName}' created successfully!\\n`));\n log(pc.dim('Generated files:'));\n log(pc.dim(` \uD83D\uDCC2 ${displayPath}/`));\n log(pc.dim(` \u251C\u2500\u2500 components/`));\n log(pc.dim(` \u251C\u2500\u2500 hooks/`));\n log(pc.dim(` \u251C\u2500\u2500 types/`));\n if (featureOptions.createStore) log(pc.dim(` \u251C\u2500\u2500 store/`));\n if (featureOptions.createService) log(pc.dim(` \u251C\u2500\u2500 services/`));\n log(pc.dim(` \u2514\u2500\u2500 index.ts\\n`));\n\n log(pc.cyan('Next steps:'));\n const importPath = basePath.replace(/^src\\//, '@/');\n log(\n pc.dim(\n ` 1. Import and use the feature: import { ${featureOptions.featureName} } from '${importPath}/${featureOptions.featureName}'`,\n ),\n );\n if (featureOptions.createStore) {\n log(pc.dim(` 2. Customize your Redux slice in: ${displayPath}/store/`));\n }\n if (featureOptions.createService) {\n log(\n pc.dim(\n ` 3. Add API methods in: ${displayPath}/services/${featureOptions.featureName}.service.ts`,\n ),\n );\n }\n log('');\n } catch (error) {\n spinner.fail('Feature generation failed');\n logError(`${error}`);\n process.exit(1);\n }\n });\n};\n", "import Enquirer from 'enquirer';\nconst { prompt } = Enquirer;\n\nexport interface FeatureOptions {\n featureName: string;\n hasRedux: boolean;\n createStore: boolean;\n persistStore: boolean;\n httpClient: 'axios' | 'fetch' | 'both' | 'none';\n createService: boolean;\n selectedHttpClient?: 'axios' | 'fetch';\n}\n\nexport const promptForFeatureDetails = async (\n featureName?: string,\n hasRedux?: boolean,\n httpClient?: 'axios' | 'fetch' | 'both' | 'none',\n skipStore?: boolean,\n storeOption?: 'persist' | 'no-persist',\n skipService?: boolean,\n serviceClient?: 'axios' | 'fetch',\n): Promise<FeatureOptions> => {\n const questions: any[] = [];\n\n // Feature name\n if (!featureName) {\n questions.push({\n type: 'input',\n name: 'featureName',\n message: 'What is the feature name?',\n initial: 'my-feature',\n validate: (value: string) => {\n if (!/^[a-z0-9-]+$/.test(value)) {\n return 'Feature name must be lowercase and contain only alphanumeric characters and hyphens.';\n }\n return true;\n },\n });\n }\n\n // Redux store questions\n if (hasRedux && skipStore === undefined && storeOption === undefined) {\n questions.push({\n type: 'confirm',\n name: 'createStore',\n message: 'Generate Redux store for this feature?',\n initial: true,\n });\n\n questions.push({\n type: 'confirm',\n name: 'persistStore',\n message: 'Enable persistence for this store?',\n initial: false,\n skip() {\n // Skip if createStore is false\n\n return !(this as any).state.answers.createStore;\n },\n });\n }\n\n // HTTP service questions\n if (\n httpClient &&\n httpClient !== 'none' &&\n skipService === undefined &&\n serviceClient === undefined\n ) {\n questions.push({\n type: 'confirm',\n name: 'createService',\n message: 'Generate API service for this feature?',\n initial: true,\n });\n\n if (httpClient === 'both') {\n questions.push({\n type: 'select',\n name: 'selectedHttpClient',\n message: 'Which HTTP client to use for the service?',\n choices: ['fetch', 'axios'],\n initial: 0,\n skip() {\n // Skip if createService is false\n\n return !(this as any).state.answers.createService;\n },\n });\n }\n }\n\n const answers: any = questions.length > 0 ? await prompt(questions) : {};\n\n return {\n featureName: featureName || (answers.featureName as string),\n hasRedux: hasRedux || false,\n createStore:\n skipStore === true\n ? false\n : storeOption !== undefined\n ? true\n : (answers.createStore as boolean) || false,\n persistStore:\n storeOption === 'persist'\n ? true\n : storeOption === 'no-persist'\n ? false\n : (answers.persistStore as boolean) || false,\n httpClient: httpClient || 'none',\n createService:\n skipService === true\n ? false\n : serviceClient !== undefined\n ? true\n : (answers.createService as boolean) || false,\n selectedHttpClient:\n serviceClient ||\n (answers.selectedHttpClient as 'axios' | 'fetch' | undefined) ||\n (httpClient === 'both' ? 'fetch' : httpClient !== 'none' ? httpClient : undefined),\n };\n};\n", "import { readFile, access } from 'node:fs/promises';\nimport path from 'node:path';\n\nexport interface ProjectDetection {\n hasRedux: boolean;\n httpClient: 'axios' | 'fetch' | 'both' | 'none';\n hasI18n: boolean;\n}\n\nexport const detectProjectSetup = async (projectPath: string): Promise<ProjectDetection> => {\n let hasRedux = false;\n let hasAxios = false;\n let hasFetch = false;\n let hasI18n = false;\n\n try {\n // Read package.json\n const packageJsonPath = path.join(projectPath, 'package.json');\n const packageJsonContent = await readFile(packageJsonPath, 'utf-8');\n const packageJson = JSON.parse(packageJsonContent);\n\n const dependencies = {\n ...packageJson.dependencies,\n ...packageJson.devDependencies,\n };\n\n // Check for Redux\n hasRedux = !!(dependencies['@reduxjs/toolkit'] && dependencies['react-redux']);\n\n // Check for axios\n hasAxios = !!dependencies['axios'];\n\n // Check for i18n\n hasI18n = !!dependencies['next-intl'];\n\n // Check if axios client exists\n const axiosClientPath = path.join(projectPath, 'src', 'lib', 'utils', 'http', 'axios-client');\n try {\n await access(axiosClientPath);\n hasAxios = hasAxios && true; // Confirm axios is both installed and client exists\n } catch {\n hasAxios = false; // Axios client doesn't exist\n }\n\n // Check if fetch client exists\n const fetchClientPath = path.join(projectPath, 'src', 'lib', 'utils', 'http', 'fetch-client');\n try {\n await access(fetchClientPath);\n hasFetch = true;\n } catch {\n hasFetch = false; // Fetch client doesn't exist\n }\n\n // Determine HTTP client setup\n let httpClient: 'axios' | 'fetch' | 'both' | 'none';\n if (hasAxios && hasFetch) {\n httpClient = 'both';\n } else if (hasAxios) {\n httpClient = 'axios';\n } else if (hasFetch) {\n httpClient = 'fetch';\n } else {\n httpClient = 'none';\n }\n\n return {\n hasRedux,\n httpClient,\n hasI18n,\n };\n } catch (error) {\n throw new Error(`Failed to detect project setup: ${error}`);\n }\n};\n\nexport const featureExists = async (\n projectPath: string,\n featureName: string,\n basePath: string = path.join('src', 'features'),\n): Promise<boolean> => {\n const featurePath = path.join(projectPath, basePath, featureName);\n try {\n await access(featurePath);\n return true;\n } catch {\n return false;\n }\n};\n", "import { writeFile, mkdir } from 'node:fs/promises';\nimport path from 'node:path';\nimport { kebabToCamel, kebabToPascal } from '../../config/utils';\n\nexport interface FeatureGenerationOptions {\n featureName: string;\n featurePath: string;\n createStore: boolean;\n persistStore: boolean;\n createService: boolean;\n httpClient?: 'axios' | 'fetch';\n}\n\nexport const generateFeatureStructure = async (\n options: FeatureGenerationOptions,\n): Promise<void> => {\n const { featurePath } = options;\n\n // Create feature directories\n await mkdir(path.join(featurePath, 'components'), { recursive: true });\n await mkdir(path.join(featurePath, 'hooks'), { recursive: true });\n await mkdir(path.join(featurePath, 'types'), { recursive: true });\n\n if (options.createStore) {\n await mkdir(path.join(featurePath, 'store'), { recursive: true });\n }\n\n if (options.createService) {\n await mkdir(path.join(featurePath, 'services'), { recursive: true });\n }\n\n // Generate files\n await generateComponentFile(options);\n await generateHookFile(options);\n await generateTypesFile(options);\n await generateIndexFile(options);\n\n if (options.createStore) {\n await generateStoreFiles(options);\n }\n\n if (options.createService && options.httpClient) {\n await generateServiceFile(options);\n }\n};\n\nexport const getProjectPathFromFeaturePath = (featurePath: string): string => {\n // Extract project root from feature path\n // featurePath format: /path/to/project/src/features/featureName\n const srcIndex = featurePath.indexOf('/src/features');\n if (srcIndex === -1) {\n throw new Error('Could not determine project path from feature path');\n }\n return featurePath.substring(0, srcIndex);\n};\n\nconst generateComponentFile = async (options: FeatureGenerationOptions): Promise<void> => {\n const { featureName, featurePath } = options;\n const componentName = kebabToPascal(featureName);\n const hookName = `use${componentName}`;\n\n const content = `'use client';\nimport { ${hookName} } from '../hooks/${hookName}';\n\nexport function ${componentName}() {\n const {} = ${hookName}();\n\n return (\n <div>\n <h2>${componentName} Component</h2>\n {/* Add your component UI here */}\n </div>\n );\n}\n\nexport default ${componentName};\n`;\n\n await writeFile(path.join(featurePath, 'components', `${componentName}.tsx`), content);\n};\n\nconst generateHookFile = async (options: FeatureGenerationOptions): Promise<void> => {\n const { featureName, featurePath, createStore } = options;\n const componentName = kebabToPascal(featureName);\n const hookName = `use${componentName}`;\n\n let content: string;\n\n if (createStore) {\n content = `'use client';\nimport { useAppDispatch, useAppSelector } from '@/store/hooks';\nimport { select${componentName}State, setLoading, setError } from '../store/${featureName}.selectors';\n\nexport const ${hookName} = () => {\n const dispatch = useAppDispatch();\n const state = useAppSelector(select${componentName}State);\n\n const handleSetLoading = (loading: boolean) => {\n dispatch(setLoading(loading));\n console.log('Loading state updated:', loading);\n };\n\n const handleSetError = (error: string | null) => {\n dispatch(setError(error));\n console.log('Error state updated:', error);\n };\n\n return {\n state,\n setLoading: handleSetLoading,\n setError: handleSetError,\n } as const;\n};\n`;\n } else {\n content = `'use client';\nimport { useState } from 'react';\n\nexport const ${hookName} = () => {\n // Add your state and logic here\n const [state, setState] = useState({});\n\n return {\n state,\n // Add your methods here\n } as const;\n};\n`;\n }\n\n await writeFile(path.join(featurePath, 'hooks', `${hookName}.ts`), content);\n};\n\nconst generateTypesFile = async (options: FeatureGenerationOptions): Promise<void> => {\n const { featureName, featurePath, createStore } = options;\n const componentName = kebabToPascal(featureName);\n const typeName = `${componentName}State`;\n\n const content = `export interface ${typeName} {\n // Add your state properties here\n ${createStore ? 'loading: boolean;\\n error: string | null;' : '// example: value: string;'}\n}\n`;\n\n await writeFile(path.join(featurePath, 'types', `${featureName}.types.ts`), content);\n};\n\nconst generateStoreFiles = async (options: FeatureGenerationOptions): Promise<void> => {\n const { featureName, featurePath, persistStore } = options;\n const componentName = kebabToPascal(featureName);\n const camelName = kebabToCamel(featureName);\n\n // Generate slice\n const sliceContent = `import { createSlice, PayloadAction } from '@reduxjs/toolkit';\nimport { ${componentName}State } from '../types/${featureName}.types';\n\nconst initialState: ${componentName}State = {\n loading: false,\n error: null,\n // Add your initial state here\n};\n\nexport const ${camelName}Slice = createSlice({\n name: '${camelName}',\n initialState,\n reducers: {\n setLoading: (state, action: PayloadAction<boolean>) => {\n state.loading = action.payload;\n },\n setError: (state, action: PayloadAction<string | null>) => {\n state.error = action.payload;\n },\n resetState: (state) => {\n state.loading = false;\n state.error = null;\n },\n },\n});\n\nexport const { setLoading, setError, resetState } = ${camelName}Slice.actions;\n\nexport const ${camelName}Reducer = ${camelName}Slice.reducer;\n`;\n\n await writeFile(path.join(featurePath, 'store', `${featureName}.slice.ts`), sliceContent);\n\n // Generate selectors\n const selectorsContent = `import { RootState } from '@/store/rootReducer';\n\nexport const select${componentName}State = (state: RootState) => state.${camelName};\nexport { setLoading, setError, resetState } from './${featureName}.slice';\n`;\n\n await writeFile(path.join(featurePath, 'store', `${featureName}.selectors.ts`), selectorsContent);\n\n // Generate persist config if needed\n if (persistStore) {\n const persistContent = `import { PersistConfig } from 'redux-persist';\nimport storage from 'redux-persist/lib/storage';\nimport { ${componentName}State } from '../types/${featureName}.types';\n\nexport const ${camelName}PersistConfig: PersistConfig<${componentName}State> = {\n key: '${camelName}',\n storage,\n // whitelist: ['someField'], // Specify which fields to persist\n};\n`;\n\n await writeFile(path.join(featurePath, 'store', 'persist.ts'), persistContent);\n }\n\n // Generate store index\n const storeIndexContent = `export * from './${featureName}.slice';\nexport * from './${featureName}.selectors';${persistStore ? \"\\nexport * from './persist';\" : ''}\n`;\n\n await writeFile(path.join(featurePath, 'store', 'index.ts'), storeIndexContent);\n};\n\nconst generateServiceFile = async (options: FeatureGenerationOptions): Promise<void> => {\n const { featureName, featurePath, httpClient } = options;\n const camelName = kebabToCamel(featureName);\n\n let content: string;\n\n if (httpClient === 'axios') {\n content = `import { AppApis } from '@/lib/config';\nimport { axiosClient } from '@/lib/utils/http';\nimport { ResultAsync } from '@/types';\n\nexport const ${camelName}Service = {\n getAll: (): ResultAsync<string> => {\n return axiosClient.get<string>(AppApis.${camelName}.getAll);\n },\n};\n`;\n } else {\n // fetch\n content = `import { AppApis } from '@/lib/config';\nimport { fetchClient } from '@/lib/utils/http';\nimport { ResultAsync } from '@/types';\n\nexport const ${camelName}Service = {\n getAll: (): ResultAsync<string> => {\n return fetchClient.get<string>(AppApis.${camelName}.getAll);\n },\n};\n`;\n }\n\n await writeFile(path.join(featurePath, 'services', `${featureName}.service.ts`), content);\n};\n\nconst generateIndexFile = async (options: FeatureGenerationOptions): Promise<void> => {\n const { featureName, featurePath, createStore, createService } = options;\n const componentName = kebabToPascal(featureName);\n\n const content = `export { default as ${componentName} } from './components/${componentName}';\nexport { use${componentName} } from './hooks/use${componentName}';\nexport * from './types/${featureName}.types';${createStore ? `\\nexport * from './store';` : ''}${createService ? `\\nexport * from './services/${featureName}.service';` : ''}\n`;\n\n await writeFile(path.join(featurePath, 'index.ts'), content);\n};\n", "import { readFile, writeFile } from 'node:fs/promises';\nimport path from 'node:path';\nimport { kebabToCamel } from '../../config/utils';\n\nexport const registerFeatureInRootReducer = async (\n projectPath: string,\n featureName: string,\n withPersist: boolean,\n basePath: string = path.join('src', 'features'),\n): Promise<void> => {\n const rootReducerPath = path.join(projectPath, 'src', 'store', 'rootReducer.ts');\n\n try {\n let content = await readFile(rootReducerPath, 'utf-8');\n\n const camelName = kebabToCamel(featureName);\n const reducerName = `${camelName}Reducer`;\n const importName = withPersist ? `${camelName}PersistConfig` : '';\n\n // Convert path to import alias format (src/features -> @/features)\n const importPath = basePath.replace(/^src\\//, '@/');\n\n // Add import statement\n const importStatement = withPersist\n ? `import { ${reducerName}, ${importName} } from '${importPath}/${featureName}/store';`\n : `import { ${reducerName} } from '${importPath}/${featureName}/store';`;\n\n // Find the last import statement\n const importRegex = /import\\s+.*\\s+from\\s+['\"].*['\"];?\\n/g;\n const imports = content.match(importRegex);\n if (imports && imports.length > 0) {\n const lastImport = imports[imports.length - 1];\n const lastImportIndex = content.lastIndexOf(lastImport);\n content =\n content.slice(0, lastImportIndex + lastImport.length) +\n importStatement +\n '\\n' +\n content.slice(lastImportIndex + lastImport.length);\n } else {\n // No imports found, add at the beginning\n content = importStatement + '\\n' + content;\n }\n\n // Add reducer to combineReducers\n const combineReducersRegex = /combineReducers\\(\\{([^}]*)\\}\\)/s;\n const match = content.match(combineReducersRegex);\n\n if (match) {\n const reducersContent = match[1];\n const newReducerEntry = withPersist\n ? `\\n ${camelName}: persistReducer(${importName}, ${reducerName}),`\n : `\\n ${camelName}: ${reducerName},`;\n\n const updatedReducersContent = reducersContent.trimEnd() + newReducerEntry;\n content = content.replace(\n combineReducersRegex,\n `combineReducers({${updatedReducersContent}\\n})`,\n );\n } else {\n throw new Error('Could not find combineReducers in rootReducer.ts');\n }\n\n await writeFile(rootReducerPath, content);\n } catch (error) {\n throw new Error(`Failed to register feature in rootReducer: ${error}`);\n }\n};\n\n/**\n * Register a slice in rootReducer (imports from index.ts, not store/)\n */\nexport const registerSliceInRootReducer = async (\n projectPath: string,\n sliceName: string,\n withPersist: boolean,\n basePath: string,\n): Promise<void> => {\n const rootReducerPath = path.join(projectPath, 'src', 'store', 'rootReducer.ts');\n\n try {\n let content = await readFile(rootReducerPath, 'utf-8');\n\n const camelName = kebabToCamel(sliceName);\n const reducerName = `${camelName}Reducer`;\n const importName = withPersist ? `${camelName}PersistConfig` : '';\n\n // Convert path to import alias format (src/store -> @/store)\n const importPath = basePath.replace(/^src\\//, '@/');\n\n // Add import statement (import from index, not /store)\n const importStatement = withPersist\n ? `import { ${reducerName}, ${importName} } from '${importPath}/${sliceName}';`\n : `import { ${reducerName} } from '${importPath}/${sliceName}';`;\n\n // Find the last import statement\n const importRegex = /import\\s+.*\\s+from\\s+['\"].*['\"];?\\n/g;\n const imports = content.match(importRegex);\n if (imports && imports.length > 0) {\n const lastImport = imports[imports.length - 1];\n const lastImportIndex = content.lastIndexOf(lastImport);\n content =\n content.slice(0, lastImportIndex + lastImport.length) +\n importStatement +\n '\\n' +\n content.slice(lastImportIndex + lastImport.length);\n } else {\n // No imports found, add at the beginning\n content = importStatement + '\\n' + content;\n }\n\n // Add reducer to combineReducers\n const combineReducersRegex = /combineReducers\\(\\{([^}]*)\\}\\)/s;\n const match = content.match(combineReducersRegex);\n\n if (match) {\n const reducersContent = match[1];\n const newReducerEntry = withPersist\n ? `\\n ${camelName}: persistReducer(${importName}, ${reducerName}),`\n : `\\n ${camelName}: ${reducerName},`;\n\n const updatedReducersContent = reducersContent.trimEnd() + newReducerEntry;\n content = content.replace(\n combineReducersRegex,\n `combineReducers({${updatedReducersContent}\\n})`,\n );\n } else {\n throw new Error('Could not find combineReducers in rootReducer.ts');\n }\n\n await writeFile(rootReducerPath, content);\n } catch (error) {\n throw new Error(`Failed to register slice in rootReducer: ${error}`);\n }\n};\n", "import { readFile, writeFile } from 'node:fs/promises';\nimport path from 'node:path';\nimport { kebabToCamel } from '../../config/utils';\n\ninterface RegisterApiOptions {\n serviceName: string;\n projectPath: string;\n}\n\nexport const registerApiEndpoints = async (options: RegisterApiOptions): Promise<void> => {\n const { serviceName, projectPath } = options;\n const camelName = kebabToCamel(serviceName);\n const apiConfigPath = path.join(projectPath, 'src', 'lib', 'config', 'app-apis.ts');\n\n try {\n // Read the current app-apis.ts file\n const content = await readFile(apiConfigPath, 'utf-8');\n\n // Check if the service already exists in the file\n if (content.includes(`${camelName}:`)) {\n // Service already registered, skip\n return;\n }\n\n // Find the position to insert the new API endpoint\n // Looking for the closing brace of AppApis object\n const appApisMatch = content.match(/export const AppApis = \\{[\\s\\S]*?\\} as const;/);\n\n if (!appApisMatch) {\n throw new Error('Could not find AppApis object in app-apis.ts');\n }\n\n // Create the new API endpoint entry\n const newEndpoint = ` ${camelName}: {\n base: \\`\\${API_PREFIX}/${serviceName}\\`,\n getAll: \\`\\${API_PREFIX}/${serviceName}\\`,\n },`;\n\n // Find the position before the closing brace\n const closingBracePattern = /(\\s*)\\} as const;/;\n const match = content.match(closingBracePattern);\n\n if (!match) {\n throw new Error('Could not find closing brace of AppApis object');\n }\n\n // Insert the new endpoint before the closing brace\n const insertPosition = content.lastIndexOf('} as const;');\n const beforeClosing = content.substring(0, insertPosition);\n const afterClosing = content.substring(insertPosition);\n\n // Check if there's already content in AppApis\n const hasExistingEndpoints = beforeClosing.trim().endsWith(',');\n const needsComma = beforeClosing.match(/:\\s*\\{[^}]*\\},\\s*$/);\n\n let updatedContent: string;\n if (needsComma || hasExistingEndpoints) {\n // There are existing endpoints, add comma and new endpoint\n updatedContent = `${beforeClosing}\\n${newEndpoint}\\n${afterClosing}`;\n } else {\n // First endpoint after auth (or empty object), just add it\n updatedContent = beforeClosing.trimEnd() + '\\n' + newEndpoint + '\\n' + afterClosing;\n }\n\n // Write the updated content back\n await writeFile(apiConfigPath, updatedContent);\n } catch (error) {\n throw new Error(`Failed to register API endpoints: ${error}`);\n }\n};\n", "import { Command } from 'commander';\nimport pc from 'picocolors';\nimport path from 'node:path';\nimport { existsSync } from 'node:fs';\nimport { mkdir } from 'node:fs/promises';\nimport { log, logError, spinner } from '../config';\nimport { promptForSliceDetails } from '../prompts/slice.prompt';\nimport { detectProjectSetup } from '../services/feature/detection.service';\nimport { generateSliceFiles } from '../services/slice/slice.service';\nimport { registerSliceInRootReducer } from '../services/feature/registration.service';\nimport { sliceExists } from '../services/slice/detection.service';\n\ninterface SliceCommandOptions {\n path?: string;\n persist?: boolean;\n noPersist?: boolean;\n}\n\nexport const registerSliceCommand = (program: Command) => {\n program\n .command('slice [name]')\n .description('Generate a Redux slice')\n .option('--path <path>', 'Custom path for slice generation (default: create new feature)')\n .option('--persist', 'Enable persistence for this slice')\n .option('--no-persist', 'Disable persistence for this slice')\n .action(async (name: string | undefined, options: SliceCommandOptions) => {\n try {\n const projectPath = process.cwd();\n\n // Validate conflicting options\n if (options.persist && options.noPersist === true) {\n logError('Cannot use --persist and --no-persist together');\n process.exit(1);\n }\n\n log(pc.cyan('\\n\uD83D\uDD27 Slice Generator\\n'));\n\n // Step 1: Detect project setup\n spinner.start('Detecting project setup...');\n const detection = await detectProjectSetup(projectPath);\n spinner.succeed('Project setup detected');\n\n // Step 2: Check if Redux is setup\n if (!detection.hasRedux) {\n spinner.fail('Redux is not setup in this project');\n logError('Please install @reduxjs/toolkit and react-redux first');\n log(pc.dim('\\nRun: npm install @reduxjs/toolkit react-redux\\n'));\n process.exit(1);\n }\n\n log(pc.dim(` Redux: \u2713\\n`));\n\n // Step 3: Prompt for slice details\n const sliceOptions = await promptForSliceDetails(\n name,\n options.persist,\n options.noPersist === true ? false : undefined,\n );\n\n // Step 4: Determine slice path (feature-first approach)\n let basePath: string;\n let featureName: string;\n let slicePath: string;\n\n if (options.path) {\n // Custom path provided\n const customPath = options.path.replace(/^src\\//, '');\n\n // Check if custom path is a feature\n if (customPath.startsWith('features/')) {\n // Extract feature name and ensure store subdirectory\n const parts = customPath.split('/');\n featureName = parts[1]; // features/featureName/...\n basePath = path.join('src', 'features', featureName, 'store');\n slicePath = path.join(projectPath, basePath, sliceOptions.sliceName);\n } else {\n // Non-feature custom path - use as-is but treat as feature store\n basePath = path.join('src', customPath);\n featureName = customPath.split('/')[0]; // First directory as feature name\n slicePath = path.join(projectPath, basePath, sliceOptions.sliceName);\n }\n } else {\n // Default: Create new feature with store\n featureName = sliceOptions.sliceName;\n basePath = path.join('src', 'features', featureName, 'store');\n slicePath = path.join(projectPath, basePath, sliceOptions.sliceName);\n }\n\n // Step 5: Ensure feature and store directories exist\n const featureStorePath = path.join(projectPath, basePath);\n if (!existsSync(featureStorePath)) {\n await mkdir(featureStorePath, { recursive: true });\n }\n\n // Check if slice already exists\n const exists = await sliceExists(projectPath, sliceOptions.sliceName, basePath);\n if (exists) {\n logError(`Slice '${sliceOptions.sliceName}' already exists at ${basePath}!`);\n process.exit(1);\n }\n\n // Step 6: Generate slice files\n spinner.start('Generating slice files...');\n await generateSliceFiles({\n sliceName: sliceOptions.sliceName,\n slicePath,\n persistSlice: sliceOptions.persistSlice,\n });\n spinner.succeed('Slice files generated');\n\n // Step 7: Register in rootReducer\n spinner.start('Registering slice in rootReducer...');\n // For features: basePath includes store (e.g., src/features/auth/store)\n // We need to register the slice at basePath/sliceName\n await registerSliceInRootReducer(\n projectPath,\n sliceOptions.sliceName,\n sliceOptions.persistSlice,\n basePath,\n );\n spinner.succeed('Slice registered in rootReducer');\n\n // Success message\n const displayPath = path.join(basePath, sliceOptions.sliceName);\n log(pc.green(`\\n\u2728 Slice '${sliceOptions.sliceName}' created successfully!\\n`));\n log(pc.dim('Generated files:'));\n log(pc.dim(` \uD83D\uDCC2 ${displayPath}/`));\n log(pc.dim(` \u251C\u2500\u2500 ${sliceOptions.sliceName}.slice.ts`));\n log(pc.dim(` \u251C\u2500\u2500 ${sliceOptions.sliceName}.selectors.ts`));\n if (sliceOptions.persistSlice) log(pc.dim(` \u251C\u2500\u2500 persist.ts`));\n log(pc.dim(` \u251C\u2500\u2500 ${sliceOptions.sliceName}.types.ts`));\n log(pc.dim(` \u2514\u2500\u2500 index.ts\\n`));\n\n log(pc.cyan('Next steps:'));\n const importPath = basePath.replace(/^src\\//, '@/');\n log(\n pc.dim(\n ` 1. Import actions: import { setLoading, setError } from '${importPath}/${sliceOptions.sliceName}'`,\n ),\n );\n log(pc.dim(` 2. Use in component: dispatch(setLoading(true))`));\n log('');\n } catch (error) {\n spinner.fail('Slice generation failed');\n logError(`${error}`);\n process.exit(1);\n }\n });\n};\n", "import Enquirer from 'enquirer';\nconst { prompt } = Enquirer;\n\nexport interface SliceOptions {\n sliceName: string;\n persistSlice: boolean;\n}\n\nexport const promptForSliceDetails = async (\n sliceName?: string,\n persist?: boolean,\n noPersist?: boolean,\n): Promise<SliceOptions> => {\n const questions: any[] = [];\n\n // Slice name\n if (!sliceName) {\n questions.push({\n type: 'input',\n name: 'sliceName',\n message: 'What is the slice name?',\n initial: 'my-slice',\n validate: (value: string) => {\n if (!/^[a-z0-9-]+$/.test(value)) {\n return 'Slice name must be lowercase and contain only alphanumeric characters and hyphens.';\n }\n return true;\n },\n });\n }\n\n // Persistence question\n if (persist === undefined && noPersist === undefined) {\n questions.push({\n type: 'confirm',\n name: 'persistSlice',\n message: 'Enable persistence for this slice?',\n initial: false,\n });\n }\n\n const answers: any = questions.length > 0 ? await prompt(questions) : {};\n\n return {\n sliceName: sliceName || (answers.sliceName as string),\n persistSlice:\n persist === true\n ? true\n : noPersist === false\n ? false\n : (answers.persistSlice as boolean) || false,\n };\n};\n", "import { writeFile, mkdir } from 'node:fs/promises';\nimport path from 'node:path';\nimport { kebabToCamel, kebabToPascal } from '../../config/utils';\n\nexport interface SliceGenerationOptions {\n sliceName: string;\n slicePath: string;\n persistSlice: boolean;\n}\n\nexport const generateSliceFiles = async (options: SliceGenerationOptions): Promise<void> => {\n const { sliceName, slicePath, persistSlice } = options;\n\n // Create slice directory\n await mkdir(slicePath, { recursive: true });\n\n const componentName = kebabToPascal(sliceName);\n const camelName = kebabToCamel(sliceName);\n\n // Generate types file\n await generateTypesFile(sliceName, slicePath, componentName);\n\n // Generate slice file\n await generateSliceFile(sliceName, slicePath, componentName, camelName);\n\n // Generate selectors file\n await generateSelectorsFile(sliceName, slicePath, componentName, camelName);\n\n // Generate persist file if needed\n if (persistSlice) {\n await generatePersistFile(sliceName, slicePath, componentName, camelName);\n }\n\n // Generate index file\n await generateIndexFile(sliceName, slicePath, persistSlice);\n};\n\nconst generateTypesFile = async (\n sliceName: string,\n slicePath: string,\n componentName: string,\n): Promise<void> => {\n const content = `export interface ${componentName}State {\n loading: boolean;\n error: string | null;\n // Add your state properties here\n}\n`;\n\n await writeFile(path.join(slicePath, `${sliceName}.types.ts`), content);\n};\n\nconst generateSliceFile = async (\n sliceName: string,\n slicePath: string,\n componentName: string,\n camelName: string,\n): Promise<void> => {\n const content = `import { createSlice, PayloadAction } from '@reduxjs/toolkit';\nimport { ${componentName}State } from './${sliceName}.types';\n\nconst initialState: ${componentName}State = {\n loading: false,\n error: null,\n // Add your initial state here\n};\n\nexport const ${camelName}Slice = createSlice({\n name: '${camelName}',\n initialState,\n reducers: {\n setLoading: (state, action: PayloadAction<boolean>) => {\n state.loading = action.payload;\n },\n setError: (state, action: PayloadAction<string | null>) => {\n state.error = action.payload;\n },\n resetState: (state) => {\n state.loading = false;\n state.error = null;\n },\n },\n});\n\nexport const { setLoading, setError, resetState } = ${camelName}Slice.actions;\n\nexport const ${camelName}Reducer = ${camelName}Slice.reducer;\n`;\n\n await writeFile(path.join(slicePath, `${sliceName}.slice.ts`), content);\n};\n\nconst generateSelectorsFile = async (\n sliceName: string,\n slicePath: string,\n componentName: string,\n camelName: string,\n): Promise<void> => {\n const content = `import { RootState } from '@/store/rootReducer';\n\nexport const select${componentName}State = (state: RootState) => state.${camelName};\nexport { setLoading, setError, resetState } from './${sliceName}.slice';\n`;\n\n await writeFile(path.join(slicePath, `${sliceName}.selectors.ts`), content);\n};\n\nconst generatePersistFile = async (\n sliceName: string,\n slicePath: string,\n componentName: string,\n camelName: string,\n): Promise<void> => {\n const content = `import { PersistConfig } from 'redux-persist';\nimport storage from 'redux-persist/lib/storage';\nimport { ${componentName}State } from './${sliceName}.types';\n\nexport const ${camelName}PersistConfig: PersistConfig<${componentName}State> = {\n key: '${camelName}',\n storage,\n // whitelist: ['someField'], // Specify which fields to persist\n};\n`;\n\n await writeFile(path.join(slicePath, 'persist.ts'), content);\n};\n\nconst generateIndexFile = async (\n sliceName: string,\n slicePath: string,\n persistSlice: boolean,\n): Promise<void> => {\n const content = `export * from './${sliceName}.slice';\nexport * from './${sliceName}.selectors';\nexport * from './${sliceName}.types';${persistSlice ? \"\\nexport * from './persist';\" : ''}\n`;\n\n await writeFile(path.join(slicePath, 'index.ts'), content);\n};\n", "import { access } from 'node:fs/promises';\nimport path from 'node:path';\n\nexport const sliceExists = async (\n projectPath: string,\n sliceName: string,\n basePath: string = path.join('src', 'store', 'slices'),\n): Promise<boolean> => {\n const slicePath = path.join(projectPath, basePath, sliceName);\n try {\n await access(slicePath);\n return true;\n } catch {\n return false;\n }\n};\n", "import { Command } from 'commander';\nimport pc from 'picocolors';\nimport path from 'node:path';\nimport { existsSync } from 'node:fs';\nimport { mkdir } from 'node:fs/promises';\nimport { log, logError, spinner } from '../config';\nimport { promptForServiceDetails } from '../prompts/service.prompt';\nimport { detectProjectSetup } from '../services/feature/detection.service';\nimport { generateServiceFiles } from '../services/service/service.service';\nimport { serviceExists } from '../services/service/detection.service';\nimport { registerApiEndpoints } from '../services/common/api-registration.service';\n\ninterface ServiceCommandOptions {\n path?: string;\n axios?: boolean;\n fetch?: boolean;\n}\n\nexport const registerServiceCommand = (program: Command) => {\n program\n .command('service [name]')\n .description('Generate an API service')\n .option('--path <path>', 'Custom path for service generation (default: create new feature)')\n .option('--axios', 'Use Axios HTTP client')\n .option('--fetch', 'Use Fetch HTTP client')\n .action(async (name: string | undefined, options: ServiceCommandOptions) => {\n try {\n const projectPath = process.cwd();\n\n // Validate conflicting options\n if (options.axios && options.fetch) {\n logError('Cannot use --axios and --fetch together');\n process.exit(1);\n }\n\n log(pc.cyan('\\n\uD83D\uDD27 Service Generator\\n'));\n\n // Step 1: Detect project setup\n spinner.start('Detecting project setup...');\n const detection = await detectProjectSetup(projectPath);\n spinner.succeed('Project setup detected');\n\n // Step 2: Check if HTTP clients are setup\n if (detection.httpClient === 'none') {\n spinner.fail('No HTTP client is setup in this project');\n logError('Please setup either AxiosClient or FetchClient first');\n log(pc.dim('\\nCheck: lib/utils/http/axios-client or lib/utils/http/fetch-client\\n'));\n process.exit(1);\n }\n\n // Display available clients\n const availableClients: string[] = [];\n if (detection.httpClient === 'axios' || detection.httpClient === 'both') {\n availableClients.push('Axios \u2713');\n }\n if (detection.httpClient === 'fetch' || detection.httpClient === 'both') {\n availableClients.push('Fetch \u2713');\n }\n log(pc.dim(` HTTP Clients: ${availableClients.join(', ')}\\n`));\n\n // Step 3: Prompt for service details\n const serviceOptions = await promptForServiceDetails(\n name,\n options.axios,\n options.fetch,\n detection.httpClient,\n );\n\n // Step 4: Determine service path (feature-first approach)\n let basePath: string;\n let featureName: string;\n let servicePath: string;\n\n if (options.path) {\n // Custom path provided\n const customPath = options.path.replace(/^src\\//, '');\n\n // Check if custom path is a feature\n if (customPath.startsWith('features/')) {\n // Extract feature name and ensure services subdirectory\n const parts = customPath.split('/');\n featureName = parts[1]; // features/featureName/...\n basePath = path.join('src', 'features', featureName, 'services');\n servicePath = path.join(projectPath, basePath);\n } else {\n // Non-feature custom path - use as-is\n basePath = path.join('src', customPath);\n featureName = customPath.split('/')[0]; // First directory as feature name\n servicePath = path.join(projectPath, basePath);\n }\n } else {\n // Default: Create new feature with services\n featureName = serviceOptions.serviceName;\n basePath = path.join('src', 'features', featureName, 'services');\n servicePath = path.join(projectPath, basePath);\n }\n\n // Step 5: Ensure feature and services directories exist\n if (!existsSync(servicePath)) {\n await mkdir(servicePath, { recursive: true });\n }\n\n // Check if service already exists\n const exists = await serviceExists(projectPath, serviceOptions.serviceName, basePath);\n if (exists) {\n logError(`Service '${serviceOptions.serviceName}' already exists at ${basePath}!`);\n process.exit(1);\n }\n\n // Step 6: Generate service files\n spinner.start('Generating service files...');\n await generateServiceFiles({\n serviceName: serviceOptions.serviceName,\n servicePath,\n httpClient: serviceOptions.httpClient,\n });\n spinner.succeed('Service files generated');\n\n // Step 7: Register API endpoints\n spinner.start('Registering API endpoints...');\n await registerApiEndpoints({\n serviceName: serviceOptions.serviceName,\n projectPath,\n });\n spinner.succeed('API endpoints registered');\n\n // Success message\n const displayPath = path.join(basePath, `${serviceOptions.serviceName}.service.ts`);\n log(pc.green(`\\n\u2728 Service '${serviceOptions.serviceName}' created successfully!\\n`));\n log(pc.dim('Generated files:'));\n log(pc.dim(` \uD83D\uDCC4 ${displayPath}\\n`));\n\n log(pc.cyan('Next steps:'));\n const importPath = basePath.replace(/^src\\//, '@/');\n log(\n pc.dim(\n ` 1. Import service: import { ${serviceOptions.serviceName}Service } from '${importPath}/${serviceOptions.serviceName}.service'`,\n ),\n );\n log(\n pc.dim(\n ` 2. Use in component: const data = await ${serviceOptions.serviceName}Service.getAll()`,\n ),\n );\n log('');\n } catch (error) {\n spinner.fail('Service generation failed');\n logError(`${error}`);\n process.exit(1);\n }\n });\n};\n", "import enquirer from 'enquirer';\n\ninterface ServiceOptions {\n serviceName: string;\n httpClient: 'axios' | 'fetch';\n}\n\nexport const promptForServiceDetails = async (\n name?: string,\n axiosFlag?: boolean,\n fetchFlag?: boolean,\n availableClients?: 'axios' | 'fetch' | 'both' | 'none',\n): Promise<ServiceOptions> => {\n const serviceName =\n name ||\n (\n await enquirer.prompt<{ serviceName: string }>({\n type: 'input',\n name: 'serviceName',\n message: 'Service name (kebab-case):',\n validate: (input: string) => {\n if (!input) return 'Service name is required';\n if (!/^[a-z0-9-]+$/.test(input))\n return 'Service name must be lowercase with hyphens only';\n return true;\n },\n })\n ).serviceName;\n\n let httpClient: 'axios' | 'fetch';\n\n // If flags are provided, use them\n if (axiosFlag !== undefined) {\n httpClient = 'axios';\n } else if (fetchFlag !== undefined) {\n httpClient = 'fetch';\n } else {\n // Prompt based on available clients\n if (availableClients === 'axios') {\n httpClient = 'axios';\n } else if (availableClients === 'fetch') {\n httpClient = 'fetch';\n } else if (availableClients === 'both') {\n // Let user choose\n const response = await enquirer.prompt<{ httpClient: 'axios' | 'fetch' }>({\n type: 'select',\n name: 'httpClient',\n message: 'Choose HTTP client:',\n choices: ['axios', 'fetch'],\n });\n httpClient = response.httpClient;\n } else {\n // This shouldn't happen as we check in the command\n httpClient = 'axios';\n }\n }\n\n return {\n serviceName,\n httpClient,\n };\n};\n", "import { writeFile } from 'node:fs/promises';\nimport path from 'node:path';\nimport { kebabToCamel } from '../../config/utils';\n\ninterface GenerateServiceOptions {\n serviceName: string;\n servicePath: string;\n httpClient: 'axios' | 'fetch';\n}\n\nexport const generateServiceFiles = async (options: GenerateServiceOptions): Promise<void> => {\n await generateServiceFile(options);\n};\n\nconst generateServiceFile = async (options: GenerateServiceOptions): Promise<void> => {\n const { serviceName, servicePath, httpClient } = options;\n const camelName = kebabToCamel(serviceName);\n\n let content: string;\n\n if (httpClient === 'axios') {\n content = `import { AppApis } from '@/lib/config';\nimport { axiosClient } from '@/lib/utils/http';\nimport { ResultAsync } from '@/types';\n\nexport const ${camelName}Service = {\n getAll: (): ResultAsync<string> => {\n return axiosClient.get<string>(AppApis.${camelName}.getAll);\n },\n};\n`;\n } else {\n // fetch\n content = `import { AppApis } from '@/lib/config';\nimport { fetchClient } from '@/lib/utils/http';\nimport { ResultAsync } from '@/types';\n\nexport const ${camelName}Service = {\n getAll: (): ResultAsync<string> => {\n return fetchClient.get<string>(AppApis.${camelName}.getAll);\n },\n};\n`;\n }\n\n const fileName = `${serviceName}.service.ts`;\n await writeFile(path.join(servicePath, fileName), content);\n};\n", "import { existsSync } from 'node:fs';\nimport path from 'node:path';\n\nexport const serviceExists = async (\n projectPath: string,\n serviceName: string,\n basePath: string,\n): Promise<boolean> => {\n const servicePath = path.join(projectPath, basePath, `${serviceName}.service.ts`);\n return existsSync(servicePath);\n};\n", "import { Command } from 'commander';\nimport pc from 'picocolors';\nimport Enquirer from 'enquirer';\nimport { log, logError, spinner } from '../config';\nimport { setupDarkTheme } from '../services/setup/dark-theme';\nimport { setupRedux } from '../services/setup/redux';\n\nconst { prompt } = Enquirer;\n\ninterface SetupOptions {\n httpClient?: string;\n darkTheme?: boolean;\n redux?: boolean;\n i18n?: boolean;\n}\n\nexport const registerSetupCommand = (program: Command) => {\n program\n .command('setup')\n .description('Setup features in an existing Next.js project')\n .option('--http-client <type>', 'Setup HTTP client (axios|fetch|both)')\n .option('--dark-theme', 'Setup Dark Theme (Tailwind + next-themes)')\n .option('--redux', 'Setup Redux Toolkit')\n .option('--i18n', 'Setup next-intl for internationalization')\n .action(async (options: SetupOptions) => {\n try {\n log(pc.cyan('\\n\uD83D\uDD27 Setup Wizard\\n'));\n\n let feature: string | undefined;\n\n // If no options provided, show interactive menu\n if (!options.httpClient && !options.darkTheme && !options.redux && !options.i18n) {\n const setupChoice = await prompt<{ feature: string }>([\n {\n type: 'select',\n name: 'feature',\n message: 'What would you like to setup?',\n choices: [\n 'Dark Theme',\n 'Redux Toolkit',\n 'HTTP Client (Axios/Fetch)',\n 'Internationalization (next-intl)',\n 'Cancel',\n ],\n },\n ]);\n feature = setupChoice.feature;\n\n if (feature === 'Cancel') {\n log(pc.yellow('Setup cancelled.'));\n return;\n }\n\n if (feature === 'Dark Theme') {\n await setupDarkTheme(process.cwd());\n } else if (feature === 'Redux Toolkit') {\n await setupRedux(process.cwd());\n } else {\n log(pc.yellow(`\\n\u26A0\uFE0F ${feature} setup is not implemented yet.`));\n log(pc.dim('This feature will be available in a future update.'));\n }\n } else {\n // Direct setup via flags\n if (options.httpClient) {\n log(pc.yellow('\\n\u26A0\uFE0F HTTP Client setup is not implemented yet.'));\n log(pc.dim('This feature will be available in a future update.'));\n }\n if (options.darkTheme) {\n await setupDarkTheme(process.cwd());\n }\n if (options.redux) {\n await setupRedux(process.cwd());\n }\n if (options.i18n) {\n log(pc.yellow('\\n\u26A0\uFE0F Internationalization setup is not implemented yet.'));\n log(pc.dim('This feature will be available in a future update.'));\n }\n }\n } catch (error) {\n spinner.fail('Setup failed');\n logError(`${error}`);\n process.exit(1);\n }\n });\n};\n", "import path from 'node:path';\nimport pc from 'picocolors';\nimport { deleteDirectory } from '../../../core/files';\nimport { installPackage, runScript, detectPackageManager } from '../../../core/package-manager';\nimport { startSpinner } from '../../../config/spinner';\nimport { checkIsAlreadySetup, validateProjectStructure } from './checks';\nimport { fetchAssets, copyThemeProvider } from './assets';\nimport {\n updateProvidersIndex,\n updateRootProvider,\n updateGlobalsCss,\n updateLayout,\n} from './injectors';\n\nexport const setupDarkTheme = async (projectPath: string): Promise<void> => {\n const spinner = startSpinner('Setting up Dark Theme...');\n const tempDir = path.join(projectPath, '.next-maker-temp');\n\n try {\n // 1. Pre-check\n const { isSetup, reason } = await checkIsAlreadySetup(projectPath);\n if (isSetup) {\n spinner.fail(`Dark Theme is already set up (${reason}).`);\n return;\n }\n\n // 2. Validation\n const layoutPath = await validateProjectStructure(projectPath);\n\n // 3. Fetch Assets\n await fetchAssets(tempDir, spinner);\n\n // 4. Copy Files\n await copyThemeProvider(projectPath, tempDir);\n\n // 5. Inject Code\n await updateProvidersIndex(projectPath);\n await updateRootProvider(projectPath);\n await updateGlobalsCss(projectPath, tempDir);\n await updateLayout(layoutPath);\n\n // 6. Install Dependencies\n spinner.text = 'Installing next-themes...';\n await installPackage(projectPath, 'next-themes');\n\n // 7. Format Code\n spinner.text = 'Formatting code...';\n const packageManager = await detectPackageManager(projectPath);\n await runScript(projectPath, packageManager, 'format');\n\n spinner.succeed(pc.green('Dark Theme setup successfully!'));\n } catch (error) {\n spinner.fail('Failed to setup Dark Theme.');\n throw error;\n } finally {\n await deleteDirectory(tempDir);\n }\n};\n", "import path from 'node:path';\nimport { fileExists, readFile } from '../../../core/files';\nimport { PROJECT_PATHS } from '../../../config/paths';\nimport { findLayoutPath } from './utils';\n\nexport const checkIsAlreadySetup = async (\n projectPath: string,\n): Promise<{ isSetup: boolean; reason: string }> => {\n const themeProviderPath = path.join(projectPath, PROJECT_PATHS.THEME_PROVIDER);\n const globalsCssPath = path.join(projectPath, PROJECT_PATHS.GLOBALS_CSS);\n const packageJsonPath = path.join(projectPath, 'package.json');\n\n if (fileExists(themeProviderPath)) {\n return { isSetup: true, reason: 'CustomThemeProvider.tsx exists' };\n }\n\n if (fileExists(packageJsonPath)) {\n const packageJson = JSON.parse(await readFile(packageJsonPath));\n if (\n (packageJson.dependencies && packageJson.dependencies['next-themes']) ||\n (packageJson.devDependencies && packageJson.devDependencies['next-themes'])\n ) {\n return { isSetup: true, reason: 'next-themes is installed' };\n }\n }\n\n if (fileExists(globalsCssPath)) {\n const globalsCss = await readFile(globalsCssPath);\n if (globalsCss.includes('@custom-variant dark')) {\n return { isSetup: true, reason: 'Dark theme CSS found in globals.css' };\n }\n }\n\n return { isSetup: false, reason: '' };\n};\n\nexport const validateProjectStructure = async (projectPath: string): Promise<string> => {\n const globalsCssPath = path.join(projectPath, PROJECT_PATHS.GLOBALS_CSS);\n const providersIndexPath = path.join(projectPath, PROJECT_PATHS.PROVIDERS_INDEX);\n const layoutPath = await findLayoutPath(projectPath);\n\n if (!fileExists(globalsCssPath) || !layoutPath || !fileExists(providersIndexPath)) {\n throw new Error(\n 'Project structure mismatch. Ensure src/styles/globals.css, src/app/layout.tsx (or src/app/[locale]/layout.tsx), and src/providers/index.ts exist.',\n );\n }\n\n return layoutPath;\n};\n", "import path from 'node:path';\nimport { fileExists, readFile } from '../../../core/files';\nimport { PROJECT_PATHS } from '../../../config/paths';\n\nexport const findLayoutPath = async (projectPath: string): Promise<string> => {\n const possibleLayoutPaths = [\n path.join(projectPath, PROJECT_PATHS.ROOT_LAYOUT),\n path.join(projectPath, 'src/app/[locale]/layout.tsx'),\n ];\n\n for (const p of possibleLayoutPaths) {\n if (fileExists(p)) {\n const content = await readFile(p);\n if (content.includes('<body')) {\n return p;\n }\n }\n }\n\n // Fallback: if no body tag found, just take the first one that exists\n for (const p of possibleLayoutPaths) {\n if (fileExists(p)) {\n return p;\n }\n }\n\n return '';\n};\n", "import path from 'node:path';\nimport degit from 'degit';\nimport { copyFile } from '../../../core/files';\nimport { PROJECT_PATHS } from '../../../config/paths';\nimport { Ora } from 'ora';\n\nexport const fetchAssets = async (tempDir: string, spinner: Ora): Promise<void> => {\n spinner.text = 'Fetching assets from starter repo...';\n const emitter = degit('teispace/nextjs-starter', {\n cache: false,\n force: true,\n verbose: false,\n });\n await emitter.clone(tempDir);\n};\n\nexport const copyThemeProvider = async (projectPath: string, tempDir: string): Promise<void> => {\n const themeProviderPath = path.join(projectPath, PROJECT_PATHS.THEME_PROVIDER);\n const sourceProviderPath = path.join(tempDir, 'src/providers/CustomThemeProvider.tsx');\n await copyFile(sourceProviderPath, themeProviderPath);\n};\n", "import path from 'node:path';\nimport { fileExists, readFile, writeFile } from '../../../core/files';\nimport { PROJECT_PATHS } from '../../../config/paths';\n\nexport const updateProvidersIndex = async (projectPath: string): Promise<void> => {\n const providersIndexPath = path.join(projectPath, PROJECT_PATHS.PROVIDERS_INDEX);\n let providersContent = await readFile(providersIndexPath);\n if (!providersContent.includes('CustomThemeProvider')) {\n providersContent += \"export * from './CustomThemeProvider';\\n\";\n await writeFile(providersIndexPath, providersContent);\n }\n};\n\nexport const updateRootProvider = async (projectPath: string): Promise<void> => {\n const rootProviderPath = path.join(projectPath, 'src/providers/RootProvider.tsx');\n if (fileExists(rootProviderPath)) {\n let rootProviderContent = await readFile(rootProviderPath);\n\n // Add import if missing\n if (!rootProviderContent.includes('CustomThemeProvider')) {\n rootProviderContent = rootProviderContent.replace(\n /import \\{ StoreProvider \\} from '@\\/providers';\\n/,\n \"import { StoreProvider, CustomThemeProvider } from '@/providers';\\n\",\n );\n // Fallback if StoreProvider import is different or missing\n if (!rootProviderContent.includes('CustomThemeProvider')) {\n if (rootProviderContent.includes(\"from '@/providers'\")) {\n rootProviderContent = rootProviderContent.replace(\n /\\} from '@\\/providers'/,\n \", CustomThemeProvider } from '@/providers'\",\n );\n } else {\n rootProviderContent =\n \"import { CustomThemeProvider } from '@/providers';\\n\" + rootProviderContent;\n }\n }\n }\n\n // Wrap children\n if (!rootProviderContent.includes('<CustomThemeProvider>')) {\n if (rootProviderContent.includes('<StoreProvider>')) {\n rootProviderContent = rootProviderContent.replace(\n /<StoreProvider>/,\n '<StoreProvider>\\n <CustomThemeProvider>',\n );\n rootProviderContent = rootProviderContent.replace(\n /<\\/StoreProvider>/,\n '</CustomThemeProvider>\\n </StoreProvider>',\n );\n } else {\n const returnMatch = rootProviderContent.match(/return \\(\\s*([\\s\\S]*?)\\s*\\);/);\n if (returnMatch) {\n rootProviderContent = rootProviderContent.replace(\n /return \\(\\s*<([^>]+)([^>]*)>([\\s\\S]*)<\\/\\1>\\s*\\);/,\n (match, tag, attrs, content) => {\n return `return (\\n <CustomThemeProvider>\\n <${tag}${attrs}>${content}</${tag}>\\n </CustomThemeProvider>\\n );`;\n },\n );\n }\n }\n await writeFile(rootProviderPath, rootProviderContent);\n }\n }\n};\n\nexport const updateGlobalsCss = async (projectPath: string, tempDir: string): Promise<void> => {\n const globalsCssPath = path.join(projectPath, PROJECT_PATHS.GLOBALS_CSS);\n const sourceCssPath = path.join(tempDir, 'src/styles/globals.css');\n let darkThemeCss = '';\n\n if (fileExists(sourceCssPath)) {\n const sourceCss = await readFile(sourceCssPath);\n const variantMatch = sourceCss.match(/@custom-variant dark \\(.*?\\);/);\n const themeMatch = sourceCss.match(/@theme \\{[\\s\\S]*?\\}/);\n\n if (variantMatch) darkThemeCss += `\\n${variantMatch[0]}\\n`;\n if (themeMatch) darkThemeCss += `\\n${themeMatch[0]}\\n`;\n }\n\n if (!darkThemeCss) {\n darkThemeCss = `\n@custom-variant dark (&:where(.dark, .dark *));\n\n@theme {\n --color-dark: #202938;\n --color-light: #f5f5f5;\n}\n`;\n }\n\n let cssContent = await readFile(globalsCssPath);\n if (!cssContent.includes('@custom-variant dark')) {\n if (cssContent.includes('@import')) {\n const lastImportIndex = cssContent.lastIndexOf('@import');\n const endOfLineIndex = cssContent.indexOf('\\n', lastImportIndex);\n cssContent =\n cssContent.slice(0, endOfLineIndex + 1) +\n darkThemeCss +\n cssContent.slice(endOfLineIndex + 1);\n } else {\n cssContent = darkThemeCss + cssContent;\n }\n await writeFile(globalsCssPath, cssContent);\n }\n};\n\nexport const updateLayout = async (layoutPath: string): Promise<void> => {\n let layoutContent = await readFile(layoutPath);\n if (!layoutContent.includes('dark:bg-dark')) {\n layoutContent = layoutContent.replace(\n /className=\"([^\"]*)\"/,\n 'className=\"$1 bg-light dark:bg-dark\"',\n );\n await writeFile(layoutPath, layoutContent);\n }\n};\n", "import path from 'node:path';\nimport pc from 'picocolors';\nimport { deleteDirectory } from '../../../core/files';\nimport { installPackage, runScript, detectPackageManager } from '../../../core/package-manager';\nimport { startSpinner } from '../../../config/spinner';\nimport { checkIsAlreadySetup, validateProjectStructure } from './checks';\nimport { fetchAssets, copyReduxFiles, createCounterFeature } from './assets';\nimport { updateProvidersIndex, updateRootProvider, updatePage } from './injectors';\n\nexport const setupRedux = async (projectPath: string): Promise<void> => {\n const spinner = startSpinner('Setting up Redux Toolkit...');\n const tempDir = path.join(projectPath, '.next-maker-temp-redux');\n\n try {\n // 1. Pre-check\n const { isSetup, reason } = await checkIsAlreadySetup(projectPath);\n if (isSetup) {\n spinner.fail(`Redux is already set up (${reason}).`);\n return;\n }\n\n // 2. Validation\n await validateProjectStructure(projectPath);\n\n // 3. Fetch Assets\n await fetchAssets(tempDir, spinner);\n\n // 4. Copy Files\n spinner.text = 'Copying Redux files...';\n await copyReduxFiles(projectPath, tempDir);\n\n spinner.text = 'Creating Counter feature...';\n await createCounterFeature(projectPath, tempDir);\n\n // 5. Inject Code\n spinner.text = 'Updating providers and pages...';\n await updateProvidersIndex(projectPath);\n await updateRootProvider(projectPath);\n await updatePage(projectPath);\n\n // 6. Install Dependencies\n spinner.text = 'Installing dependencies...';\n await installPackage(projectPath, '@reduxjs/toolkit');\n await installPackage(projectPath, 'react-redux');\n await installPackage(projectPath, 'redux-persist');\n // Check if react-secure-storage is needed (starter uses it in persist.ts? No, it used storage from redux-persist/lib/storage in the file I viewed)\n // But let's check if the starter has it in package.json just in case.\n // Based on previous view of package.json in test project, it had react-secure-storage.\n // Let's install it to be safe if the starter uses it elsewhere or if I missed it.\n await installPackage(projectPath, 'react-secure-storage');\n\n // 7. Format Code\n spinner.text = 'Formatting code...';\n const packageManager = await detectPackageManager(projectPath);\n await runScript(projectPath, packageManager, 'format');\n\n spinner.succeed(pc.green('Redux Toolkit setup successfully!'));\n } catch (error) {\n spinner.fail('Failed to setup Redux Toolkit.');\n throw error;\n } finally {\n await deleteDirectory(tempDir);\n }\n};\n", "import path from 'node:path';\nimport { fileExists, readFile } from '../../../core/files';\nimport { PROJECT_PATHS } from '../../../config/paths';\nimport { findLayoutPath } from '../dark-theme/utils'; // Reuse utility\n\nexport const checkIsAlreadySetup = async (\n projectPath: string,\n): Promise<{ isSetup: boolean; reason: string }> => {\n const storePath = path.join(projectPath, PROJECT_PATHS.STORE);\n const packageJsonPath = path.join(projectPath, 'package.json');\n\n if (fileExists(storePath)) {\n return { isSetup: true, reason: 'src/store directory exists' };\n }\n\n if (fileExists(packageJsonPath)) {\n const packageJson = JSON.parse(await readFile(packageJsonPath));\n if (\n (packageJson.dependencies && packageJson.dependencies['@reduxjs/toolkit']) ||\n (packageJson.devDependencies && packageJson.devDependencies['@reduxjs/toolkit'])\n ) {\n return { isSetup: true, reason: '@reduxjs/toolkit is installed' };\n }\n }\n\n return { isSetup: false, reason: '' };\n};\n\nexport const validateProjectStructure = async (projectPath: string): Promise<void> => {\n const providersIndexPath = path.join(projectPath, PROJECT_PATHS.PROVIDERS_INDEX);\n // We check for layout just to ensure it's a valid next app, reusing the robust check\n const layoutPath = await findLayoutPath(projectPath);\n\n if (!layoutPath || !fileExists(providersIndexPath)) {\n throw new Error(\n 'Project structure mismatch. Ensure src/app/layout.tsx (or src/app/[locale]/layout.tsx) and src/providers/index.ts exist.',\n );\n }\n};\n", "import path from 'node:path';\nimport degit from 'degit';\nimport { copyFile, readFile, writeFile, fileExists } from '../../../core/files';\nimport { PROJECT_PATHS } from '../../../config/paths';\nimport { Ora } from 'ora';\nimport fs from 'node:fs/promises';\n\nexport const fetchAssets = async (tempDir: string, spinner: Ora): Promise<void> => {\n spinner.text = 'Fetching assets from starter repo...';\n const emitter = degit('teispace/nextjs-starter', {\n cache: false,\n force: true,\n verbose: false,\n });\n await emitter.clone(tempDir);\n};\n\nexport const copyReduxFiles = async (projectPath: string, tempDir: string): Promise<void> => {\n // Copy StoreProvider\n const sourceProviderPath = path.join(tempDir, 'src/providers/StoreProvider.tsx');\n const destProviderPath = path.join(projectPath, PROJECT_PATHS.STORE_PROVIDER);\n await copyFile(sourceProviderPath, destProviderPath);\n\n // Copy src/store directory\n const sourceStoreDir = path.join(tempDir, 'src/store');\n const destStoreDir = path.join(projectPath, PROJECT_PATHS.STORE);\n await fs.cp(sourceStoreDir, destStoreDir, { recursive: true });\n};\n\nexport const createCounterFeature = async (projectPath: string, tempDir: string): Promise<void> => {\n const sourceFeatureDir = path.join(tempDir, 'src/features/counter');\n const destFeatureDir = path.join(projectPath, PROJECT_PATHS.COUNTER_FEATURE);\n\n // Copy the entire directory first\n await fs.cp(sourceFeatureDir, destFeatureDir, { recursive: true });\n\n // Modify Counter.tsx to remove i18n\n const counterComponentPath = path.join(destFeatureDir, 'components/Counter.tsx');\n if (await fileExists(counterComponentPath)) {\n let content = await readFile(counterComponentPath);\n\n // Remove imports\n content = content.replace(/import \\{ useTranslations \\} from 'next-intl';\\n?/, '');\n\n // Remove hook usage\n content = content.replace(/const t = useTranslations\\('Count'\\);\\n?/, '');\n\n // Replace translations with hardcoded strings\n // {t('currentCount', { count: value })} -> Current Count: {value}\n content = content.replace(\n /\\{t\\('currentCount', \\{ count: value \\}\\)\\}/g,\n 'Current Count: {value}',\n );\n\n // {t('increment')} -> Increment\n content = content.replace(/\\{t\\('increment'\\)\\}/g, 'Increment');\n\n // {t('decrement')} -> Decrement\n content = content.replace(/\\{t\\('decrement'\\)\\}/g, 'Decrement');\n\n // {t('reset')} -> Reset\n content = content.replace(/\\{t\\('reset'\\)\\}/g, 'Reset');\n\n await writeFile(counterComponentPath, content);\n }\n};\n", "import path from 'node:path';\nimport { fileExists, readFile, writeFile } from '../../../core/files';\nimport { PROJECT_PATHS } from '../../../config/paths';\n\nexport const updateProvidersIndex = async (projectPath: string): Promise<void> => {\n const providersIndexPath = path.join(projectPath, PROJECT_PATHS.PROVIDERS_INDEX);\n let providersContent = await readFile(providersIndexPath);\n if (!providersContent.includes('StoreProvider')) {\n providersContent += \"export * from './StoreProvider';\\n\";\n await writeFile(providersIndexPath, providersContent);\n }\n};\n\nexport const updateRootProvider = async (projectPath: string): Promise<void> => {\n const rootProviderPath = path.join(projectPath, 'src/providers/RootProvider.tsx');\n if (fileExists(rootProviderPath)) {\n let rootProviderContent = await readFile(rootProviderPath);\n\n // Add import\n if (!rootProviderContent.includes('StoreProvider')) {\n rootProviderContent = rootProviderContent.replace(\n /import \\{ (.*?) \\} from '@\\/providers';/,\n \"import { $1, StoreProvider } from '@/providers';\",\n );\n // Fallback if regex didn't match (e.g. no named imports yet)\n if (!rootProviderContent.includes('StoreProvider')) {\n if (rootProviderContent.includes(\"from '@/providers'\")) {\n // Try to append to existing import\n rootProviderContent = rootProviderContent.replace(\n /\\} from '@\\/providers'/,\n \", StoreProvider } from '@/providers'\",\n );\n } else {\n rootProviderContent =\n \"import { StoreProvider } from '@/providers';\\n\" + rootProviderContent;\n }\n }\n }\n\n // Wrap children\n // We want StoreProvider to be the outermost (or close to it)\n if (!rootProviderContent.includes('<StoreProvider>')) {\n const returnMatch = rootProviderContent.match(/return \\(\\s*([\\s\\S]*?)\\s*\\);/);\n if (returnMatch) {\n rootProviderContent = rootProviderContent.replace(\n /return \\(\\s*<([^>]+)([^>]*)>([\\s\\S]*)<\\/\\1>\\s*\\);/,\n (match, tag, attrs, content) => {\n return `return (\\n <StoreProvider>\\n <${tag}${attrs}>${content}</${tag}>\\n </StoreProvider>\\n );`;\n },\n );\n await writeFile(rootProviderPath, rootProviderContent);\n }\n }\n }\n};\n\nexport const updatePage = async (projectPath: string): Promise<void> => {\n // Try to find the page file\n const possiblePagePaths = [\n path.join(projectPath, PROJECT_PATHS.ROOT_PAGE),\n path.join(projectPath, 'src/app/[locale]/page.tsx'),\n ];\n\n let pagePath = '';\n for (const p of possiblePagePaths) {\n if (fileExists(p)) {\n pagePath = p;\n break;\n }\n }\n\n if (pagePath) {\n let pageContent = await readFile(pagePath);\n\n // Add import\n if (!pageContent.includes('Counter')) {\n pageContent =\n \"import { Counter } from '@/features/counter/components/Counter';\\n\" + pageContent;\n }\n\n // Add Component\n if (!pageContent.includes('<Counter />')) {\n // Look for the closing tag of the main container (usually div or main)\n // We'll just append it to the end of the children of the first element\n // This is a bit risky but standard for simple injections\n const lastDivIndex = pageContent.lastIndexOf('</div>');\n const lastMainIndex = pageContent.lastIndexOf('</main>');\n\n const insertIndex = lastMainIndex !== -1 ? lastMainIndex : lastDivIndex;\n\n if (insertIndex !== -1) {\n pageContent =\n pageContent.slice(0, insertIndex) +\n '\\n <div className=\"mt-8\">\\n <h2 className=\"text-2xl font-bold mb-4\">Redux Counter</h2>\\n <Counter />\\n </div>\\n' +\n pageContent.slice(insertIndex);\n await writeFile(pagePath, pageContent);\n }\n }\n }\n};\n", "import { Command } from 'commander';\nimport { registerAppCommand } from './app';\nimport { registerFeatureCommand } from './feature';\nimport { registerSliceCommand } from './slice';\nimport { registerServiceCommand } from './service';\nimport { registerSetupCommand } from './setup';\n\nexport const registerCommands = (program: Command) => {\n registerAppCommand(program);\n registerSetupCommand(program);\n registerFeatureCommand(program);\n registerSliceCommand(program);\n registerServiceCommand(program);\n};\n"],
|
|
5
|
-
"mappings": ";AAAA,OAAS,WAAAA,OA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qB,CACpDC,GAAmBD,CAAO,EAC1BE,GAAqBF,CAAO,EAC5BG,GAAuBH,CAAO,EAC9BI,GAAqBJ,CAAO,EAC5BK,GAAuBL,CAAO,CAChC,E1CTA,eAAeM,IAAO,CACpBC,GAA0B,CAAE,OAASC,GAAcC,GAAMD,CAAC,CAAE,CAAC,EAE7D,IAAME,EAAU,IAAIC,GAEpBD,EAAQ,KAAK,YAAY,EAAE,YAAY,oCAAoC,EAAE,QAAQ,OAAO,EAE5FE,GAAiBF,CAAO,EAExBA,EAAQ,MAAM,CAChB,CAEAJ,GAAK,EAAE,MAAOO,GAAQ,CACpB,IAAMC,EACJD,GAAO,OAAOA,GAAQ,UAAY,YAAaA,EAAOA,EAAc,QAAU,OAAOA,CAAG,EAC1FJ,GAAM,qBAAqBK,CAAO,EAAE,CACtC,CAAC",
|
|
6
|
-
"names": ["Command", "path", "pc", "ora", "startSpinner", "text", "options", "spinner", "Enquirer", "prompt", "promptForProjectDetails", "initialName", "response", "value", "httpsPattern", "sshPattern", "answers", "baseUrl", "fs", "path", "existsSync", "readFile", "filePath", "writeFile", "content", "copyFile", "source", "destination", "deleteFile", "deleteDirectory", "dirPath", "updateJson", "update", "json", "updatedJson", "fileExists", "exec", "promisify", "execAsync", "initializeGit", "cwd", "gitRemote", "error", "exec", "promisify", "execAsync", "installDependencies", "cwd", "manager", "command", "error", "runScript", "script", "getPackageManager", "userAgent", "detectPackageManager", "existsSync", "path", "installPackages", "packages", "getInstallCommand", "installPackage", "packageName", "pc", "colorMap", "s", "print", "message", "color", "colorFn", "text", "error", "message", "print", "logError", "log", "message", "print", "printBanner", "setupCancellationHandlers", "options", "logger", "m", "exitOnCancel", "onCancel", "onUncaught", "err", "onRejection", "reason", "capitalize", "str", "kebabToCamel", "_", "letter", "kebabToPascal", "ora", "spinner", "degit", "cloneTemplate", "projectPath", "spinner", "startSpinner", "degit", "error", "path", "PROJECT_PATHS", "PACKAGES", "configurePackageJson", "projectPath", "answers", "spinner", "startSpinner", "gitRemote", "gitHomepage", "gitIssues", "updateJson", "path", "PROJECT_PATHS", "pkg", "PACKAGES", "error", "path", "cleanupFeatures", "projectPath", "answers", "spinner", "startSpinner", "cleanupHttpClient", "cleanupSecureStorage", "cleanupRedux", "cleanupDarkMode", "cleanupI18n", "cleanupLicense", "cleanupChangelog", "cleanupConfig", "error", "httpUtilsPath", "path", "PROJECT_PATHS", "keepSecureStorage", "deleteDirectory", "writeFile", "deleteFile", "utilsIndexPath", "fileExists", "content", "readFile", "configIndexPath", "constantsPath", "typesIndexPath", "httpTypesPath", "typesContent", "providersIndexPath", "providersIndexContent", "pagesToClean", "pagePath", "globalsCssPath", "cssContent", "layoutPath", "layoutContent", "nextConfigPath", "configContent", "counterComponentPath", "path", "generateRootProvider", "projectPath", "answers", "imports", "providers", "rootProviderContent", "content", "writeFile", "path", "PROJECT_PATHS", "generateLayout", "basicLayout", "counterImport", "counterComponent", "basicPage", "path", "readdir", "setupDevTools", "projectPath", "answers", "setupPreCommitHooks", "setupCommitizen", "setupCiCd", "setupGithubTemplates", "setupCommunityFiles", "setupDocker", "setupReadme", "deleteDirectory", "path", "PROJECT_PATHS", "deleteFile", "updateJson", "pkg", "PACKAGES", "githubPath", "issueTemplatePath", "prTemplatePath", "replacePlaceholders", "content", "fileExists", "readFile", "writeFile", "files", "readdir", "file", "filePath", "allCommunityFiles", "envPath", "envContent", "updateEnvVar", "key", "value", "regex", "findReadmes", "dir", "entries", "entry", "fullPath", "allReadmes", "rootReadmePath", "readmePath", "simpleReadme", "registerAppCommand", "program", "name", "createApp", "initialName", "printBanner", "log", "answers", "promptForProjectDetails", "projectPath", "path", "fileExists", "pc", "spinner", "startSpinner", "performCleanup", "deleteDirectory", "cleanupErr", "handleSignal", "cloneTemplate", "configurePackageJson", "cleanupFeatures", "generateRootProvider", "generateLayout", "setupDevTools", "initializeGit", "installDependencies", "runScript", "envExamplePath", "envPath", "err", "pc", "path", "Enquirer", "prompt", "promptForFeatureDetails", "featureName", "hasRedux", "httpClient", "skipStore", "storeOption", "skipService", "serviceClient", "questions", "value", "answers", "readFile", "access", "path", "detectProjectSetup", "projectPath", "hasRedux", "hasAxios", "hasFetch", "hasI18n", "packageJsonPath", "packageJsonContent", "packageJson", "dependencies", "axiosClientPath", "fetchClientPath", "httpClient", "error", "featureExists", "featureName", "basePath", "featurePath", "writeFile", "mkdir", "path", "generateFeatureStructure", "options", "featurePath", "mkdir", "path", "generateComponentFile", "generateHookFile", "generateTypesFile", "generateIndexFile", "generateStoreFiles", "generateServiceFile", "generateComponentFile", "options", "featureName", "featurePath", "componentName", "kebabToPascal", "hookName", "content", "writeFile", "path", "generateHookFile", "createStore", "generateTypesFile", "generateStoreFiles", "persistStore", "camelName", "kebabToCamel", "sliceContent", "selectorsContent", "persistContent", "storeIndexContent", "generateServiceFile", "httpClient", "generateIndexFile", "createService", "readFile", "writeFile", "path", "registerFeatureInRootReducer", "projectPath", "featureName", "withPersist", "basePath", "path", "rootReducerPath", "content", "readFile", "camelName", "kebabToCamel", "reducerName", "importName", "importPath", "importStatement", "importRegex", "imports", "lastImport", "lastImportIndex", "combineReducersRegex", "match", "reducersContent", "newReducerEntry", "updatedReducersContent", "writeFile", "error", "registerSliceInRootReducer", "sliceName", "readFile", "writeFile", "path", "registerApiEndpoints", "options", "serviceName", "projectPath", "camelName", "kebabToCamel", "apiConfigPath", "path", "content", "readFile", "newEndpoint", "closingBracePattern", "insertPosition", "beforeClosing", "afterClosing", "hasExistingEndpoints", "needsComma", "updatedContent", "writeFile", "error", "registerFeatureCommand", "program", "name", "options", "projectPath", "logError", "log", "pc", "spinner", "detection", "detectProjectSetup", "featureOptions", "promptForFeatureDetails", "basePath", "path", "featurePath", "featureExists", "generateFeatureStructure", "registerApiEndpoints", "registerFeatureInRootReducer", "displayPath", "importPath", "error", "pc", "path", "existsSync", "mkdir", "Enquirer", "prompt", "promptForSliceDetails", "sliceName", "persist", "noPersist", "questions", "value", "answers", "writeFile", "mkdir", "path", "generateSliceFiles", "options", "sliceName", "slicePath", "persistSlice", "mkdir", "componentName", "kebabToPascal", "camelName", "kebabToCamel", "generateTypesFile", "generateSliceFile", "generateSelectorsFile", "generatePersistFile", "generateIndexFile", "content", "writeFile", "path", "access", "path", "sliceExists", "projectPath", "sliceName", "basePath", "slicePath", "registerSliceCommand", "program", "name", "options", "projectPath", "logError", "log", "pc", "spinner", "detection", "detectProjectSetup", "sliceOptions", "promptForSliceDetails", "basePath", "featureName", "slicePath", "customPath", "path", "featureStorePath", "existsSync", "mkdir", "sliceExists", "generateSliceFiles", "registerSliceInRootReducer", "displayPath", "importPath", "error", "pc", "path", "existsSync", "mkdir", "enquirer", "promptForServiceDetails", "name", "axiosFlag", "fetchFlag", "availableClients", "serviceName", "input", "httpClient", "writeFile", "path", "generateServiceFiles", "options", "generateServiceFile", "serviceName", "servicePath", "httpClient", "camelName", "kebabToCamel", "content", "fileName", "writeFile", "path", "existsSync", "path", "serviceExists", "projectPath", "serviceName", "basePath", "servicePath", "registerServiceCommand", "program", "name", "options", "projectPath", "logError", "log", "pc", "spinner", "detection", "detectProjectSetup", "availableClients", "serviceOptions", "promptForServiceDetails", "basePath", "featureName", "servicePath", "customPath", "path", "existsSync", "mkdir", "serviceExists", "generateServiceFiles", "registerApiEndpoints", "displayPath", "importPath", "error", "pc", "Enquirer", "path", "pc", "path", "path", "findLayoutPath", "projectPath", "possibleLayoutPaths", "path", "PROJECT_PATHS", "p", "fileExists", "readFile", "checkIsAlreadySetup", "projectPath", "themeProviderPath", "path", "PROJECT_PATHS", "globalsCssPath", "packageJsonPath", "fileExists", "packageJson", "readFile", "validateProjectStructure", "providersIndexPath", "layoutPath", "findLayoutPath", "path", "degit", "fetchAssets", "tempDir", "spinner", "degit", "copyThemeProvider", "projectPath", "themeProviderPath", "path", "PROJECT_PATHS", "sourceProviderPath", "copyFile", "path", "updateProvidersIndex", "projectPath", "providersIndexPath", "path", "PROJECT_PATHS", "providersContent", "readFile", "writeFile", "updateRootProvider", "rootProviderPath", "fileExists", "rootProviderContent", "match", "tag", "attrs", "content", "updateGlobalsCss", "tempDir", "globalsCssPath", "sourceCssPath", "darkThemeCss", "sourceCss", "variantMatch", "themeMatch", "cssContent", "lastImportIndex", "endOfLineIndex", "updateLayout", "layoutPath", "layoutContent", "setupDarkTheme", "projectPath", "spinner", "startSpinner", "tempDir", "path", "isSetup", "reason", "checkIsAlreadySetup", "layoutPath", "validateProjectStructure", "fetchAssets", "copyThemeProvider", "updateProvidersIndex", "updateRootProvider", "updateGlobalsCss", "updateLayout", "installPackage", "packageManager", "detectPackageManager", "runScript", "pc", "error", "deleteDirectory", "path", "pc", "path", "checkIsAlreadySetup", "projectPath", "storePath", "path", "PROJECT_PATHS", "packageJsonPath", "fileExists", "packageJson", "readFile", "validateProjectStructure", "providersIndexPath", "findLayoutPath", "path", "degit", "fs", "fetchAssets", "tempDir", "spinner", "degit", "copyReduxFiles", "projectPath", "sourceProviderPath", "path", "destProviderPath", "PROJECT_PATHS", "copyFile", "sourceStoreDir", "destStoreDir", "createCounterFeature", "sourceFeatureDir", "destFeatureDir", "counterComponentPath", "fileExists", "content", "readFile", "writeFile", "path", "updateProvidersIndex", "projectPath", "providersIndexPath", "path", "PROJECT_PATHS", "providersContent", "readFile", "writeFile", "updateRootProvider", "rootProviderPath", "fileExists", "rootProviderContent", "match", "tag", "attrs", "content", "updatePage", "possiblePagePaths", "pagePath", "p", "pageContent", "lastDivIndex", "lastMainIndex", "insertIndex", "setupRedux", "projectPath", "spinner", "startSpinner", "tempDir", "path", "isSetup", "reason", "checkIsAlreadySetup", "validateProjectStructure", "fetchAssets", "copyReduxFiles", "createCounterFeature", "updateProvidersIndex", "updateRootProvider", "updatePage", "installPackage", "packageManager", "detectPackageManager", "runScript", "pc", "error", "deleteDirectory", "prompt", "Enquirer", "registerSetupCommand", "program", "options", "log", "pc", "feature", "setupDarkTheme", "setupRedux", "error", "spinner", "logError", "registerCommands", "program", "registerAppCommand", "registerSetupCommand", "registerFeatureCommand", "registerSliceCommand", "registerServiceCommand", "main", "setupCancellationHandlers", "m", "error", "program", "Command", "registerCommands", "err", "message"]
|
|
3
|
+
"sources": ["../src/index.ts", "../src/commands/app.ts", "../src/config/spinner.ts", "../src/prompts/create-app.prompt.ts", "../src/core/files.ts", "../src/core/git.ts", "../src/core/package-manager.ts", "../src/config/output.ts", "../src/config/errorHandlers.ts", "../src/config/utils.ts", "../src/config/index.ts", "../src/services/init/template.service.ts", "../src/services/init/config.service.ts", "../src/config/paths.ts", "../src/config/packages.ts", "../src/services/init/cleanup.service.ts", "../src/services/init/providers.service.ts", "../src/services/init/devtools.service.ts", "../src/commands/feature.ts", "../src/prompts/feature.prompt.ts", "../src/services/feature/detection.service.ts", "../src/services/feature/templates.service.ts", "../src/services/feature/registration.service.ts", "../src/services/common/api-registration.service.ts", "../src/commands/slice.ts", "../src/prompts/slice.prompt.ts", "../src/services/slice/slice.service.ts", "../src/services/slice/detection.service.ts", "../src/commands/service.ts", "../src/prompts/service.prompt.ts", "../src/services/service/service.service.ts", "../src/services/service/detection.service.ts", "../src/commands/setup.ts", "../src/services/setup/dark-theme/index.ts", "../src/services/setup/dark-theme/checks.ts", "../src/services/setup/dark-theme/utils.ts", "../src/services/setup/dark-theme/assets.ts", "../src/services/setup/dark-theme/injectors.ts", "../src/services/setup/redux/index.ts", "../src/services/setup/redux/checks.ts", "../src/services/setup/redux/assets.ts", "../src/services/setup/redux/injectors.ts", "../src/services/setup/i18n/index.ts", "../src/services/setup/i18n/checks.ts", "../src/services/setup/i18n/assets.ts", "../src/services/setup/i18n/injectors.ts", "../src/commands/index.ts"],
|
|
4
|
+
"sourcesContent": ["import { Command } from 'commander';\nimport { registerCommands } from './commands/index';\nimport { error, setupCancellationHandlers } from './config';\n\nasync function main() {\n setupCancellationHandlers({ logger: (m: string) => error(m) });\n\n const program = new Command();\n\n program.name('next-maker').description('Teispace Next.js Project Generator').version('1.0.0');\n\n registerCommands(program);\n\n program.parse();\n}\n\nmain().catch((err) => {\n const message =\n err && typeof err === 'object' && 'message' in err ? (err as Error).message : String(err);\n error(`Unexpected error: ${message}`);\n});\n", "import { Command } from 'commander';\nimport path from 'node:path';\nimport pc from 'picocolors';\nimport { startSpinner } from '../config/spinner';\nimport { promptForProjectDetails } from '../prompts/create-app.prompt';\nimport { deleteDirectory, fileExists } from '../core/files';\nimport { initializeGit } from '../core/git';\nimport { installDependencies, runScript } from '../core/package-manager';\nimport { log, printBanner } from '../config';\nimport { cloneTemplate } from '../services/init/template.service';\nimport { configurePackageJson } from '../services/init/config.service';\nimport { cleanupFeatures } from '../services/init/cleanup.service';\nimport { generateRootProvider, generateLayout } from '../services/init/providers.service';\nimport { setupDevTools } from '../services/init/devtools.service';\n\nexport const registerAppCommand = (program: Command) => {\n program\n .command('init')\n .description('Initialize a new Next.js project')\n .argument('[name]', 'Project name')\n .action(async (name) => {\n await createApp(name);\n });\n};\n\nconst createApp = async (initialName?: string): Promise<void> => {\n printBanner();\n log('Welcome to the Teispace Next.js App Creator!');\n log('');\n\n const answers = await promptForProjectDetails(initialName);\n const projectPath = path.resolve(process.cwd(), answers.projectName);\n\n if (fileExists(projectPath)) {\n console.error(pc.red(`Error: Directory ${answers.projectName} already exists.`));\n process.exit(1);\n }\n\n const spinner = startSpinner('Initializing project...');\n\n // Cleanup helper\n const performCleanup = async () => {\n if (fileExists(projectPath)) {\n spinner.stop(); // Stop spinner if running\n console.log(pc.yellow(`\\nCleaning up: Deleting directory ${answers.projectName}...`));\n try {\n await deleteDirectory(projectPath);\n console.log(pc.green('Cleanup successful.'));\n } catch (cleanupErr) {\n console.error(pc.red(`Failed to clean up directory ${answers.projectName}:`), cleanupErr);\n }\n }\n };\n\n // Signal handler\n const handleSignal = async () => {\n console.log(pc.red('\\nProcess interrupted. Cleaning up...'));\n await performCleanup();\n process.exit(1);\n };\n\n // Register signal listeners\n process.on('SIGINT', handleSignal);\n process.on('SIGTERM', handleSignal);\n\n try {\n // 1. Clone template\n await cloneTemplate(projectPath);\n\n // 2. Update package.json\n await configurePackageJson(projectPath, answers);\n\n // 3. Customize Features (Cleanup)\n await cleanupFeatures(projectPath, answers);\n\n // 4. Generate Code (Providers, Layout)\n spinner.text = 'Generating code...';\n await generateRootProvider(projectPath, answers);\n await generateLayout(projectPath, answers);\n\n // 5. Setup DevTools & Community Files\n spinner.text = 'Setting up developer tools...';\n await setupDevTools(projectPath, answers);\n\n // 6. Initialize Git\n spinner.text = 'Initializing Git...';\n // Pass gitRemote to initialize git with remote if provided\n await initializeGit(projectPath, answers.gitRemote);\n\n // 7. Install Dependencies\n spinner.text = 'Installing dependencies...';\n await installDependencies(projectPath, answers.packageManager);\n\n // 8. Format and Lint\n spinner.text = 'Formatting and Linting...';\n await runScript(projectPath, answers.packageManager, 'format');\n await runScript(projectPath, answers.packageManager, 'lint:fix');\n\n // 9. Copy .env.example to .env if requested\n if (answers.copyEnv) {\n spinner.text = 'Creating .env file...';\n const envExamplePath = path.join(projectPath, '.env.example');\n const envPath = path.join(projectPath, '.env');\n if (fileExists(envExamplePath)) {\n const fs = await import('node:fs/promises');\n await fs.copyFile(envExamplePath, envPath);\n }\n }\n\n // Remove signal listeners on success\n process.off('SIGINT', handleSignal);\n process.off('SIGTERM', handleSignal);\n\n spinner.succeed(pc.green(`Project ${answers.projectName} created successfully!`));\n log('');\n log('To get started:');\n log(pc.cyan(` cd ${answers.projectName}`));\n log(\n pc.cyan(\n ` ${answers.packageManager === 'npm' ? 'npm run dev' : answers.packageManager + ' dev'}`,\n ),\n );\n log('');\n } catch (err) {\n spinner.fail('Failed to create project.');\n console.error(err);\n await performCleanup();\n process.exit(1);\n }\n};\n", "import ora, { Ora, Options } from 'ora';\n\n// Create and start a spinner\nexport function startSpinner(text = '', options?: Options): Ora {\n const spinner = ora({ text, ...options });\n spinner.start();\n return spinner;\n}\n\n// Stop a spinner without changing its status\nexport function stopSpinner(spinner: Ora): void {\n spinner.stop();\n}\n\n// Mark spinner as succeeded\nexport function succeedSpinner(spinner: Ora, text?: string): void {\n spinner.succeed(text);\n}\n\n// Mark spinner as failed\nexport function failSpinner(spinner: Ora, text?: string): void {\n spinner.fail(text);\n}\n\n// Run an async function while showing a spinner; auto-succeed/fail\nexport async function withSpinner<T>(\n text: string,\n fn: () => Promise<T>,\n {\n successText,\n failText,\n options,\n }: { successText?: string; failText?: string; options?: Options } = {},\n): Promise<T> {\n const spinner = startSpinner(text, options);\n try {\n const result = await fn();\n spinner.succeed(successText ?? 'Done');\n return result;\n } catch (err) {\n spinner.fail(failText ?? 'Failed');\n throw err;\n }\n}\n\nexport default startSpinner;\n", "import Enquirer from 'enquirer';\nimport { PackageManager } from '../core/package-manager';\n\nconst { prompt } = Enquirer;\n\ntype PromptContext = {\n state?: { answers?: Partial<ProjectPrompts> };\n enquirer?: { answers?: Partial<ProjectPrompts> };\n};\n\nexport interface ProjectPrompts {\n projectName: string;\n description: string;\n author: string;\n version: string;\n packageManager: PackageManager;\n gitRemote: string;\n gitIssues: string;\n gitHomepage: string;\n httpClient: 'axios' | 'fetch' | 'both' | 'none';\n reactSecureStorage?: boolean;\n email: string;\n company: string;\n keepTemplates: boolean;\n darkMode: boolean;\n redux: boolean;\n i18n: boolean;\n communityFiles: string[];\n readme: boolean;\n docker: boolean;\n containerName?: string;\n imageName?: string;\n imageTag?: string;\n ci: boolean;\n preCommitHooks: boolean;\n commitizen: boolean;\n copyEnv: boolean;\n}\n\nexport const promptForProjectDetails = async (initialName?: string): Promise<ProjectPrompts> => {\n const response = await prompt<ProjectPrompts>([\n {\n type: 'input',\n name: 'projectName',\n message: 'What is the project name?',\n initial: initialName || 'my-app',\n skip: !!initialName,\n validate: (value: string) => {\n if (!/^[a-z0-9-_]+$/.test(value)) {\n return 'Project name must be lowercase and contain only alphanumeric characters, hyphens, and underscores.';\n }\n return true;\n },\n },\n {\n type: 'input',\n name: 'description',\n message: 'Project description:',\n initial: 'A Next.js application',\n },\n {\n type: 'input',\n name: 'author',\n message: 'Author:',\n initial: 'Teispace',\n },\n {\n type: 'input',\n name: 'version',\n message: 'Version:',\n initial: '0.1.0',\n validate: (value: string) => {\n if (!/^\\d+\\.\\d+\\.\\d+$/.test(value)) {\n return 'Version must be a valid semantic version (x.y.z).';\n }\n return true;\n },\n },\n {\n type: 'input',\n name: 'email',\n message: 'Support email:',\n initial: 'support@example.com',\n validate: (value: string) => {\n if (!/^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/.test(value)) {\n return 'Please enter a valid email address.';\n }\n return true;\n },\n },\n {\n type: 'select',\n name: 'packageManager',\n message: 'Which package manager would you like to use?',\n choices: ['npm', 'yarn', 'pnpm', 'bun'],\n initial: 1,\n },\n {\n type: 'input',\n name: 'gitRemote',\n message: 'GitHub repository URL (optional):',\n validate: (value: string) => {\n if (!value) return true;\n // GitHub URL patterns: https://github.com/user/repo or git@github.com:user/repo.git\n const httpsPattern = /^https:\\/\\/github\\.com\\/[\\w-]+\\/[\\w.-]+$/;\n const sshPattern = /^git@github\\.com:[\\w-]+\\/[\\w.-]+\\.git$/;\n if (!httpsPattern.test(value) && !sshPattern.test(value)) {\n return 'Please enter a valid GitHub repository URL (e.g., https://github.com/user/repo)';\n }\n return true;\n },\n },\n {\n type: 'confirm',\n name: 'keepTemplates',\n message: 'Do you want to keep GitHub issue and pull request templates?',\n initial: false,\n },\n {\n type: 'select',\n name: 'httpClient',\n message: 'Which HTTP client do you want to use?',\n choices: ['axios', 'fetch', 'both', 'none'],\n initial: 1,\n },\n {\n type: 'confirm',\n name: 'reactSecureStorage',\n message: 'Do you want to include react-secure-storage?',\n initial: true,\n skip: function (this: PromptContext) {\n // Access answers from the prompt instance safely across versions\n const answers = this.state?.answers ?? this.enquirer?.answers ?? {};\n // If HTTP client is selected (not 'none'), we skip this question (it will be auto-included)\n return !!(answers.httpClient && answers.httpClient !== 'none');\n },\n },\n {\n type: 'confirm',\n name: 'darkMode',\n message: 'Do you want to include Dark Mode (Tailwind + next-themes)?',\n initial: true,\n },\n {\n type: 'confirm',\n name: 'redux',\n message: 'Do you want to include Redux Toolkit?',\n initial: true,\n },\n {\n type: 'confirm',\n name: 'i18n',\n message: 'Do you want to include Internationalization (next-intl)?',\n initial: true,\n },\n {\n type: 'multiselect',\n name: 'communityFiles',\n message: 'Select community files to include:',\n choices: [\n { name: 'CODE_OF_CONDUCT.md', value: 'CODE_OF_CONDUCT.md' },\n { name: 'CONTRIBUTING.md', value: 'CONTRIBUTING.md' },\n { name: 'SECURITY.md', value: 'SECURITY.md' },\n ],\n initial: [],\n },\n {\n type: 'confirm',\n name: 'readme',\n message: 'Do you want to create a README.md?',\n initial: true,\n },\n {\n type: 'confirm',\n name: 'docker',\n message: 'Do you want to include Docker configuration?',\n initial: false,\n },\n {\n type: 'input',\n name: 'containerName',\n message: 'Docker Container Name:',\n initial: 'next-app',\n skip: function (this: PromptContext) {\n const answers = this.state?.answers ?? this.enquirer?.answers ?? {};\n return !answers.docker;\n },\n validate: (value: string) => {\n if (!/^[a-zA-Z0-9][a-zA-Z0-9_.-]*$/.test(value)) {\n return 'Invalid Docker container name.';\n }\n return true;\n },\n },\n {\n type: 'input',\n name: 'imageName',\n message: 'Docker Image Name:',\n initial: 'nextjs-starter',\n skip: function (this: PromptContext) {\n const answers = this.state?.answers ?? this.enquirer?.answers ?? {};\n return !answers.docker;\n },\n validate: (value: string) => {\n if (!/^[a-z0-9]+(?:[._-][a-z0-9]+)*$/.test(value)) {\n return 'Invalid Docker image name (must be lowercase).';\n }\n return true;\n },\n },\n {\n type: 'input',\n name: 'imageTag',\n message: 'Docker Image Tag:',\n initial: 'latest',\n skip: function (this: PromptContext) {\n const answers = this.state?.answers ?? this.enquirer?.answers ?? {};\n return !answers.docker;\n },\n validate: (value: string) => {\n if (!/^[a-zA-Z0-9_][a-zA-Z0-9_.-]{0,127}$/.test(value)) {\n return 'Invalid Docker image tag.';\n }\n return true;\n },\n },\n {\n type: 'confirm',\n name: 'ci',\n message: 'Do you want to include GitHub Actions (CI/CD)?',\n initial: false,\n },\n {\n type: 'confirm',\n name: 'preCommitHooks',\n message: 'Do you want to setup pre-commit hooks (Husky, Commitlint, Lint-staged)?',\n initial: true,\n },\n {\n type: 'confirm',\n name: 'commitizen',\n message: 'Do you want to setup Commitizen?',\n initial: true,\n },\n {\n type: 'confirm',\n name: 'copyEnv',\n message: 'Want to copy .env.example to .env?',\n initial: true,\n },\n ] as any);\n\n // Set company to be the same as author\n response.company = response.author;\n\n // Generate git URLs from gitRemote if provided\n if (response.gitRemote && !response.gitHomepage) {\n const baseUrl = response.gitRemote\n .replace('git@github.com:', 'https://github.com/')\n .replace(/\\.git$/, '');\n response.gitHomepage = `${baseUrl}#readme`;\n response.gitIssues = `${baseUrl}/issues`;\n }\n\n return response;\n};\n", "import fs from 'node:fs/promises';\nimport path from 'node:path';\nimport { existsSync } from 'node:fs';\n\nexport const readFile = async (filePath: string): Promise<string> => {\n return fs.readFile(filePath, 'utf-8');\n};\n\nexport const writeFile = async (filePath: string, content: string): Promise<void> => {\n await fs.mkdir(path.dirname(filePath), { recursive: true });\n await fs.writeFile(filePath, content, 'utf-8');\n};\n\nexport const copyFile = async (source: string, destination: string): Promise<void> => {\n await fs.mkdir(path.dirname(destination), { recursive: true });\n await fs.copyFile(source, destination);\n};\n\nexport const deleteFile = async (filePath: string): Promise<void> => {\n if (existsSync(filePath)) {\n await fs.unlink(filePath);\n }\n};\n\nexport const deleteDirectory = async (dirPath: string): Promise<void> => {\n if (existsSync(dirPath)) {\n await fs.rm(dirPath, { recursive: true, force: true });\n }\n};\n\nexport const updateJson = async <T = any>(\n filePath: string,\n update: (json: T) => T,\n): Promise<void> => {\n const content = await readFile(filePath);\n const json = JSON.parse(content) as T;\n const updatedJson = update(json);\n await writeFile(filePath, JSON.stringify(updatedJson, null, 2));\n};\n\nexport const fileExists = (filePath: string): boolean => {\n return existsSync(filePath);\n};\n", "import { exec } from 'node:child_process';\nimport { promisify } from 'node:util';\n\nconst execAsync = promisify(exec);\n\nexport const initializeGit = async (cwd: string, gitRemote?: string): Promise<void> => {\n try {\n // Initialize git repository\n await execAsync('git init', { cwd });\n await execAsync('git add .', { cwd });\n await execAsync('git commit -m \"Initial commit from @teispace/next-maker\"', { cwd });\n\n // Add remote origin if GitHub URL is provided\n if (gitRemote) {\n await execAsync(`git remote add origin ${gitRemote}`, { cwd });\n }\n } catch (error) {\n // Ignore error if git is not installed or fails\n console.warn('Failed to initialize git repository', error);\n }\n};\n\nexport const addRemote = async (cwd: string, url: string): Promise<void> => {\n try {\n await execAsync(`git remote add origin ${url}`, { cwd });\n } catch (error) {\n console.warn('Failed to add remote origin', error);\n }\n};\n\nexport const isGitInstalled = async (): Promise<boolean> => {\n try {\n await execAsync('git --version');\n return true;\n } catch {\n return false;\n }\n};\n", "import { exec } from 'node:child_process';\nimport { promisify } from 'node:util';\n\nconst execAsync = promisify(exec);\n\nexport type PackageManager = 'npm' | 'yarn' | 'pnpm' | 'bun';\n\nexport const installDependencies = async (cwd: string, manager: PackageManager): Promise<void> => {\n const command = `${manager} install`;\n try {\n await execAsync(command, { cwd });\n } catch (error) {\n throw new Error(`Failed to install dependencies with ${manager}: ${error}`);\n }\n};\n\nexport const runScript = async (\n cwd: string,\n manager: PackageManager,\n script: string,\n): Promise<void> => {\n // npm requires 'run' keyword, but yarn/pnpm/bun don't\n const command = manager === 'npm' ? `${manager} run ${script}` : `${manager} ${script}`;\n try {\n await execAsync(command, { cwd });\n } catch (error) {\n // We don't want to fail the whole setup if linting fails, just warn\n console.warn(`Warning: Failed to run script '${script}': ${error}`);\n }\n};\n\nexport const getPackageManager = (): PackageManager => {\n const userAgent = process.env.npm_config_user_agent;\n if (userAgent) {\n if (userAgent.startsWith('yarn')) return 'yarn';\n if (userAgent.startsWith('pnpm')) return 'pnpm';\n if (userAgent.startsWith('bun')) return 'bun';\n }\n return 'npm';\n};\n\nexport const detectPackageManager = async (cwd: string): Promise<PackageManager> => {\n const { existsSync } = await import('node:fs');\n const path = await import('node:path');\n\n // Check for lock files\n if (existsSync(path.join(cwd, 'pnpm-lock.yaml'))) return 'pnpm';\n if (existsSync(path.join(cwd, 'yarn.lock'))) return 'yarn';\n if (existsSync(path.join(cwd, 'bun.lockb'))) return 'bun';\n if (existsSync(path.join(cwd, 'package-lock.json'))) return 'npm';\n\n // Fallback to environment variable\n return getPackageManager();\n};\n\nexport const installPackages = async (\n cwd: string,\n manager: PackageManager,\n packages: string[],\n): Promise<void> => {\n if (packages.length === 0) return;\n\n const installCommand = getInstallCommand(manager);\n const command = `${installCommand} ${packages.join(' ')}`;\n\n try {\n await execAsync(command, { cwd });\n } catch (error) {\n throw new Error(`Failed to install packages with ${manager}: ${error}`);\n }\n};\n\nconst getInstallCommand = (manager: PackageManager): string => {\n switch (manager) {\n case 'npm':\n return 'npm install';\n case 'yarn':\n return 'yarn add';\n case 'pnpm':\n return 'pnpm add';\n case 'bun':\n return 'bun add';\n default:\n return 'npm install';\n }\n};\n\nexport const installPackage = async (cwd: string, packageName: string): Promise<void> => {\n const manager = await detectPackageManager(cwd);\n await installPackages(cwd, manager, [packageName]);\n};\n", "import pc from 'picocolors';\n\n// Define a type for allowed colors explicitly\nexport type Color =\n | 'reset'\n | 'red'\n | 'green'\n | 'yellow'\n | 'blue'\n | 'cyan'\n | 'magenta'\n | 'white'\n | 'gray'\n | 'bright'\n | 'dim';\n\nconst colorMap: Record<Color, (s: string) => string> = {\n reset: (s: string) => s,\n red: pc.red,\n green: pc.green,\n yellow: pc.yellow,\n blue: pc.blue,\n cyan: pc.cyan,\n magenta: pc.magenta,\n white: pc.white,\n gray: pc.gray,\n bright: pc.bold,\n dim: pc.dim,\n};\n\n// Print with color\nexport function print(message: string, color: Color = 'reset'): void {\n const colorFn = colorMap[color] ?? ((text: string) => text);\n console.log(colorFn(message));\n}\n\n// Print section header\nexport function printHeader(title: string): void {\n console.log('');\n print('\u2550'.repeat(60), 'cyan');\n print(` ${title}`, 'bright');\n print('\u2550'.repeat(60), 'cyan');\n console.log('');\n}\n\n// Print success message\nexport function success(message: string): void {\n print(`\u2713 ${message}`, 'green');\n}\n\n// Print error message\nexport function error(message: string): void {\n print(`\u2716 ${message}`, 'red');\n}\n\n// Alias for error\nexport const logError = error;\n\n// Print warning message\nexport function warning(message: string): void {\n print(`\u26A0 ${message}`, 'yellow');\n}\n\n// Print info message\nexport function info(message: string): void {\n print(`\u2139 ${message}`, 'cyan');\n}\n\nexport function log(message: string): void {\n print(message);\n}\n\n// Print banner\nexport function printBanner(): void {\n console.log('');\n print('\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557', 'cyan');\n print('\u2551 \u2551', 'cyan');\n print('\u2551 \uD83D\uDE80 Create Teispace Next.js App \uD83D\uDE80 \u2551', 'cyan');\n print('\u2551 \u2551', 'cyan');\n print('\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D', 'cyan');\n console.log('');\n}\n", "export type SetupOptions = {\n logger?: (msg: string) => void;\n exitOnCancel?: boolean;\n};\n\nexport function setupCancellationHandlers(options?: SetupOptions): () => void {\n const {\n logger = (m: string) => console.error(m),\n exitOnCancel = process.env.NODE_ENV !== 'test',\n } = options ?? {};\n\n const onCancel = (): void => {\n console.log('');\n console.log('');\n logger('Setup cancelled by user');\n console.log('');\n if (exitOnCancel) process.exit(0);\n };\n\n const onUncaught = (err: unknown): void => {\n if (err !== null && typeof err === 'object' && 'code' in err) {\n const maybeErrWithCode = err as { code?: unknown };\n if (maybeErrWithCode.code === 'ERR_USE_AFTER_CLOSE') {\n onCancel();\n return;\n }\n }\n\n // Log uncaught exceptions instead of throwing so the CLI can report\n // the error and exit gracefully when appropriate.\n if (err instanceof Error) {\n logger(`Uncaught exception: ${err.message}`);\n return;\n }\n logger(`Uncaught exception: ${String(err)}`);\n };\n\n const onRejection = (reason: unknown): void => {\n // Log unhandled promise rejections rather than letting them crash the\n // process. This converts the reason to a readable string safely.\n if (reason instanceof Error) {\n logger(`Unhandled promise rejection: ${reason.message}`);\n return;\n }\n logger(`Unhandled promise rejection: ${String(reason)}`);\n };\n\n process.on('SIGINT', onCancel);\n process.on('SIGTERM', onCancel);\n process.on('uncaughtException', onUncaught);\n process.on('unhandledRejection', onRejection as (...args: unknown[]) => void);\n\n // Return a cleanup function to remove listeners (useful in tests).\n return (): void => {\n process.off('SIGINT', onCancel);\n process.off('SIGTERM', onCancel);\n process.off('uncaughtException', onUncaught);\n process.off('unhandledRejection', onRejection as (...args: unknown[]) => void);\n };\n}\n\nexport default setupCancellationHandlers;\n", "export const capitalize = (str: string): string => {\n return str.charAt(0).toUpperCase() + str.slice(1);\n};\n\nexport const kebabToCamel = (str: string): string => {\n return str.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase());\n};\n\nexport const kebabToPascal = (str: string): string => {\n return capitalize(kebabToCamel(str));\n};\n\nexport const camelToKebab = (str: string): string => {\n return str.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();\n};\n", "export * from './output';\nexport * from './errorHandlers';\nexport * from './spinner';\nexport * from './utils';\n\n// Re-export spinner instance\nimport ora from 'ora';\nexport const spinner = ora();\n", "import degit from 'degit';\nimport { startSpinner } from '../../config/spinner';\n\nexport const cloneTemplate = async (projectPath: string): Promise<void> => {\n const spinner = startSpinner('Downloading template...');\n try {\n const emitter = degit('teispace/nextjs-starter', {\n cache: false,\n force: true,\n verbose: true,\n });\n await emitter.clone(projectPath);\n spinner.succeed('Template downloaded successfully.');\n } catch (error) {\n spinner.fail('Failed to download template.');\n throw error;\n }\n};\n", "import path from 'node:path';\nimport { updateJson } from '../../core/files';\nimport { ProjectPrompts } from '../../prompts/create-app.prompt';\nimport { startSpinner } from '../../config/spinner';\nimport { PROJECT_PATHS } from '../../config/paths';\nimport { PACKAGES } from '../../config/packages';\n\nexport const configurePackageJson = async (\n projectPath: string,\n answers: ProjectPrompts,\n): Promise<void> => {\n const spinner = startSpinner('Configuring package.json...');\n try {\n // Generate URLs from GitHub repository URL if provided\n let gitRemote = answers.gitRemote;\n let gitHomepage = answers.gitHomepage;\n let gitIssues = answers.gitIssues;\n\n if (answers.gitRemote) {\n // Convert SSH to HTTPS if needed\n if (answers.gitRemote.startsWith('git@github.com:')) {\n gitRemote = answers.gitRemote\n .replace('git@github.com:', 'https://github.com/')\n .replace(/\\.git$/, '');\n }\n\n // Generate homepage and issues URLs if not provided\n if (!gitHomepage) {\n gitHomepage = `${gitRemote.replace(/\\.git$/, '')}#readme`;\n }\n if (!gitIssues) {\n gitIssues = `${gitRemote.replace(/\\.git$/, '')}/issues`;\n }\n\n // Add .git suffix for repository URL if not present\n if (!gitRemote.endsWith('.git')) {\n gitRemote = `${gitRemote}.git`;\n }\n }\n\n await updateJson(path.join(projectPath, PROJECT_PATHS.PACKAGE_JSON), (pkg) => {\n pkg.name = answers.projectName;\n pkg.version = answers.version;\n pkg.description = answers.description;\n pkg.author = answers.author;\n\n // Remove packageManager field to avoid \"configured to use yarn\" errors\n // and let the user's environment handle it.\n delete pkg.packageManager;\n\n // Handle git-related fields based on whether GitHub URL was provided\n if (answers.gitRemote) {\n if (gitHomepage) pkg.homepage = gitHomepage;\n if (gitIssues) pkg.bugs = { url: gitIssues };\n if (gitRemote) pkg.repository = { type: 'git', url: gitRemote };\n } else {\n // If no GitHub URL provided, remove template's git-related fields\n delete pkg.homepage;\n delete pkg.bugs;\n delete pkg.repository;\n }\n\n // Remove dependencies based on choices\n if (!answers.redux) {\n delete pkg.dependencies[PACKAGES.REDUX_TOOLKIT];\n delete pkg.dependencies[PACKAGES.REACT_REDUX];\n delete pkg.dependencies[PACKAGES.REDUX_PERSIST];\n }\n\n // Handle react-secure-storage\n const keepSecureStorage = answers.httpClient !== 'none' || answers.reactSecureStorage;\n if (!keepSecureStorage) {\n delete pkg.dependencies[PACKAGES.REACT_SECURE_STORAGE];\n }\n if (!answers.i18n) {\n delete pkg.dependencies[PACKAGES.NEXT_INTL];\n }\n if (!answers.darkMode) {\n delete pkg.dependencies[PACKAGES.NEXT_THEMES];\n }\n if (answers.httpClient === 'none') {\n delete pkg.dependencies[PACKAGES.AXIOS];\n } else if (answers.httpClient === 'fetch') {\n delete pkg.dependencies[PACKAGES.AXIOS];\n }\n\n return pkg;\n });\n spinner.succeed('package.json configured.');\n } catch (error) {\n spinner.fail('Failed to configure package.json.');\n throw error;\n }\n};\n", "export const PROJECT_PATHS = {\n // Config\n NEXT_CONFIG: 'next.config.ts',\n TAILWIND_CONFIG: 'tailwind.config.ts',\n POSTCSS_CONFIG: 'postcss.config.mjs',\n ESLINT_CONFIG: 'eslint.config.mjs',\n TS_CONFIG: 'tsconfig.json',\n PACKAGE_JSON: 'package.json',\n ENV_EXAMPLE: '.env.example',\n GITIGNORE: '.gitignore',\n README: 'README.md',\n LICENSE: 'LICENSE',\n CHANGELOG: 'CHANGELOG.md',\n NVM_RC: '.nvmrc',\n NPM_RC: '.npmrc',\n\n // Source\n SRC: 'src',\n APP: 'src/app',\n COMPONENTS: 'src/components',\n LIB: 'src/lib',\n PROVIDERS: 'src/providers',\n STYLES: 'src/styles',\n TYPES: 'src/types',\n UTILS: 'src/lib/utils',\n HOOKS: 'src/hooks',\n SERVICES: 'src/services',\n STORE: 'src/store',\n I18N: 'src/i18n',\n\n // Specific Files\n GLOBALS_CSS: 'src/styles/globals.css',\n ROOT_LAYOUT: 'src/app/layout.tsx',\n ROOT_PAGE: 'src/app/page.tsx',\n ROOT_PROVIDER: 'src/providers/RootProvider.tsx',\n PROVIDERS_INDEX: 'src/providers/index.ts',\n COMPONENTS_INDEX: 'src/components/index.ts',\n TYPES_INDEX: 'src/types/index.ts',\n UTILS_INDEX: 'src/lib/utils/index.ts',\n CONFIG_INDEX: 'src/lib/config/index.ts',\n CONSTANTS: 'src/lib/config/constants.ts',\n APP_LOCALES: 'src/lib/config/app-locales.ts',\n MIDDLEWARE: 'src/middleware.ts',\n PROXY: 'src/proxy.ts',\n I18N_TYPES: 'src/types/i18n.ts',\n\n // Directories to Cleanup\n HTTP_UTILS: 'src/lib/utils/http',\n AXIOS_CLIENT: 'src/lib/utils/http/axios-client',\n FETCH_CLIENT: 'src/lib/utils/http/fetch-client',\n CLIENT_UTILS: 'src/lib/utils/http/client-utils.ts',\n APP_APIS: 'src/lib/config/app-apis.ts',\n STORAGE_SERVICE: 'src/services/storage',\n COUNTER_FEATURE: 'src/features/counter',\n I18N_DIR: 'src/i18n',\n LOCALE_DIR: 'src/app/[locale]',\n ERRORS_DIR: 'src/lib/errors',\n UTILITY_TYPES_DIR: 'src/types/utility',\n COMMON_TYPES_DIR: 'src/types/common',\n HTTP_TYPES: 'src/types/common/http.types.ts',\n GITHUB_DIR: '.github',\n HUSKY_DIR: '.husky',\n STORE_PROVIDER: 'src/providers/StoreProvider.tsx',\n THEME_PROVIDER: 'src/providers/CustomThemeProvider.tsx',\n COUNTER_COMPONENT: 'src/features/counter/components/Counter.tsx',\n LOCALE_PAGE: 'src/app/[locale]/page.tsx',\n\n // Config files\n COMMITLINT_CONFIG: 'commitlint.config.mjs',\n LINTSTAGED_RC: '.lintstagedrc.mjs',\n CZRC: '.czrc',\n DOCKERIGNORE: '.dockerignore',\n DOCKERFILE: 'Dockerfile',\n DOCKER_COMPOSE: 'docker-compose.yml',\n\n // GitHub\n GITHUB_WORKFLOWS: '.github/workflows',\n GITHUB_ISSUE_TEMPLATE: 'ISSUE_TEMPLATE',\n GITHUB_PR_TEMPLATE: 'PULL_REQUEST_TEMPLATE.md',\n\n // Community files\n CODE_OF_CONDUCT: 'CODE_OF_CONDUCT.md',\n CONTRIBUTING: 'CONTRIBUTING.md',\n SECURITY: 'SECURITY.md',\n} as const;\n", "export const PACKAGES = {\n // Dependencies\n REDUX_TOOLKIT: '@reduxjs/toolkit',\n REACT_REDUX: 'react-redux',\n REDUX_PERSIST: 'redux-persist',\n REACT_SECURE_STORAGE: 'react-secure-storage',\n NEXT_INTL: 'next-intl',\n NEXT_THEMES: 'next-themes',\n AXIOS: 'axios',\n\n // Dev Dependencies\n HUSKY: 'husky',\n COMMITLINT_CLI: '@commitlint/cli',\n COMMITLINT_CONFIG: '@commitlint/config-conventional',\n LINT_STAGED: 'lint-staged',\n COMMITIZEN: 'commitizen',\n CZ_CONVENTIONAL_CHANGELOG: 'cz-conventional-changelog',\n} as const;\n", "import path from 'node:path';\nimport { deleteDirectory, deleteFile, fileExists, readFile, writeFile } from '../../core/files';\nimport { ProjectPrompts } from '../../prompts/create-app.prompt';\nimport { startSpinner } from '../../config/spinner';\n\nimport { PROJECT_PATHS } from '../../config/paths';\n\n// ... (imports)\n\nexport const cleanupFeatures = async (\n projectPath: string,\n answers: ProjectPrompts,\n): Promise<void> => {\n const spinner = startSpinner('Customizing features...');\n try {\n await cleanupHttpClient(projectPath, answers);\n await cleanupSecureStorage(projectPath, answers);\n await cleanupRedux(projectPath, answers);\n await cleanupDarkMode(projectPath, answers);\n await cleanupI18n(projectPath, answers);\n await cleanupLicense(projectPath);\n await cleanupChangelog(projectPath);\n await cleanupConfig(projectPath);\n spinner.succeed('Features customized.');\n } catch (error) {\n spinner.fail('Failed to customize features.');\n throw error;\n }\n};\n\nconst cleanupHttpClient = async (projectPath: string, answers: ProjectPrompts): Promise<void> => {\n const httpUtilsPath = path.join(projectPath, PROJECT_PATHS.HTTP_UTILS);\n const keepSecureStorage = answers.httpClient !== 'none' || answers.reactSecureStorage;\n\n if (answers.httpClient === 'none') {\n await deleteDirectory(path.join(projectPath, PROJECT_PATHS.AXIOS_CLIENT));\n await deleteDirectory(path.join(projectPath, PROJECT_PATHS.FETCH_CLIENT));\n\n if (keepSecureStorage) {\n await writeFile(path.join(httpUtilsPath, 'index.ts'), \"export * from './token-store';\\n\");\n // token-store.ts does not use client-utils, so we can remove it\n await deleteFile(path.join(projectPath, PROJECT_PATHS.CLIENT_UTILS));\n } else {\n await deleteDirectory(httpUtilsPath);\n const utilsIndexPath = path.join(projectPath, PROJECT_PATHS.UTILS_INDEX);\n if (fileExists(utilsIndexPath)) {\n let content = await readFile(utilsIndexPath);\n content = content.replace(/export \\* from '\\.\\/http';\\n/, '');\n await writeFile(utilsIndexPath, content);\n }\n\n // Remove app-apis.ts if no client and no secure storage (likely no auth)\n await deleteFile(path.join(projectPath, PROJECT_PATHS.APP_APIS));\n const configIndexPath = path.join(projectPath, PROJECT_PATHS.CONFIG_INDEX);\n if (fileExists(configIndexPath)) {\n let content = await readFile(configIndexPath);\n content = content.replace(/export \\* from '\\.\\/app-apis';\\n/, '');\n await writeFile(configIndexPath, content);\n }\n }\n\n // Remove API constants\n const constantsPath = path.join(projectPath, PROJECT_PATHS.CONSTANTS);\n if (fileExists(constantsPath)) {\n let content = await readFile(constantsPath);\n content = content.replace(/export const API_RESPONSE_DATA_KEY = 'data';\\n/, '');\n content = content.replace(/export const SAVE_AUTH_TOKENS = false;\\n/, '');\n await writeFile(constantsPath, content);\n }\n\n // Remove errors and types\n await deleteDirectory(path.join(projectPath, PROJECT_PATHS.ERRORS_DIR));\n\n // Only remove common types if we don't keep secure storage (TokenStore needs common/http.types.ts)\n if (!keepSecureStorage) {\n await deleteDirectory(path.join(projectPath, PROJECT_PATHS.COMMON_TYPES_DIR));\n await deleteDirectory(path.join(projectPath, PROJECT_PATHS.UTILITY_TYPES_DIR));\n\n // Update types/index.ts\n const typesIndexPath = path.join(projectPath, PROJECT_PATHS.TYPES_INDEX);\n if (fileExists(typesIndexPath)) {\n let content = await readFile(typesIndexPath);\n content = content.replace(/export \\* from '\\.\\/utility';\\n/, '');\n content = content.replace(/export \\* from '\\.\\/common';\\n/, '');\n await writeFile(typesIndexPath, content);\n }\n }\n } else if (answers.httpClient === 'axios') {\n await deleteDirectory(path.join(projectPath, PROJECT_PATHS.FETCH_CLIENT));\n let content = await readFile(path.join(httpUtilsPath, 'index.ts'));\n content = content.replace(/export .* from '\\.\\/fetch-client';\\n/g, '');\n await writeFile(path.join(httpUtilsPath, 'index.ts'), content);\n\n // Remove FetchClientOptions and ExtendedRequestInit from http.types.ts\n const httpTypesPath = path.join(projectPath, PROJECT_PATHS.HTTP_TYPES);\n if (fileExists(httpTypesPath)) {\n let typesContent = await readFile(httpTypesPath);\n // Remove FetchClientOptions interface\n typesContent = typesContent.replace(\n /export interface FetchClientOptions \\{[\\s\\S]*?\\}\\n\\n/,\n '',\n );\n // Remove ExtendedRequestInit interface\n typesContent = typesContent.replace(\n /export interface ExtendedRequestInit extends RequestInit \\{[\\s\\S]*?\\}\\n\\n/,\n '',\n );\n await writeFile(httpTypesPath, typesContent);\n }\n } else if (answers.httpClient === 'fetch') {\n await deleteDirectory(path.join(projectPath, PROJECT_PATHS.AXIOS_CLIENT));\n let content = await readFile(path.join(httpUtilsPath, 'index.ts'));\n content = content.replace(/export .* from '\\.\\/axios-client';\\n/g, '');\n await writeFile(path.join(httpUtilsPath, 'index.ts'), content);\n\n // Remove axios module declaration and AxiosClientOptions from http.types.ts\n const httpTypesPath = path.join(projectPath, PROJECT_PATHS.HTTP_TYPES);\n if (fileExists(httpTypesPath)) {\n let typesContent = await readFile(httpTypesPath);\n // Remove axios module declaration\n typesContent = typesContent.replace(/declare module 'axios' \\{[\\s\\S]*?\\}\\n\\n/, '');\n // Remove AxiosClientOptions interface\n typesContent = typesContent.replace(\n /export interface AxiosClientOptions \\{[\\s\\S]*?\\}\\n\\n/,\n '',\n );\n await writeFile(httpTypesPath, typesContent);\n }\n }\n};\n\nconst cleanupSecureStorage = async (\n projectPath: string,\n answers: ProjectPrompts,\n): Promise<void> => {\n const keepSecureStorage = answers.httpClient !== 'none' || answers.reactSecureStorage;\n if (!keepSecureStorage) {\n await deleteDirectory(path.join(projectPath, PROJECT_PATHS.STORAGE_SERVICE));\n }\n};\n\nconst cleanupRedux = async (projectPath: string, answers: ProjectPrompts): Promise<void> => {\n if (!answers.redux) {\n await deleteDirectory(path.join(projectPath, PROJECT_PATHS.STORE));\n await deleteDirectory(path.join(projectPath, PROJECT_PATHS.COUNTER_FEATURE));\n await deleteFile(path.join(projectPath, PROJECT_PATHS.STORE_PROVIDER));\n\n const providersIndexPath = path.join(projectPath, PROJECT_PATHS.PROVIDERS_INDEX);\n let providersIndexContent = await readFile(providersIndexPath);\n providersIndexContent = providersIndexContent.replace(\n /export \\* from '\\.\\/StoreProvider';\\n/,\n '',\n );\n await writeFile(providersIndexPath, providersIndexContent);\n\n // Cleanup usage in pages\n const pagesToClean = [\n path.join(projectPath, PROJECT_PATHS.ROOT_PAGE),\n path.join(projectPath, PROJECT_PATHS.LOCALE_PAGE),\n ];\n\n for (const pagePath of pagesToClean) {\n if (fileExists(pagePath)) {\n let content = await readFile(pagePath);\n content = content.replace(\n /import\\s+\\{\\s*Counter\\s*\\}\\s+from\\s+['\"]@\\/features\\/counter['\"];\\n?/,\n '',\n );\n content = content.replace(/<Counter\\s*\\/>\\n?/g, '');\n await writeFile(pagePath, content);\n }\n }\n }\n};\n\nconst cleanupDarkMode = async (projectPath: string, answers: ProjectPrompts): Promise<void> => {\n if (!answers.darkMode) {\n await deleteFile(path.join(projectPath, PROJECT_PATHS.THEME_PROVIDER));\n const providersIndexPath = path.join(projectPath, PROJECT_PATHS.PROVIDERS_INDEX);\n let providersIndexContent = await readFile(providersIndexPath);\n providersIndexContent = providersIndexContent.replace(\n /export \\* from '\\.\\/CustomThemeProvider';\\n/,\n '',\n );\n await writeFile(providersIndexPath, providersIndexContent);\n\n const globalsCssPath = path.join(projectPath, PROJECT_PATHS.GLOBALS_CSS);\n if (fileExists(globalsCssPath)) {\n let cssContent = await readFile(globalsCssPath);\n // Remove dark mode custom variant\n cssContent = cssContent.replace(/@custom-variant dark \\(.*?\\);\\n\\n/, '');\n // Remove dark and light color definitions\n cssContent = cssContent.replace(/@theme \\{[\\s\\S]*?\\}\\n/, '');\n await writeFile(globalsCssPath, cssContent);\n }\n\n // Remove dark mode classes from layout if not using i18n\n if (!answers.i18n) {\n const layoutPath = path.join(projectPath, PROJECT_PATHS.ROOT_LAYOUT);\n if (fileExists(layoutPath)) {\n let layoutContent = await readFile(layoutPath);\n layoutContent = layoutContent.replace(/bg-light dark:bg-dark /g, '');\n await writeFile(layoutPath, layoutContent);\n }\n }\n }\n};\n\nconst cleanupI18n = async (projectPath: string, answers: ProjectPrompts): Promise<void> => {\n if (!answers.i18n) {\n await deleteDirectory(path.join(projectPath, PROJECT_PATHS.I18N_DIR));\n await deleteDirectory(path.join(projectPath, PROJECT_PATHS.LOCALE_DIR));\n await deleteFile(path.join(projectPath, PROJECT_PATHS.PROXY));\n await deleteFile(path.join(projectPath, PROJECT_PATHS.MIDDLEWARE));\n await deleteFile(path.join(projectPath, PROJECT_PATHS.I18N_TYPES));\n await deleteFile(path.join(projectPath, PROJECT_PATHS.APP_LOCALES));\n\n const typesIndexPath = path.join(projectPath, PROJECT_PATHS.TYPES_INDEX);\n if (fileExists(typesIndexPath)) {\n let content = await readFile(typesIndexPath);\n content = content.replace(/export \\* from '\\.\\/i18n';\\n/, '');\n await writeFile(typesIndexPath, content);\n }\n\n const configIndexPath = path.join(projectPath, PROJECT_PATHS.CONFIG_INDEX);\n if (fileExists(configIndexPath)) {\n let content = await readFile(configIndexPath);\n content = content.replace(/export \\* from '\\.\\/app-locales';\\n/, '');\n await writeFile(configIndexPath, content);\n }\n\n const nextConfigPath = path.join(projectPath, PROJECT_PATHS.NEXT_CONFIG);\n if (fileExists(nextConfigPath)) {\n let configContent = await readFile(nextConfigPath);\n configContent = configContent.replace(\n /import createNextIntlPlugin from 'next-intl\\/plugin';\\n/,\n '',\n );\n configContent = configContent.replace(/const withNextIntl = createNextIntlPlugin\\(\\);\\n/, '');\n configContent = configContent.replace(\n /export default withNextIntl\\(nextConfig\\);/,\n 'export default nextConfig;',\n );\n await writeFile(nextConfigPath, configContent);\n }\n\n // Cleanup Counter.tsx if Redux is enabled - remove i18n from Counter component\n const counterComponentPath = path.join(projectPath, PROJECT_PATHS.COUNTER_COMPONENT);\n if (fileExists(counterComponentPath)) {\n let content = await readFile(counterComponentPath);\n content = content.replace(\n /import\\s+\\{\\s*useTranslations\\s*\\}\\s+from\\s+['\"]next-intl['\"];\\n/,\n '',\n );\n content = content.replace(/\\s*const\\s+t\\s*=\\s*useTranslations\\(['\"]Count['\"]\\);\\n/, '');\n content = content.replace(/\\{t\\('currentCount',\\s*\\{\\s*count:\\s*value\\s*\\}\\)\\}/g, '{value}');\n content = content.replace(/\\{t\\(['\"]increment['\"]\\)\\}/g, 'Increment');\n content = content.replace(/\\{t\\(['\"]decrement['\"]\\)\\}/g, 'Decrement');\n content = content.replace(/\\{t\\(['\"]reset['\"]\\)\\}/g, 'Reset');\n await writeFile(counterComponentPath, content);\n }\n }\n};\n\nconst cleanupLicense = async (projectPath: string): Promise<void> => {\n await deleteFile(path.join(projectPath, PROJECT_PATHS.LICENSE));\n};\n\nconst cleanupChangelog = async (projectPath: string): Promise<void> => {\n await deleteFile(path.join(projectPath, PROJECT_PATHS.CHANGELOG));\n};\n\nconst cleanupConfig = async (projectPath: string): Promise<void> => {\n await deleteFile(path.join(projectPath, PROJECT_PATHS.NVM_RC));\n await deleteFile(path.join(projectPath, PROJECT_PATHS.NPM_RC));\n};\n", "import path from 'node:path';\nimport { writeFile } from '../../core/files';\nimport { ProjectPrompts } from '../../prompts/create-app.prompt';\nimport { PROJECT_PATHS } from '../../config/paths';\n\nexport const generateRootProvider = async (\n projectPath: string,\n answers: ProjectPrompts,\n): Promise<void> => {\n const imports: string[] = [];\n const providers: string[] = [];\n\n if (answers.redux) {\n imports.push(\"import { StoreProvider } from '@/providers';\");\n providers.push('StoreProvider');\n }\n\n if (answers.darkMode) {\n imports.push(\"import { CustomThemeProvider } from '@/providers';\");\n providers.push('CustomThemeProvider');\n }\n\n if (answers.i18n) {\n imports.push(\"import { NextIntlClientProvider, AbstractIntlMessages } from 'next-intl';\");\n imports.push(\"import { SupportedLocale } from '@/types/i18n';\");\n }\n\n let rootProviderContent = `'use client';\n${imports.join('\\n')}\n\nexport const RootProvider = ({\n children,\n ${answers.i18n ? 'locale,\\n messages,' : ''}\n}: {\n children: React.ReactNode;\n ${answers.i18n ? 'locale: SupportedLocale;\\n messages: AbstractIntlMessages;' : ''}\n}) => {\n return (\n`;\n\n // Build the nesting\n let content = '{children}';\n\n if (answers.i18n) {\n content = `<NextIntlClientProvider locale={locale} messages={messages}>\n ${content}\n </NextIntlClientProvider>`;\n }\n\n if (answers.darkMode) {\n content = `<CustomThemeProvider>\n ${content}\n </CustomThemeProvider>`;\n }\n\n if (answers.redux) {\n content = `<StoreProvider>\n ${content}\n </StoreProvider>`;\n }\n\n // If no providers are wrapped, ensure we return a valid JSX element (Fragment)\n if (content === '{children}') {\n content = `<>{children}</>`;\n }\n\n rootProviderContent += ` ${content}\n );\n};\n`;\n\n await writeFile(path.join(projectPath, PROJECT_PATHS.ROOT_PROVIDER), rootProviderContent);\n};\n\nexport const generateLayout = async (\n projectPath: string,\n answers: ProjectPrompts,\n): Promise<void> => {\n if (!answers.i18n) {\n const basicLayout = `import type { Metadata } from 'next';\nimport '@/styles/globals.css';\nimport { Livvic } from 'next/font/google';\nimport { RootProvider } from '@/providers';\n\nconst livvic = Livvic({\n subsets: ['latin'],\n variable: '--font-livvic',\n weight: ['100', '200', '300', '400', '500', '600', '700', '900'],\n display: 'swap',\n});\n\nexport const metadata: Metadata = {\n title: '${answers.projectName}',\n description: '${answers.description}',\n};\n\nexport default function RootLayout({\n children,\n}: Readonly<{\n children: React.ReactNode;\n}>) {\n return (\n <html lang=\"en\" suppressHydrationWarning={${answers.darkMode ? 'true' : 'false'}}>\n <body className={\\`\\${livvic.variable} ${answers.darkMode ? 'bg-light dark:bg-dark ' : ''}antialiased\\`}>\n <RootProvider>\n {children}\n </RootProvider>\n </body>\n </html>\n );\n}\n`;\n await writeFile(path.join(projectPath, PROJECT_PATHS.ROOT_LAYOUT), basicLayout);\n\n // Generate page.tsx with Counter if Redux is enabled\n const counterImport = answers.redux ? \"import { Counter } from '@/features/counter';\\n\\n\" : '';\n const counterComponent = answers.redux ? '\\n <Counter />' : '';\n\n const basicPage = `${counterImport}export default function Home() {\n return (\n <div className=\"flex min-h-screen flex-col items-center justify-center p-24\">\n <h1 className=\"text-4xl font-bold\">Welcome to ${answers.projectName}</h1>\n <p className=\"mt-4 text-xl\">Get started by editing src/app/page.tsx</p>${counterComponent}\n </div>\n );\n}\n`;\n await writeFile(path.join(projectPath, PROJECT_PATHS.ROOT_PAGE), basicPage);\n }\n};\n", "import path from 'node:path';\nimport { readdir } from 'node:fs/promises';\nimport {\n deleteDirectory,\n deleteFile,\n fileExists,\n readFile,\n updateJson,\n writeFile,\n} from '../../core/files';\nimport { ProjectPrompts } from '../../prompts/create-app.prompt';\nimport { PROJECT_PATHS } from '../../config/paths';\nimport { PACKAGES } from '../../config/packages';\n\nexport const setupDevTools = async (\n projectPath: string,\n answers: ProjectPrompts,\n): Promise<void> => {\n await setupPreCommitHooks(projectPath, answers);\n await setupCommitizen(projectPath, answers);\n await setupCiCd(projectPath, answers);\n await setupGithubTemplates(projectPath, answers);\n await setupCommunityFiles(projectPath, answers);\n await setupDocker(projectPath, answers);\n await setupReadme(projectPath, answers);\n};\n\nconst setupPreCommitHooks = async (projectPath: string, answers: ProjectPrompts): Promise<void> => {\n if (!answers.preCommitHooks) {\n await deleteDirectory(path.join(projectPath, PROJECT_PATHS.HUSKY_DIR));\n await deleteFile(path.join(projectPath, PROJECT_PATHS.COMMITLINT_CONFIG));\n await deleteFile(path.join(projectPath, PROJECT_PATHS.LINTSTAGED_RC));\n\n await updateJson(path.join(projectPath, PROJECT_PATHS.PACKAGE_JSON), (pkg) => {\n delete pkg.devDependencies[PACKAGES.HUSKY];\n delete pkg.devDependencies[PACKAGES.COMMITLINT_CLI];\n delete pkg.devDependencies[PACKAGES.COMMITLINT_CONFIG];\n delete pkg.devDependencies[PACKAGES.LINT_STAGED];\n delete pkg.scripts['prepare'];\n delete pkg.scripts['postinstall'];\n delete pkg.commitlint;\n delete pkg['lint-staged'];\n return pkg;\n });\n }\n};\n\nconst setupCommitizen = async (projectPath: string, answers: ProjectPrompts): Promise<void> => {\n if (!answers.commitizen) {\n await deleteFile(path.join(projectPath, PROJECT_PATHS.CZRC));\n\n await updateJson(path.join(projectPath, PROJECT_PATHS.PACKAGE_JSON), (pkg) => {\n delete pkg.devDependencies[PACKAGES.COMMITIZEN];\n delete pkg.devDependencies[PACKAGES.CZ_CONVENTIONAL_CHANGELOG];\n delete pkg.config?.commitizen;\n if (pkg.config && Object.keys(pkg.config).length === 0) {\n delete pkg.config;\n }\n delete pkg.scripts['commit'];\n return pkg;\n });\n }\n};\n\nconst setupCiCd = async (projectPath: string, answers: ProjectPrompts): Promise<void> => {\n if (!answers.ci) {\n await deleteDirectory(path.join(projectPath, PROJECT_PATHS.GITHUB_WORKFLOWS));\n }\n};\n\nconst setupGithubTemplates = async (\n projectPath: string,\n answers: ProjectPrompts,\n): Promise<void> => {\n const githubPath = path.join(projectPath, PROJECT_PATHS.GITHUB_DIR);\n if (!answers.keepTemplates) {\n await deleteDirectory(path.join(githubPath, PROJECT_PATHS.GITHUB_ISSUE_TEMPLATE));\n await deleteFile(path.join(githubPath, PROJECT_PATHS.GITHUB_PR_TEMPLATE));\n } else {\n const issueTemplatePath = path.join(githubPath, PROJECT_PATHS.GITHUB_ISSUE_TEMPLATE);\n const prTemplatePath = path.join(githubPath, PROJECT_PATHS.GITHUB_PR_TEMPLATE);\n\n const replacePlaceholders = (content: string) => {\n return content\n .replace(/Teispace/g, answers.company)\n .replace(/support@teispace\\.com/g, answers.email)\n .replace(/Next\\.js Starter/g, answers.projectName)\n .replace(/\\[AUTHOR\\]/g, answers.author)\n .replace(/\\[COMPANY\\]/g, answers.company)\n .replace(/\\[EMAIL\\]/g, answers.email);\n };\n\n if (fileExists(prTemplatePath)) {\n let content = await readFile(prTemplatePath);\n content = replacePlaceholders(content);\n await writeFile(prTemplatePath, content);\n }\n\n try {\n if (fileExists(issueTemplatePath)) {\n const files = await readdir(issueTemplatePath);\n for (const file of files) {\n const filePath = path.join(issueTemplatePath, file);\n let content = await readFile(filePath);\n content = replacePlaceholders(content);\n await writeFile(filePath, content);\n }\n }\n } catch {\n // Ignore\n }\n }\n};\n\nconst setupCommunityFiles = async (projectPath: string, answers: ProjectPrompts): Promise<void> => {\n const allCommunityFiles = [\n PROJECT_PATHS.CODE_OF_CONDUCT,\n PROJECT_PATHS.CONTRIBUTING,\n PROJECT_PATHS.SECURITY,\n ];\n for (const file of allCommunityFiles) {\n if (!answers.communityFiles.includes(file)) {\n await deleteFile(path.join(projectPath, file));\n }\n }\n};\n\nconst setupDocker = async (projectPath: string, answers: ProjectPrompts): Promise<void> => {\n if (!answers.docker) {\n await deleteFile(path.join(projectPath, PROJECT_PATHS.DOCKERFILE));\n await deleteFile(path.join(projectPath, PROJECT_PATHS.DOCKER_COMPOSE));\n await deleteFile(path.join(projectPath, PROJECT_PATHS.DOCKERIGNORE));\n\n const envPath = path.join(projectPath, PROJECT_PATHS.ENV_EXAMPLE);\n if (fileExists(envPath)) {\n let envContent = await readFile(envPath);\n envContent = envContent.replace(/# Docker Compose Configuration\\n/, '');\n envContent = envContent.replace(/CONTAINER_NAME=.*\\n/, '');\n envContent = envContent.replace(/IMAGE_NAME=.*\\n/, '');\n envContent = envContent.replace(/IMAGE_TAG=.*\\n/, '');\n await writeFile(envPath, envContent);\n }\n } else {\n const envPath = path.join(projectPath, PROJECT_PATHS.ENV_EXAMPLE);\n if (fileExists(envPath)) {\n let envContent = await readFile(envPath);\n const updateEnvVar = (key: string, value: string) => {\n const regex = new RegExp(`${key}=.*`);\n if (regex.test(envContent)) {\n envContent = envContent.replace(regex, `${key}=${value}`);\n } else {\n envContent += `${key}=${value}\\n`;\n }\n };\n\n updateEnvVar('CONTAINER_NAME', answers.containerName || 'next-app');\n updateEnvVar('IMAGE_NAME', answers.imageName || 'nextjs-starter');\n updateEnvVar('IMAGE_TAG', answers.imageTag || 'latest');\n\n await writeFile(envPath, envContent);\n }\n }\n};\n\nconst setupReadme = async (projectPath: string, answers: ProjectPrompts): Promise<void> => {\n const findReadmes = async (dir: string): Promise<string[]> => {\n const entries = await readdir(dir, { withFileTypes: true });\n const files: string[] = [];\n for (const entry of entries) {\n const fullPath = path.join(dir, entry.name);\n if (entry.isDirectory() && entry.name !== 'node_modules' && entry.name !== '.git') {\n files.push(...(await findReadmes(fullPath)));\n } else if (entry.isFile() && entry.name.toLowerCase() === 'readme.md') {\n files.push(fullPath);\n }\n }\n return files;\n };\n\n const allReadmes = await findReadmes(projectPath);\n const rootReadmePath = path.join(projectPath, PROJECT_PATHS.README);\n\n for (const readmePath of allReadmes) {\n if (readmePath !== rootReadmePath) {\n await deleteFile(readmePath);\n }\n }\n\n if (answers.readme) {\n const simpleReadme = `# ${answers.projectName}\n\n${answers.description}\n\n## Getting Started\n\nFirst, run the development server:\n\n\\`\\`\\`bash\n${answers.packageManager === 'npm' ? 'npm run dev' : answers.packageManager + ' dev'}\n\\`\\`\\`\n\nOpen [http://localhost:3000](http://localhost:3000) with your browser to see the result.\n`;\n await writeFile(rootReadmePath, simpleReadme);\n } else {\n await deleteFile(rootReadmePath);\n }\n};\n", "import { Command } from 'commander';\nimport pc from 'picocolors';\nimport path from 'node:path';\nimport { log, logError, spinner } from '../config';\nimport { promptForFeatureDetails } from '../prompts/feature.prompt';\nimport { detectProjectSetup, featureExists } from '../services/feature/detection.service';\nimport { generateFeatureStructure } from '../services/feature/templates.service';\nimport { registerFeatureInRootReducer } from '../services/feature/registration.service';\nimport { registerApiEndpoints } from '../services/common/api-registration.service';\n\ninterface FeatureCommandOptions {\n skipStore?: boolean;\n store?: 'persist' | 'no-persist';\n skipService?: boolean;\n service?: 'axios' | 'fetch';\n path?: string;\n}\n\nexport const registerFeatureCommand = (program: Command) => {\n program\n .command('feature [name]')\n .description('Generate a new feature module')\n .option('--skip-store', 'Skip Redux store generation')\n .option('--store <type>', 'Generate Redux store with persistence option (persist|no-persist)')\n .option('--skip-service', 'Skip API service generation')\n .option('--service <client>', 'Generate API service with specific HTTP client (axios|fetch)')\n .option('--path <path>', 'Custom path for feature generation (default: src/features)')\n .action(async (name: string | undefined, options: FeatureCommandOptions) => {\n try {\n const projectPath = process.cwd();\n\n // Validate store option\n if (options.store && !['persist', 'no-persist'].includes(options.store)) {\n logError('Invalid --store option. Use: persist or no-persist');\n process.exit(1);\n }\n\n // Validate service option\n if (options.service && !['axios', 'fetch'].includes(options.service)) {\n logError('Invalid --service option. Use: axios or fetch');\n process.exit(1);\n }\n\n // Validate conflicting options\n if (options.skipStore && options.store) {\n logError('Cannot use --skip-store and --store together');\n process.exit(1);\n }\n\n if (options.skipService && options.service) {\n logError('Cannot use --skip-service and --service together');\n process.exit(1);\n }\n\n log(pc.cyan('\\n\uD83C\uDFAF Feature Generator\\n'));\n\n // Step 1: Detect project setup\n spinner.start('Detecting project setup...');\n const detection = await detectProjectSetup(projectPath);\n spinner.succeed('Project setup detected');\n\n log(pc.dim(` Redux: ${detection.hasRedux ? '\u2713' : '\u2717'}`));\n log(pc.dim(` HTTP Client: ${detection.httpClient}`));\n log(pc.dim(` i18n: ${detection.hasI18n ? '\u2713' : '\u2717'}\\n`));\n\n // Step 2: Prompt for feature details\n const featureOptions = await promptForFeatureDetails(\n name,\n detection.hasRedux,\n detection.httpClient,\n options.skipStore,\n options.store,\n options.skipService,\n options.service,\n );\n\n // Step 3: Determine feature path\n const basePath = options.path || path.join('src', 'features');\n const featurePath = path.join(projectPath, basePath, featureOptions.featureName);\n\n // Check if feature already exists\n const exists = await featureExists(projectPath, featureOptions.featureName, basePath);\n if (exists) {\n logError(`Feature '${featureOptions.featureName}' already exists at ${basePath}!`);\n process.exit(1);\n }\n\n // Step 4: Generate feature structure\n spinner.start('Generating feature files...');\n\n await generateFeatureStructure({\n featureName: featureOptions.featureName,\n featurePath,\n createStore: featureOptions.createStore,\n persistStore: featureOptions.persistStore,\n createService: featureOptions.createService,\n httpClient: featureOptions.selectedHttpClient,\n });\n\n spinner.succeed('Feature files generated');\n\n // Step 5: Register API endpoints if service was created\n if (featureOptions.createService) {\n spinner.start('Registering API endpoints...');\n await registerApiEndpoints({\n serviceName: featureOptions.featureName,\n projectPath,\n });\n spinner.succeed('API endpoints registered');\n }\n\n // Step 6: Register in rootReducer if store was created\n if (featureOptions.createStore && detection.hasRedux) {\n spinner.start('Registering feature in rootReducer...');\n await registerFeatureInRootReducer(\n projectPath,\n featureOptions.featureName,\n featureOptions.persistStore,\n basePath,\n );\n spinner.succeed('Feature registered in rootReducer');\n }\n\n // Success message\n const displayPath = path.join(basePath, featureOptions.featureName);\n log(pc.green(`\\n\u2728 Feature '${featureOptions.featureName}' created successfully!\\n`));\n log(pc.dim('Generated files:'));\n log(pc.dim(` \uD83D\uDCC2 ${displayPath}/`));\n log(pc.dim(` \u251C\u2500\u2500 components/`));\n log(pc.dim(` \u251C\u2500\u2500 hooks/`));\n log(pc.dim(` \u251C\u2500\u2500 types/`));\n if (featureOptions.createStore) log(pc.dim(` \u251C\u2500\u2500 store/`));\n if (featureOptions.createService) log(pc.dim(` \u251C\u2500\u2500 services/`));\n log(pc.dim(` \u2514\u2500\u2500 index.ts\\n`));\n\n log(pc.cyan('Next steps:'));\n const importPath = basePath.replace(/^src\\//, '@/');\n log(\n pc.dim(\n ` 1. Import and use the feature: import { ${featureOptions.featureName} } from '${importPath}/${featureOptions.featureName}'`,\n ),\n );\n if (featureOptions.createStore) {\n log(pc.dim(` 2. Customize your Redux slice in: ${displayPath}/store/`));\n }\n if (featureOptions.createService) {\n log(\n pc.dim(\n ` 3. Add API methods in: ${displayPath}/services/${featureOptions.featureName}.service.ts`,\n ),\n );\n }\n log('');\n } catch (error) {\n spinner.fail('Feature generation failed');\n logError(`${error}`);\n process.exit(1);\n }\n });\n};\n", "import Enquirer from 'enquirer';\nconst { prompt } = Enquirer;\n\nexport interface FeatureOptions {\n featureName: string;\n hasRedux: boolean;\n createStore: boolean;\n persistStore: boolean;\n httpClient: 'axios' | 'fetch' | 'both' | 'none';\n createService: boolean;\n selectedHttpClient?: 'axios' | 'fetch';\n}\n\nexport const promptForFeatureDetails = async (\n featureName?: string,\n hasRedux?: boolean,\n httpClient?: 'axios' | 'fetch' | 'both' | 'none',\n skipStore?: boolean,\n storeOption?: 'persist' | 'no-persist',\n skipService?: boolean,\n serviceClient?: 'axios' | 'fetch',\n): Promise<FeatureOptions> => {\n const questions: any[] = [];\n\n // Feature name\n if (!featureName) {\n questions.push({\n type: 'input',\n name: 'featureName',\n message: 'What is the feature name?',\n initial: 'my-feature',\n validate: (value: string) => {\n if (!/^[a-z0-9-]+$/.test(value)) {\n return 'Feature name must be lowercase and contain only alphanumeric characters and hyphens.';\n }\n return true;\n },\n });\n }\n\n // Redux store questions\n if (hasRedux && skipStore === undefined && storeOption === undefined) {\n questions.push({\n type: 'confirm',\n name: 'createStore',\n message: 'Generate Redux store for this feature?',\n initial: true,\n });\n\n questions.push({\n type: 'confirm',\n name: 'persistStore',\n message: 'Enable persistence for this store?',\n initial: false,\n skip() {\n // Skip if createStore is false\n\n return !(this as any).state.answers.createStore;\n },\n });\n }\n\n // HTTP service questions\n if (\n httpClient &&\n httpClient !== 'none' &&\n skipService === undefined &&\n serviceClient === undefined\n ) {\n questions.push({\n type: 'confirm',\n name: 'createService',\n message: 'Generate API service for this feature?',\n initial: true,\n });\n\n if (httpClient === 'both') {\n questions.push({\n type: 'select',\n name: 'selectedHttpClient',\n message: 'Which HTTP client to use for the service?',\n choices: ['fetch', 'axios'],\n initial: 0,\n skip() {\n // Skip if createService is false\n\n return !(this as any).state.answers.createService;\n },\n });\n }\n }\n\n const answers: any = questions.length > 0 ? await prompt(questions) : {};\n\n return {\n featureName: featureName || (answers.featureName as string),\n hasRedux: hasRedux || false,\n createStore:\n skipStore === true\n ? false\n : storeOption !== undefined\n ? true\n : (answers.createStore as boolean) || false,\n persistStore:\n storeOption === 'persist'\n ? true\n : storeOption === 'no-persist'\n ? false\n : (answers.persistStore as boolean) || false,\n httpClient: httpClient || 'none',\n createService:\n skipService === true\n ? false\n : serviceClient !== undefined\n ? true\n : (answers.createService as boolean) || false,\n selectedHttpClient:\n serviceClient ||\n (answers.selectedHttpClient as 'axios' | 'fetch' | undefined) ||\n (httpClient === 'both' ? 'fetch' : httpClient !== 'none' ? httpClient : undefined),\n };\n};\n", "import { readFile, access } from 'node:fs/promises';\nimport path from 'node:path';\n\nexport interface ProjectDetection {\n hasRedux: boolean;\n httpClient: 'axios' | 'fetch' | 'both' | 'none';\n hasI18n: boolean;\n}\n\nexport const detectProjectSetup = async (projectPath: string): Promise<ProjectDetection> => {\n let hasRedux = false;\n let hasAxios = false;\n let hasFetch = false;\n let hasI18n = false;\n\n try {\n // Read package.json\n const packageJsonPath = path.join(projectPath, 'package.json');\n const packageJsonContent = await readFile(packageJsonPath, 'utf-8');\n const packageJson = JSON.parse(packageJsonContent);\n\n const dependencies = {\n ...packageJson.dependencies,\n ...packageJson.devDependencies,\n };\n\n // Check for Redux\n hasRedux = !!(dependencies['@reduxjs/toolkit'] && dependencies['react-redux']);\n\n // Check for axios\n hasAxios = !!dependencies['axios'];\n\n // Check for i18n\n hasI18n = !!dependencies['next-intl'];\n\n // Check if axios client exists\n const axiosClientPath = path.join(projectPath, 'src', 'lib', 'utils', 'http', 'axios-client');\n try {\n await access(axiosClientPath);\n hasAxios = hasAxios && true; // Confirm axios is both installed and client exists\n } catch {\n hasAxios = false; // Axios client doesn't exist\n }\n\n // Check if fetch client exists\n const fetchClientPath = path.join(projectPath, 'src', 'lib', 'utils', 'http', 'fetch-client');\n try {\n await access(fetchClientPath);\n hasFetch = true;\n } catch {\n hasFetch = false; // Fetch client doesn't exist\n }\n\n // Determine HTTP client setup\n let httpClient: 'axios' | 'fetch' | 'both' | 'none';\n if (hasAxios && hasFetch) {\n httpClient = 'both';\n } else if (hasAxios) {\n httpClient = 'axios';\n } else if (hasFetch) {\n httpClient = 'fetch';\n } else {\n httpClient = 'none';\n }\n\n return {\n hasRedux,\n httpClient,\n hasI18n,\n };\n } catch (error) {\n throw new Error(`Failed to detect project setup: ${error}`);\n }\n};\n\nexport const featureExists = async (\n projectPath: string,\n featureName: string,\n basePath: string = path.join('src', 'features'),\n): Promise<boolean> => {\n const featurePath = path.join(projectPath, basePath, featureName);\n try {\n await access(featurePath);\n return true;\n } catch {\n return false;\n }\n};\n", "import { writeFile, mkdir } from 'node:fs/promises';\nimport path from 'node:path';\nimport { kebabToCamel, kebabToPascal } from '../../config/utils';\n\nexport interface FeatureGenerationOptions {\n featureName: string;\n featurePath: string;\n createStore: boolean;\n persistStore: boolean;\n createService: boolean;\n httpClient?: 'axios' | 'fetch';\n}\n\nexport const generateFeatureStructure = async (\n options: FeatureGenerationOptions,\n): Promise<void> => {\n const { featurePath } = options;\n\n // Create feature directories\n await mkdir(path.join(featurePath, 'components'), { recursive: true });\n await mkdir(path.join(featurePath, 'hooks'), { recursive: true });\n await mkdir(path.join(featurePath, 'types'), { recursive: true });\n\n if (options.createStore) {\n await mkdir(path.join(featurePath, 'store'), { recursive: true });\n }\n\n if (options.createService) {\n await mkdir(path.join(featurePath, 'services'), { recursive: true });\n }\n\n // Generate files\n await generateComponentFile(options);\n await generateHookFile(options);\n await generateTypesFile(options);\n await generateIndexFile(options);\n\n if (options.createStore) {\n await generateStoreFiles(options);\n }\n\n if (options.createService && options.httpClient) {\n await generateServiceFile(options);\n }\n};\n\nexport const getProjectPathFromFeaturePath = (featurePath: string): string => {\n // Extract project root from feature path\n // featurePath format: /path/to/project/src/features/featureName\n const srcIndex = featurePath.indexOf('/src/features');\n if (srcIndex === -1) {\n throw new Error('Could not determine project path from feature path');\n }\n return featurePath.substring(0, srcIndex);\n};\n\nconst generateComponentFile = async (options: FeatureGenerationOptions): Promise<void> => {\n const { featureName, featurePath } = options;\n const componentName = kebabToPascal(featureName);\n const hookName = `use${componentName}`;\n\n const content = `'use client';\nimport { ${hookName} } from '../hooks/${hookName}';\n\nexport function ${componentName}() {\n const {} = ${hookName}();\n\n return (\n <div>\n <h2>${componentName} Component</h2>\n {/* Add your component UI here */}\n </div>\n );\n}\n\nexport default ${componentName};\n`;\n\n await writeFile(path.join(featurePath, 'components', `${componentName}.tsx`), content);\n};\n\nconst generateHookFile = async (options: FeatureGenerationOptions): Promise<void> => {\n const { featureName, featurePath, createStore } = options;\n const componentName = kebabToPascal(featureName);\n const hookName = `use${componentName}`;\n\n let content: string;\n\n if (createStore) {\n content = `'use client';\nimport { useAppDispatch, useAppSelector } from '@/store/hooks';\nimport { select${componentName}State, setLoading, setError } from '../store/${featureName}.selectors';\n\nexport const ${hookName} = () => {\n const dispatch = useAppDispatch();\n const state = useAppSelector(select${componentName}State);\n\n const handleSetLoading = (loading: boolean) => {\n dispatch(setLoading(loading));\n console.log('Loading state updated:', loading);\n };\n\n const handleSetError = (error: string | null) => {\n dispatch(setError(error));\n console.log('Error state updated:', error);\n };\n\n return {\n state,\n setLoading: handleSetLoading,\n setError: handleSetError,\n } as const;\n};\n`;\n } else {\n content = `'use client';\nimport { useState } from 'react';\n\nexport const ${hookName} = () => {\n // Add your state and logic here\n const [state, setState] = useState({});\n\n return {\n state,\n // Add your methods here\n } as const;\n};\n`;\n }\n\n await writeFile(path.join(featurePath, 'hooks', `${hookName}.ts`), content);\n};\n\nconst generateTypesFile = async (options: FeatureGenerationOptions): Promise<void> => {\n const { featureName, featurePath, createStore } = options;\n const componentName = kebabToPascal(featureName);\n const typeName = `${componentName}State`;\n\n const content = `export interface ${typeName} {\n // Add your state properties here\n ${createStore ? 'loading: boolean;\\n error: string | null;' : '// example: value: string;'}\n}\n`;\n\n await writeFile(path.join(featurePath, 'types', `${featureName}.types.ts`), content);\n};\n\nconst generateStoreFiles = async (options: FeatureGenerationOptions): Promise<void> => {\n const { featureName, featurePath, persistStore } = options;\n const componentName = kebabToPascal(featureName);\n const camelName = kebabToCamel(featureName);\n\n // Generate slice\n const sliceContent = `import { createSlice, PayloadAction } from '@reduxjs/toolkit';\nimport { ${componentName}State } from '../types/${featureName}.types';\n\nconst initialState: ${componentName}State = {\n loading: false,\n error: null,\n // Add your initial state here\n};\n\nexport const ${camelName}Slice = createSlice({\n name: '${camelName}',\n initialState,\n reducers: {\n setLoading: (state, action: PayloadAction<boolean>) => {\n state.loading = action.payload;\n },\n setError: (state, action: PayloadAction<string | null>) => {\n state.error = action.payload;\n },\n resetState: (state) => {\n state.loading = false;\n state.error = null;\n },\n },\n});\n\nexport const { setLoading, setError, resetState } = ${camelName}Slice.actions;\n\nexport const ${camelName}Reducer = ${camelName}Slice.reducer;\n`;\n\n await writeFile(path.join(featurePath, 'store', `${featureName}.slice.ts`), sliceContent);\n\n // Generate selectors\n const selectorsContent = `import { RootState } from '@/store/rootReducer';\n\nexport const select${componentName}State = (state: RootState) => state.${camelName};\nexport { setLoading, setError, resetState } from './${featureName}.slice';\n`;\n\n await writeFile(path.join(featurePath, 'store', `${featureName}.selectors.ts`), selectorsContent);\n\n // Generate persist config if needed\n if (persistStore) {\n const persistContent = `import { PersistConfig } from 'redux-persist';\nimport storage from 'redux-persist/lib/storage';\nimport { ${componentName}State } from '../types/${featureName}.types';\n\nexport const ${camelName}PersistConfig: PersistConfig<${componentName}State> = {\n key: '${camelName}',\n storage,\n // whitelist: ['someField'], // Specify which fields to persist\n};\n`;\n\n await writeFile(path.join(featurePath, 'store', 'persist.ts'), persistContent);\n }\n\n // Generate store index\n const storeIndexContent = `export * from './${featureName}.slice';\nexport * from './${featureName}.selectors';${persistStore ? \"\\nexport * from './persist';\" : ''}\n`;\n\n await writeFile(path.join(featurePath, 'store', 'index.ts'), storeIndexContent);\n};\n\nconst generateServiceFile = async (options: FeatureGenerationOptions): Promise<void> => {\n const { featureName, featurePath, httpClient } = options;\n const camelName = kebabToCamel(featureName);\n\n let content: string;\n\n if (httpClient === 'axios') {\n content = `import { AppApis } from '@/lib/config';\nimport { axiosClient } from '@/lib/utils/http';\nimport { ResultAsync } from '@/types';\n\nexport const ${camelName}Service = {\n getAll: (): ResultAsync<string> => {\n return axiosClient.get<string>(AppApis.${camelName}.getAll);\n },\n};\n`;\n } else {\n // fetch\n content = `import { AppApis } from '@/lib/config';\nimport { fetchClient } from '@/lib/utils/http';\nimport { ResultAsync } from '@/types';\n\nexport const ${camelName}Service = {\n getAll: (): ResultAsync<string> => {\n return fetchClient.get<string>(AppApis.${camelName}.getAll);\n },\n};\n`;\n }\n\n await writeFile(path.join(featurePath, 'services', `${featureName}.service.ts`), content);\n};\n\nconst generateIndexFile = async (options: FeatureGenerationOptions): Promise<void> => {\n const { featureName, featurePath, createStore, createService } = options;\n const componentName = kebabToPascal(featureName);\n\n const content = `export { default as ${componentName} } from './components/${componentName}';\nexport { use${componentName} } from './hooks/use${componentName}';\nexport * from './types/${featureName}.types';${createStore ? `\\nexport * from './store';` : ''}${createService ? `\\nexport * from './services/${featureName}.service';` : ''}\n`;\n\n await writeFile(path.join(featurePath, 'index.ts'), content);\n};\n", "import { readFile, writeFile } from 'node:fs/promises';\nimport path from 'node:path';\nimport { kebabToCamel } from '../../config/utils';\n\nexport const registerFeatureInRootReducer = async (\n projectPath: string,\n featureName: string,\n withPersist: boolean,\n basePath: string = path.join('src', 'features'),\n): Promise<void> => {\n const rootReducerPath = path.join(projectPath, 'src', 'store', 'rootReducer.ts');\n\n try {\n let content = await readFile(rootReducerPath, 'utf-8');\n\n const camelName = kebabToCamel(featureName);\n const reducerName = `${camelName}Reducer`;\n const importName = withPersist ? `${camelName}PersistConfig` : '';\n\n // Convert path to import alias format (src/features -> @/features)\n const importPath = basePath.replace(/^src\\//, '@/');\n\n // Add import statement\n const importStatement = withPersist\n ? `import { ${reducerName}, ${importName} } from '${importPath}/${featureName}/store';`\n : `import { ${reducerName} } from '${importPath}/${featureName}/store';`;\n\n // Find the last import statement\n const importRegex = /import\\s+.*\\s+from\\s+['\"].*['\"];?\\n/g;\n const imports = content.match(importRegex);\n if (imports && imports.length > 0) {\n const lastImport = imports[imports.length - 1];\n const lastImportIndex = content.lastIndexOf(lastImport);\n content =\n content.slice(0, lastImportIndex + lastImport.length) +\n importStatement +\n '\\n' +\n content.slice(lastImportIndex + lastImport.length);\n } else {\n // No imports found, add at the beginning\n content = importStatement + '\\n' + content;\n }\n\n // Add reducer to combineReducers\n const combineReducersRegex = /combineReducers\\(\\{([^}]*)\\}\\)/s;\n const match = content.match(combineReducersRegex);\n\n if (match) {\n const reducersContent = match[1];\n const newReducerEntry = withPersist\n ? `\\n ${camelName}: persistReducer(${importName}, ${reducerName}),`\n : `\\n ${camelName}: ${reducerName},`;\n\n const updatedReducersContent = reducersContent.trimEnd() + newReducerEntry;\n content = content.replace(\n combineReducersRegex,\n `combineReducers({${updatedReducersContent}\\n})`,\n );\n } else {\n throw new Error('Could not find combineReducers in rootReducer.ts');\n }\n\n await writeFile(rootReducerPath, content);\n } catch (error) {\n throw new Error(`Failed to register feature in rootReducer: ${error}`);\n }\n};\n\n/**\n * Register a slice in rootReducer (imports from index.ts, not store/)\n */\nexport const registerSliceInRootReducer = async (\n projectPath: string,\n sliceName: string,\n withPersist: boolean,\n basePath: string,\n): Promise<void> => {\n const rootReducerPath = path.join(projectPath, 'src', 'store', 'rootReducer.ts');\n\n try {\n let content = await readFile(rootReducerPath, 'utf-8');\n\n const camelName = kebabToCamel(sliceName);\n const reducerName = `${camelName}Reducer`;\n const importName = withPersist ? `${camelName}PersistConfig` : '';\n\n // Convert path to import alias format (src/store -> @/store)\n const importPath = basePath.replace(/^src\\//, '@/');\n\n // Add import statement (import from index, not /store)\n const importStatement = withPersist\n ? `import { ${reducerName}, ${importName} } from '${importPath}/${sliceName}';`\n : `import { ${reducerName} } from '${importPath}/${sliceName}';`;\n\n // Find the last import statement\n const importRegex = /import\\s+.*\\s+from\\s+['\"].*['\"];?\\n/g;\n const imports = content.match(importRegex);\n if (imports && imports.length > 0) {\n const lastImport = imports[imports.length - 1];\n const lastImportIndex = content.lastIndexOf(lastImport);\n content =\n content.slice(0, lastImportIndex + lastImport.length) +\n importStatement +\n '\\n' +\n content.slice(lastImportIndex + lastImport.length);\n } else {\n // No imports found, add at the beginning\n content = importStatement + '\\n' + content;\n }\n\n // Add reducer to combineReducers\n const combineReducersRegex = /combineReducers\\(\\{([^}]*)\\}\\)/s;\n const match = content.match(combineReducersRegex);\n\n if (match) {\n const reducersContent = match[1];\n const newReducerEntry = withPersist\n ? `\\n ${camelName}: persistReducer(${importName}, ${reducerName}),`\n : `\\n ${camelName}: ${reducerName},`;\n\n const updatedReducersContent = reducersContent.trimEnd() + newReducerEntry;\n content = content.replace(\n combineReducersRegex,\n `combineReducers({${updatedReducersContent}\\n})`,\n );\n } else {\n throw new Error('Could not find combineReducers in rootReducer.ts');\n }\n\n await writeFile(rootReducerPath, content);\n } catch (error) {\n throw new Error(`Failed to register slice in rootReducer: ${error}`);\n }\n};\n", "import { readFile, writeFile } from 'node:fs/promises';\nimport path from 'node:path';\nimport { kebabToCamel } from '../../config/utils';\n\ninterface RegisterApiOptions {\n serviceName: string;\n projectPath: string;\n}\n\nexport const registerApiEndpoints = async (options: RegisterApiOptions): Promise<void> => {\n const { serviceName, projectPath } = options;\n const camelName = kebabToCamel(serviceName);\n const apiConfigPath = path.join(projectPath, 'src', 'lib', 'config', 'app-apis.ts');\n\n try {\n // Read the current app-apis.ts file\n const content = await readFile(apiConfigPath, 'utf-8');\n\n // Check if the service already exists in the file\n if (content.includes(`${camelName}:`)) {\n // Service already registered, skip\n return;\n }\n\n // Find the position to insert the new API endpoint\n // Looking for the closing brace of AppApis object\n const appApisMatch = content.match(/export const AppApis = \\{[\\s\\S]*?\\} as const;/);\n\n if (!appApisMatch) {\n throw new Error('Could not find AppApis object in app-apis.ts');\n }\n\n // Create the new API endpoint entry\n const newEndpoint = ` ${camelName}: {\n base: \\`\\${API_PREFIX}/${serviceName}\\`,\n getAll: \\`\\${API_PREFIX}/${serviceName}\\`,\n },`;\n\n // Find the position before the closing brace\n const closingBracePattern = /(\\s*)\\} as const;/;\n const match = content.match(closingBracePattern);\n\n if (!match) {\n throw new Error('Could not find closing brace of AppApis object');\n }\n\n // Insert the new endpoint before the closing brace\n const insertPosition = content.lastIndexOf('} as const;');\n const beforeClosing = content.substring(0, insertPosition);\n const afterClosing = content.substring(insertPosition);\n\n // Check if there's already content in AppApis\n const hasExistingEndpoints = beforeClosing.trim().endsWith(',');\n const needsComma = beforeClosing.match(/:\\s*\\{[^}]*\\},\\s*$/);\n\n let updatedContent: string;\n if (needsComma || hasExistingEndpoints) {\n // There are existing endpoints, add comma and new endpoint\n updatedContent = `${beforeClosing}\\n${newEndpoint}\\n${afterClosing}`;\n } else {\n // First endpoint after auth (or empty object), just add it\n updatedContent = beforeClosing.trimEnd() + '\\n' + newEndpoint + '\\n' + afterClosing;\n }\n\n // Write the updated content back\n await writeFile(apiConfigPath, updatedContent);\n } catch (error) {\n throw new Error(`Failed to register API endpoints: ${error}`);\n }\n};\n", "import { Command } from 'commander';\nimport pc from 'picocolors';\nimport path from 'node:path';\nimport { existsSync } from 'node:fs';\nimport { mkdir } from 'node:fs/promises';\nimport { log, logError, spinner } from '../config';\nimport { promptForSliceDetails } from '../prompts/slice.prompt';\nimport { detectProjectSetup } from '../services/feature/detection.service';\nimport { generateSliceFiles } from '../services/slice/slice.service';\nimport { registerSliceInRootReducer } from '../services/feature/registration.service';\nimport { sliceExists } from '../services/slice/detection.service';\n\ninterface SliceCommandOptions {\n path?: string;\n persist?: boolean;\n noPersist?: boolean;\n}\n\nexport const registerSliceCommand = (program: Command) => {\n program\n .command('slice [name]')\n .description('Generate a Redux slice')\n .option('--path <path>', 'Custom path for slice generation (default: create new feature)')\n .option('--persist', 'Enable persistence for this slice')\n .option('--no-persist', 'Disable persistence for this slice')\n .action(async (name: string | undefined, options: SliceCommandOptions) => {\n try {\n const projectPath = process.cwd();\n\n // Validate conflicting options\n if (options.persist && options.noPersist === true) {\n logError('Cannot use --persist and --no-persist together');\n process.exit(1);\n }\n\n log(pc.cyan('\\n\uD83D\uDD27 Slice Generator\\n'));\n\n // Step 1: Detect project setup\n spinner.start('Detecting project setup...');\n const detection = await detectProjectSetup(projectPath);\n spinner.succeed('Project setup detected');\n\n // Step 2: Check if Redux is setup\n if (!detection.hasRedux) {\n spinner.fail('Redux is not setup in this project');\n logError('Please install @reduxjs/toolkit and react-redux first');\n log(pc.dim('\\nRun: npm install @reduxjs/toolkit react-redux\\n'));\n process.exit(1);\n }\n\n log(pc.dim(` Redux: \u2713\\n`));\n\n // Step 3: Prompt for slice details\n const sliceOptions = await promptForSliceDetails(\n name,\n options.persist,\n options.noPersist === true ? false : undefined,\n );\n\n // Step 4: Determine slice path (feature-first approach)\n let basePath: string;\n let featureName: string;\n let slicePath: string;\n\n if (options.path) {\n // Custom path provided\n const customPath = options.path.replace(/^src\\//, '');\n\n // Check if custom path is a feature\n if (customPath.startsWith('features/')) {\n // Extract feature name and ensure store subdirectory\n const parts = customPath.split('/');\n featureName = parts[1]; // features/featureName/...\n basePath = path.join('src', 'features', featureName, 'store');\n slicePath = path.join(projectPath, basePath, sliceOptions.sliceName);\n } else {\n // Non-feature custom path - use as-is but treat as feature store\n basePath = path.join('src', customPath);\n featureName = customPath.split('/')[0]; // First directory as feature name\n slicePath = path.join(projectPath, basePath, sliceOptions.sliceName);\n }\n } else {\n // Default: Create new feature with store\n featureName = sliceOptions.sliceName;\n basePath = path.join('src', 'features', featureName, 'store');\n slicePath = path.join(projectPath, basePath, sliceOptions.sliceName);\n }\n\n // Step 5: Ensure feature and store directories exist\n const featureStorePath = path.join(projectPath, basePath);\n if (!existsSync(featureStorePath)) {\n await mkdir(featureStorePath, { recursive: true });\n }\n\n // Check if slice already exists\n const exists = await sliceExists(projectPath, sliceOptions.sliceName, basePath);\n if (exists) {\n logError(`Slice '${sliceOptions.sliceName}' already exists at ${basePath}!`);\n process.exit(1);\n }\n\n // Step 6: Generate slice files\n spinner.start('Generating slice files...');\n await generateSliceFiles({\n sliceName: sliceOptions.sliceName,\n slicePath,\n persistSlice: sliceOptions.persistSlice,\n });\n spinner.succeed('Slice files generated');\n\n // Step 7: Register in rootReducer\n spinner.start('Registering slice in rootReducer...');\n // For features: basePath includes store (e.g., src/features/auth/store)\n // We need to register the slice at basePath/sliceName\n await registerSliceInRootReducer(\n projectPath,\n sliceOptions.sliceName,\n sliceOptions.persistSlice,\n basePath,\n );\n spinner.succeed('Slice registered in rootReducer');\n\n // Success message\n const displayPath = path.join(basePath, sliceOptions.sliceName);\n log(pc.green(`\\n\u2728 Slice '${sliceOptions.sliceName}' created successfully!\\n`));\n log(pc.dim('Generated files:'));\n log(pc.dim(` \uD83D\uDCC2 ${displayPath}/`));\n log(pc.dim(` \u251C\u2500\u2500 ${sliceOptions.sliceName}.slice.ts`));\n log(pc.dim(` \u251C\u2500\u2500 ${sliceOptions.sliceName}.selectors.ts`));\n if (sliceOptions.persistSlice) log(pc.dim(` \u251C\u2500\u2500 persist.ts`));\n log(pc.dim(` \u251C\u2500\u2500 ${sliceOptions.sliceName}.types.ts`));\n log(pc.dim(` \u2514\u2500\u2500 index.ts\\n`));\n\n log(pc.cyan('Next steps:'));\n const importPath = basePath.replace(/^src\\//, '@/');\n log(\n pc.dim(\n ` 1. Import actions: import { setLoading, setError } from '${importPath}/${sliceOptions.sliceName}'`,\n ),\n );\n log(pc.dim(` 2. Use in component: dispatch(setLoading(true))`));\n log('');\n } catch (error) {\n spinner.fail('Slice generation failed');\n logError(`${error}`);\n process.exit(1);\n }\n });\n};\n", "import Enquirer from 'enquirer';\nconst { prompt } = Enquirer;\n\nexport interface SliceOptions {\n sliceName: string;\n persistSlice: boolean;\n}\n\nexport const promptForSliceDetails = async (\n sliceName?: string,\n persist?: boolean,\n noPersist?: boolean,\n): Promise<SliceOptions> => {\n const questions: any[] = [];\n\n // Slice name\n if (!sliceName) {\n questions.push({\n type: 'input',\n name: 'sliceName',\n message: 'What is the slice name?',\n initial: 'my-slice',\n validate: (value: string) => {\n if (!/^[a-z0-9-]+$/.test(value)) {\n return 'Slice name must be lowercase and contain only alphanumeric characters and hyphens.';\n }\n return true;\n },\n });\n }\n\n // Persistence question\n if (persist === undefined && noPersist === undefined) {\n questions.push({\n type: 'confirm',\n name: 'persistSlice',\n message: 'Enable persistence for this slice?',\n initial: false,\n });\n }\n\n const answers: any = questions.length > 0 ? await prompt(questions) : {};\n\n return {\n sliceName: sliceName || (answers.sliceName as string),\n persistSlice:\n persist === true\n ? true\n : noPersist === false\n ? false\n : (answers.persistSlice as boolean) || false,\n };\n};\n", "import { writeFile, mkdir } from 'node:fs/promises';\nimport path from 'node:path';\nimport { kebabToCamel, kebabToPascal } from '../../config/utils';\n\nexport interface SliceGenerationOptions {\n sliceName: string;\n slicePath: string;\n persistSlice: boolean;\n}\n\nexport const generateSliceFiles = async (options: SliceGenerationOptions): Promise<void> => {\n const { sliceName, slicePath, persistSlice } = options;\n\n // Create slice directory\n await mkdir(slicePath, { recursive: true });\n\n const componentName = kebabToPascal(sliceName);\n const camelName = kebabToCamel(sliceName);\n\n // Generate types file\n await generateTypesFile(sliceName, slicePath, componentName);\n\n // Generate slice file\n await generateSliceFile(sliceName, slicePath, componentName, camelName);\n\n // Generate selectors file\n await generateSelectorsFile(sliceName, slicePath, componentName, camelName);\n\n // Generate persist file if needed\n if (persistSlice) {\n await generatePersistFile(sliceName, slicePath, componentName, camelName);\n }\n\n // Generate index file\n await generateIndexFile(sliceName, slicePath, persistSlice);\n};\n\nconst generateTypesFile = async (\n sliceName: string,\n slicePath: string,\n componentName: string,\n): Promise<void> => {\n const content = `export interface ${componentName}State {\n loading: boolean;\n error: string | null;\n // Add your state properties here\n}\n`;\n\n await writeFile(path.join(slicePath, `${sliceName}.types.ts`), content);\n};\n\nconst generateSliceFile = async (\n sliceName: string,\n slicePath: string,\n componentName: string,\n camelName: string,\n): Promise<void> => {\n const content = `import { createSlice, PayloadAction } from '@reduxjs/toolkit';\nimport { ${componentName}State } from './${sliceName}.types';\n\nconst initialState: ${componentName}State = {\n loading: false,\n error: null,\n // Add your initial state here\n};\n\nexport const ${camelName}Slice = createSlice({\n name: '${camelName}',\n initialState,\n reducers: {\n setLoading: (state, action: PayloadAction<boolean>) => {\n state.loading = action.payload;\n },\n setError: (state, action: PayloadAction<string | null>) => {\n state.error = action.payload;\n },\n resetState: (state) => {\n state.loading = false;\n state.error = null;\n },\n },\n});\n\nexport const { setLoading, setError, resetState } = ${camelName}Slice.actions;\n\nexport const ${camelName}Reducer = ${camelName}Slice.reducer;\n`;\n\n await writeFile(path.join(slicePath, `${sliceName}.slice.ts`), content);\n};\n\nconst generateSelectorsFile = async (\n sliceName: string,\n slicePath: string,\n componentName: string,\n camelName: string,\n): Promise<void> => {\n const content = `import { RootState } from '@/store/rootReducer';\n\nexport const select${componentName}State = (state: RootState) => state.${camelName};\nexport { setLoading, setError, resetState } from './${sliceName}.slice';\n`;\n\n await writeFile(path.join(slicePath, `${sliceName}.selectors.ts`), content);\n};\n\nconst generatePersistFile = async (\n sliceName: string,\n slicePath: string,\n componentName: string,\n camelName: string,\n): Promise<void> => {\n const content = `import { PersistConfig } from 'redux-persist';\nimport storage from 'redux-persist/lib/storage';\nimport { ${componentName}State } from './${sliceName}.types';\n\nexport const ${camelName}PersistConfig: PersistConfig<${componentName}State> = {\n key: '${camelName}',\n storage,\n // whitelist: ['someField'], // Specify which fields to persist\n};\n`;\n\n await writeFile(path.join(slicePath, 'persist.ts'), content);\n};\n\nconst generateIndexFile = async (\n sliceName: string,\n slicePath: string,\n persistSlice: boolean,\n): Promise<void> => {\n const content = `export * from './${sliceName}.slice';\nexport * from './${sliceName}.selectors';\nexport * from './${sliceName}.types';${persistSlice ? \"\\nexport * from './persist';\" : ''}\n`;\n\n await writeFile(path.join(slicePath, 'index.ts'), content);\n};\n", "import { access } from 'node:fs/promises';\nimport path from 'node:path';\n\nexport const sliceExists = async (\n projectPath: string,\n sliceName: string,\n basePath: string = path.join('src', 'store', 'slices'),\n): Promise<boolean> => {\n const slicePath = path.join(projectPath, basePath, sliceName);\n try {\n await access(slicePath);\n return true;\n } catch {\n return false;\n }\n};\n", "import { Command } from 'commander';\nimport pc from 'picocolors';\nimport path from 'node:path';\nimport { existsSync } from 'node:fs';\nimport { mkdir } from 'node:fs/promises';\nimport { log, logError, spinner } from '../config';\nimport { promptForServiceDetails } from '../prompts/service.prompt';\nimport { detectProjectSetup } from '../services/feature/detection.service';\nimport { generateServiceFiles } from '../services/service/service.service';\nimport { serviceExists } from '../services/service/detection.service';\nimport { registerApiEndpoints } from '../services/common/api-registration.service';\n\ninterface ServiceCommandOptions {\n path?: string;\n axios?: boolean;\n fetch?: boolean;\n}\n\nexport const registerServiceCommand = (program: Command) => {\n program\n .command('service [name]')\n .description('Generate an API service')\n .option('--path <path>', 'Custom path for service generation (default: create new feature)')\n .option('--axios', 'Use Axios HTTP client')\n .option('--fetch', 'Use Fetch HTTP client')\n .action(async (name: string | undefined, options: ServiceCommandOptions) => {\n try {\n const projectPath = process.cwd();\n\n // Validate conflicting options\n if (options.axios && options.fetch) {\n logError('Cannot use --axios and --fetch together');\n process.exit(1);\n }\n\n log(pc.cyan('\\n\uD83D\uDD27 Service Generator\\n'));\n\n // Step 1: Detect project setup\n spinner.start('Detecting project setup...');\n const detection = await detectProjectSetup(projectPath);\n spinner.succeed('Project setup detected');\n\n // Step 2: Check if HTTP clients are setup\n if (detection.httpClient === 'none') {\n spinner.fail('No HTTP client is setup in this project');\n logError('Please setup either AxiosClient or FetchClient first');\n log(pc.dim('\\nCheck: lib/utils/http/axios-client or lib/utils/http/fetch-client\\n'));\n process.exit(1);\n }\n\n // Display available clients\n const availableClients: string[] = [];\n if (detection.httpClient === 'axios' || detection.httpClient === 'both') {\n availableClients.push('Axios \u2713');\n }\n if (detection.httpClient === 'fetch' || detection.httpClient === 'both') {\n availableClients.push('Fetch \u2713');\n }\n log(pc.dim(` HTTP Clients: ${availableClients.join(', ')}\\n`));\n\n // Step 3: Prompt for service details\n const serviceOptions = await promptForServiceDetails(\n name,\n options.axios,\n options.fetch,\n detection.httpClient,\n );\n\n // Step 4: Determine service path (feature-first approach)\n let basePath: string;\n let featureName: string;\n let servicePath: string;\n\n if (options.path) {\n // Custom path provided\n const customPath = options.path.replace(/^src\\//, '');\n\n // Check if custom path is a feature\n if (customPath.startsWith('features/')) {\n // Extract feature name and ensure services subdirectory\n const parts = customPath.split('/');\n featureName = parts[1]; // features/featureName/...\n basePath = path.join('src', 'features', featureName, 'services');\n servicePath = path.join(projectPath, basePath);\n } else {\n // Non-feature custom path - use as-is\n basePath = path.join('src', customPath);\n featureName = customPath.split('/')[0]; // First directory as feature name\n servicePath = path.join(projectPath, basePath);\n }\n } else {\n // Default: Create new feature with services\n featureName = serviceOptions.serviceName;\n basePath = path.join('src', 'features', featureName, 'services');\n servicePath = path.join(projectPath, basePath);\n }\n\n // Step 5: Ensure feature and services directories exist\n if (!existsSync(servicePath)) {\n await mkdir(servicePath, { recursive: true });\n }\n\n // Check if service already exists\n const exists = await serviceExists(projectPath, serviceOptions.serviceName, basePath);\n if (exists) {\n logError(`Service '${serviceOptions.serviceName}' already exists at ${basePath}!`);\n process.exit(1);\n }\n\n // Step 6: Generate service files\n spinner.start('Generating service files...');\n await generateServiceFiles({\n serviceName: serviceOptions.serviceName,\n servicePath,\n httpClient: serviceOptions.httpClient,\n });\n spinner.succeed('Service files generated');\n\n // Step 7: Register API endpoints\n spinner.start('Registering API endpoints...');\n await registerApiEndpoints({\n serviceName: serviceOptions.serviceName,\n projectPath,\n });\n spinner.succeed('API endpoints registered');\n\n // Success message\n const displayPath = path.join(basePath, `${serviceOptions.serviceName}.service.ts`);\n log(pc.green(`\\n\u2728 Service '${serviceOptions.serviceName}' created successfully!\\n`));\n log(pc.dim('Generated files:'));\n log(pc.dim(` \uD83D\uDCC4 ${displayPath}\\n`));\n\n log(pc.cyan('Next steps:'));\n const importPath = basePath.replace(/^src\\//, '@/');\n log(\n pc.dim(\n ` 1. Import service: import { ${serviceOptions.serviceName}Service } from '${importPath}/${serviceOptions.serviceName}.service'`,\n ),\n );\n log(\n pc.dim(\n ` 2. Use in component: const data = await ${serviceOptions.serviceName}Service.getAll()`,\n ),\n );\n log('');\n } catch (error) {\n spinner.fail('Service generation failed');\n logError(`${error}`);\n process.exit(1);\n }\n });\n};\n", "import enquirer from 'enquirer';\n\ninterface ServiceOptions {\n serviceName: string;\n httpClient: 'axios' | 'fetch';\n}\n\nexport const promptForServiceDetails = async (\n name?: string,\n axiosFlag?: boolean,\n fetchFlag?: boolean,\n availableClients?: 'axios' | 'fetch' | 'both' | 'none',\n): Promise<ServiceOptions> => {\n const serviceName =\n name ||\n (\n await enquirer.prompt<{ serviceName: string }>({\n type: 'input',\n name: 'serviceName',\n message: 'Service name (kebab-case):',\n validate: (input: string) => {\n if (!input) return 'Service name is required';\n if (!/^[a-z0-9-]+$/.test(input))\n return 'Service name must be lowercase with hyphens only';\n return true;\n },\n })\n ).serviceName;\n\n let httpClient: 'axios' | 'fetch';\n\n // If flags are provided, use them\n if (axiosFlag !== undefined) {\n httpClient = 'axios';\n } else if (fetchFlag !== undefined) {\n httpClient = 'fetch';\n } else {\n // Prompt based on available clients\n if (availableClients === 'axios') {\n httpClient = 'axios';\n } else if (availableClients === 'fetch') {\n httpClient = 'fetch';\n } else if (availableClients === 'both') {\n // Let user choose\n const response = await enquirer.prompt<{ httpClient: 'axios' | 'fetch' }>({\n type: 'select',\n name: 'httpClient',\n message: 'Choose HTTP client:',\n choices: ['axios', 'fetch'],\n });\n httpClient = response.httpClient;\n } else {\n // This shouldn't happen as we check in the command\n httpClient = 'axios';\n }\n }\n\n return {\n serviceName,\n httpClient,\n };\n};\n", "import { writeFile } from 'node:fs/promises';\nimport path from 'node:path';\nimport { kebabToCamel } from '../../config/utils';\n\ninterface GenerateServiceOptions {\n serviceName: string;\n servicePath: string;\n httpClient: 'axios' | 'fetch';\n}\n\nexport const generateServiceFiles = async (options: GenerateServiceOptions): Promise<void> => {\n await generateServiceFile(options);\n};\n\nconst generateServiceFile = async (options: GenerateServiceOptions): Promise<void> => {\n const { serviceName, servicePath, httpClient } = options;\n const camelName = kebabToCamel(serviceName);\n\n let content: string;\n\n if (httpClient === 'axios') {\n content = `import { AppApis } from '@/lib/config';\nimport { axiosClient } from '@/lib/utils/http';\nimport { ResultAsync } from '@/types';\n\nexport const ${camelName}Service = {\n getAll: (): ResultAsync<string> => {\n return axiosClient.get<string>(AppApis.${camelName}.getAll);\n },\n};\n`;\n } else {\n // fetch\n content = `import { AppApis } from '@/lib/config';\nimport { fetchClient } from '@/lib/utils/http';\nimport { ResultAsync } from '@/types';\n\nexport const ${camelName}Service = {\n getAll: (): ResultAsync<string> => {\n return fetchClient.get<string>(AppApis.${camelName}.getAll);\n },\n};\n`;\n }\n\n const fileName = `${serviceName}.service.ts`;\n await writeFile(path.join(servicePath, fileName), content);\n};\n", "import { existsSync } from 'node:fs';\nimport path from 'node:path';\n\nexport const serviceExists = async (\n projectPath: string,\n serviceName: string,\n basePath: string,\n): Promise<boolean> => {\n const servicePath = path.join(projectPath, basePath, `${serviceName}.service.ts`);\n return existsSync(servicePath);\n};\n", "import { Command } from 'commander';\nimport pc from 'picocolors';\nimport Enquirer from 'enquirer';\nimport { log, logError, spinner } from '../config';\nimport { setupDarkTheme } from '../services/setup/dark-theme';\nimport { setupRedux } from '../services/setup/redux';\nimport { setupI18n } from '../services/setup/i18n';\n\nconst { prompt } = Enquirer;\n\ninterface SetupOptions {\n httpClient?: string;\n darkTheme?: boolean;\n redux?: boolean;\n i18n?: boolean;\n}\n\nexport const registerSetupCommand = (program: Command) => {\n program\n .command('setup')\n .description('Setup features in an existing Next.js project')\n .option('--http-client <type>', 'Setup HTTP client (axios|fetch|both)')\n .option('--dark-theme', 'Setup Dark Theme (Tailwind + next-themes)')\n .option('--redux', 'Setup Redux Toolkit')\n .option('--i18n', 'Setup next-intl for internationalization')\n .action(async (options: SetupOptions) => {\n try {\n log(pc.cyan('\\n\uD83D\uDD27 Setup Wizard\\n'));\n\n let feature: string | undefined;\n\n // If no options provided, show interactive menu\n if (!options.httpClient && !options.darkTheme && !options.redux && !options.i18n) {\n const setupChoice = await prompt<{ feature: string }>([\n {\n type: 'select',\n name: 'feature',\n message: 'What would you like to setup?',\n choices: [\n 'Dark Theme',\n 'Redux Toolkit',\n 'HTTP Client (Axios/Fetch)',\n 'Internationalization (next-intl)',\n 'Cancel',\n ],\n },\n ]);\n feature = setupChoice.feature;\n\n if (feature === 'Cancel') {\n log(pc.yellow('Setup cancelled.'));\n return;\n }\n\n if (feature === 'Dark Theme') {\n await setupDarkTheme(process.cwd());\n } else if (feature === 'Redux Toolkit') {\n await setupRedux(process.cwd());\n } else if (feature === 'Internationalization (next-intl)') {\n await setupI18n(process.cwd());\n } else {\n log(pc.yellow(`\\n\u26A0\uFE0F ${feature} setup is not implemented yet.`));\n log(pc.dim('This feature will be available in a future update.'));\n }\n } else {\n // Direct setup via flags\n if (options.httpClient) {\n log(pc.yellow('\\n\u26A0\uFE0F HTTP Client setup is not implemented yet.'));\n log(pc.dim('This feature will be available in a future update.'));\n }\n if (options.darkTheme) {\n await setupDarkTheme(process.cwd());\n }\n if (options.redux) {\n await setupRedux(process.cwd());\n }\n if (options.i18n) {\n await setupI18n(process.cwd());\n }\n }\n } catch (error) {\n spinner.fail('Setup failed');\n logError(`${error}`);\n process.exit(1);\n }\n });\n};\n", "import path from 'node:path';\nimport pc from 'picocolors';\nimport { deleteDirectory } from '../../../core/files';\nimport { installPackage, runScript, detectPackageManager } from '../../../core/package-manager';\nimport { startSpinner } from '../../../config/spinner';\nimport { checkIsAlreadySetup, validateProjectStructure } from './checks';\nimport { fetchAssets, copyThemeProvider } from './assets';\nimport {\n updateProvidersIndex,\n updateRootProvider,\n updateGlobalsCss,\n updateLayout,\n} from './injectors';\n\nexport const setupDarkTheme = async (projectPath: string): Promise<void> => {\n const spinner = startSpinner('Setting up Dark Theme...');\n const tempDir = path.join(projectPath, '.next-maker-temp');\n\n try {\n // 1. Pre-check\n const { isSetup, reason } = await checkIsAlreadySetup(projectPath);\n if (isSetup) {\n spinner.fail(`Dark Theme is already set up (${reason}).`);\n return;\n }\n\n // 2. Validation\n const layoutPath = await validateProjectStructure(projectPath);\n\n // 3. Fetch Assets\n await fetchAssets(tempDir, spinner);\n\n // 4. Copy Files\n await copyThemeProvider(projectPath, tempDir);\n\n // 5. Inject Code\n await updateProvidersIndex(projectPath);\n await updateRootProvider(projectPath);\n await updateGlobalsCss(projectPath, tempDir);\n await updateLayout(layoutPath);\n\n // 6. Install Dependencies\n spinner.text = 'Installing next-themes...';\n await installPackage(projectPath, 'next-themes');\n\n // 7. Format Code\n spinner.text = 'Formatting code...';\n const packageManager = await detectPackageManager(projectPath);\n await runScript(projectPath, packageManager, 'format');\n\n spinner.succeed(pc.green('Dark Theme setup successfully!'));\n } catch (error) {\n spinner.fail('Failed to setup Dark Theme.');\n throw error;\n } finally {\n await deleteDirectory(tempDir);\n }\n};\n", "import path from 'node:path';\nimport { fileExists, readFile } from '../../../core/files';\nimport { PROJECT_PATHS } from '../../../config/paths';\nimport { findLayoutPath } from './utils';\n\nexport const checkIsAlreadySetup = async (\n projectPath: string,\n): Promise<{ isSetup: boolean; reason: string }> => {\n const themeProviderPath = path.join(projectPath, PROJECT_PATHS.THEME_PROVIDER);\n const globalsCssPath = path.join(projectPath, PROJECT_PATHS.GLOBALS_CSS);\n const packageJsonPath = path.join(projectPath, 'package.json');\n\n if (fileExists(themeProviderPath)) {\n return { isSetup: true, reason: 'CustomThemeProvider.tsx exists' };\n }\n\n if (fileExists(packageJsonPath)) {\n const packageJson = JSON.parse(await readFile(packageJsonPath));\n if (\n (packageJson.dependencies && packageJson.dependencies['next-themes']) ||\n (packageJson.devDependencies && packageJson.devDependencies['next-themes'])\n ) {\n return { isSetup: true, reason: 'next-themes is installed' };\n }\n }\n\n if (fileExists(globalsCssPath)) {\n const globalsCss = await readFile(globalsCssPath);\n if (globalsCss.includes('@custom-variant dark')) {\n return { isSetup: true, reason: 'Dark theme CSS found in globals.css' };\n }\n }\n\n return { isSetup: false, reason: '' };\n};\n\nexport const validateProjectStructure = async (projectPath: string): Promise<string> => {\n const globalsCssPath = path.join(projectPath, PROJECT_PATHS.GLOBALS_CSS);\n const providersIndexPath = path.join(projectPath, PROJECT_PATHS.PROVIDERS_INDEX);\n const layoutPath = await findLayoutPath(projectPath);\n\n if (!fileExists(globalsCssPath) || !layoutPath || !fileExists(providersIndexPath)) {\n throw new Error(\n 'Project structure mismatch. Ensure src/styles/globals.css, src/app/layout.tsx (or src/app/[locale]/layout.tsx), and src/providers/index.ts exist.',\n );\n }\n\n return layoutPath;\n};\n", "import path from 'node:path';\nimport { fileExists, readFile } from '../../../core/files';\nimport { PROJECT_PATHS } from '../../../config/paths';\n\nexport const findLayoutPath = async (projectPath: string): Promise<string> => {\n const possibleLayoutPaths = [\n path.join(projectPath, PROJECT_PATHS.ROOT_LAYOUT),\n path.join(projectPath, 'src/app/[locale]/layout.tsx'),\n ];\n\n for (const p of possibleLayoutPaths) {\n if (fileExists(p)) {\n const content = await readFile(p);\n if (content.includes('<body')) {\n return p;\n }\n }\n }\n\n // Fallback: if no body tag found, just take the first one that exists\n for (const p of possibleLayoutPaths) {\n if (fileExists(p)) {\n return p;\n }\n }\n\n return '';\n};\n", "import path from 'node:path';\nimport degit from 'degit';\nimport { copyFile } from '../../../core/files';\nimport { PROJECT_PATHS } from '../../../config/paths';\nimport { Ora } from 'ora';\n\nexport const fetchAssets = async (tempDir: string, spinner: Ora): Promise<void> => {\n spinner.text = 'Fetching assets from starter repo...';\n const emitter = degit('teispace/nextjs-starter', {\n cache: false,\n force: true,\n verbose: false,\n });\n await emitter.clone(tempDir);\n};\n\nexport const copyThemeProvider = async (projectPath: string, tempDir: string): Promise<void> => {\n const themeProviderPath = path.join(projectPath, PROJECT_PATHS.THEME_PROVIDER);\n const sourceProviderPath = path.join(tempDir, 'src/providers/CustomThemeProvider.tsx');\n await copyFile(sourceProviderPath, themeProviderPath);\n};\n", "import path from 'node:path';\nimport { fileExists, readFile, writeFile } from '../../../core/files';\nimport { PROJECT_PATHS } from '../../../config/paths';\n\nexport const updateProvidersIndex = async (projectPath: string): Promise<void> => {\n const providersIndexPath = path.join(projectPath, PROJECT_PATHS.PROVIDERS_INDEX);\n let providersContent = await readFile(providersIndexPath);\n if (!providersContent.includes('CustomThemeProvider')) {\n providersContent += \"export * from './CustomThemeProvider';\\n\";\n await writeFile(providersIndexPath, providersContent);\n }\n};\n\nexport const updateRootProvider = async (projectPath: string): Promise<void> => {\n const rootProviderPath = path.join(projectPath, 'src/providers/RootProvider.tsx');\n if (fileExists(rootProviderPath)) {\n let rootProviderContent = await readFile(rootProviderPath);\n\n // Add import if missing\n if (!rootProviderContent.includes('CustomThemeProvider')) {\n rootProviderContent = rootProviderContent.replace(\n /import \\{ StoreProvider \\} from '@\\/providers';\\n/,\n \"import { StoreProvider, CustomThemeProvider } from '@/providers';\\n\",\n );\n // Fallback if StoreProvider import is different or missing\n if (!rootProviderContent.includes('CustomThemeProvider')) {\n if (rootProviderContent.includes(\"from '@/providers'\")) {\n rootProviderContent = rootProviderContent.replace(\n /\\} from '@\\/providers'/,\n \", CustomThemeProvider } from '@/providers'\",\n );\n } else {\n rootProviderContent =\n \"import { CustomThemeProvider } from '@/providers';\\n\" + rootProviderContent;\n }\n }\n }\n\n // Wrap children\n if (!rootProviderContent.includes('<CustomThemeProvider>')) {\n if (rootProviderContent.includes('<StoreProvider>')) {\n rootProviderContent = rootProviderContent.replace(\n /<StoreProvider>/,\n '<StoreProvider>\\n <CustomThemeProvider>',\n );\n rootProviderContent = rootProviderContent.replace(\n /<\\/StoreProvider>/,\n '</CustomThemeProvider>\\n </StoreProvider>',\n );\n } else {\n const returnMatch = rootProviderContent.match(/return \\(\\s*([\\s\\S]*?)\\s*\\);/);\n if (returnMatch) {\n rootProviderContent = rootProviderContent.replace(\n /return \\(\\s*<([^>]+)([^>]*)>([\\s\\S]*)<\\/\\1>\\s*\\);/,\n (match, tag, attrs, content) => {\n return `return (\\n <CustomThemeProvider>\\n <${tag}${attrs}>${content}</${tag}>\\n </CustomThemeProvider>\\n );`;\n },\n );\n }\n }\n await writeFile(rootProviderPath, rootProviderContent);\n }\n }\n};\n\nexport const updateGlobalsCss = async (projectPath: string, tempDir: string): Promise<void> => {\n const globalsCssPath = path.join(projectPath, PROJECT_PATHS.GLOBALS_CSS);\n const sourceCssPath = path.join(tempDir, 'src/styles/globals.css');\n let darkThemeCss = '';\n\n if (fileExists(sourceCssPath)) {\n const sourceCss = await readFile(sourceCssPath);\n const variantMatch = sourceCss.match(/@custom-variant dark \\(.*?\\);/);\n const themeMatch = sourceCss.match(/@theme \\{[\\s\\S]*?\\}/);\n\n if (variantMatch) darkThemeCss += `\\n${variantMatch[0]}\\n`;\n if (themeMatch) darkThemeCss += `\\n${themeMatch[0]}\\n`;\n }\n\n if (!darkThemeCss) {\n darkThemeCss = `\n@custom-variant dark (&:where(.dark, .dark *));\n\n@theme {\n --color-dark: #202938;\n --color-light: #f5f5f5;\n}\n`;\n }\n\n let cssContent = await readFile(globalsCssPath);\n if (!cssContent.includes('@custom-variant dark')) {\n if (cssContent.includes('@import')) {\n const lastImportIndex = cssContent.lastIndexOf('@import');\n const endOfLineIndex = cssContent.indexOf('\\n', lastImportIndex);\n cssContent =\n cssContent.slice(0, endOfLineIndex + 1) +\n darkThemeCss +\n cssContent.slice(endOfLineIndex + 1);\n } else {\n cssContent = darkThemeCss + cssContent;\n }\n await writeFile(globalsCssPath, cssContent);\n }\n};\n\nexport const updateLayout = async (layoutPath: string): Promise<void> => {\n let layoutContent = await readFile(layoutPath);\n if (!layoutContent.includes('dark:bg-dark')) {\n layoutContent = layoutContent.replace(\n /className=\"([^\"]*)\"/,\n 'className=\"$1 bg-light dark:bg-dark\"',\n );\n await writeFile(layoutPath, layoutContent);\n }\n};\n", "import path from 'node:path';\nimport pc from 'picocolors';\nimport { deleteDirectory } from '../../../core/files';\nimport { installPackage, runScript, detectPackageManager } from '../../../core/package-manager';\nimport { startSpinner } from '../../../config/spinner';\nimport { checkIsAlreadySetup, validateProjectStructure } from './checks';\nimport { fetchAssets, copyReduxFiles, createCounterFeature } from './assets';\nimport { updateProvidersIndex, updateRootProvider, updatePage } from './injectors';\n\nexport const setupRedux = async (projectPath: string): Promise<void> => {\n const spinner = startSpinner('Setting up Redux Toolkit...');\n const tempDir = path.join(projectPath, '.next-maker-temp-redux');\n\n try {\n // 1. Pre-check\n const { isSetup, reason } = await checkIsAlreadySetup(projectPath);\n if (isSetup) {\n spinner.fail(`Redux is already set up (${reason}).`);\n return;\n }\n\n // 2. Validation\n await validateProjectStructure(projectPath);\n\n // 3. Fetch Assets\n await fetchAssets(tempDir, spinner);\n\n // 4. Copy Files\n spinner.text = 'Copying Redux files...';\n await copyReduxFiles(projectPath, tempDir);\n\n spinner.text = 'Creating Counter feature...';\n await createCounterFeature(projectPath, tempDir);\n\n // 5. Inject Code\n spinner.text = 'Updating providers and pages...';\n await updateProvidersIndex(projectPath);\n await updateRootProvider(projectPath);\n await updatePage(projectPath);\n\n // 6. Install Dependencies\n spinner.text = 'Installing dependencies...';\n await installPackage(projectPath, '@reduxjs/toolkit');\n await installPackage(projectPath, 'react-redux');\n await installPackage(projectPath, 'redux-persist');\n // Check if react-secure-storage is needed (starter uses it in persist.ts? No, it used storage from redux-persist/lib/storage in the file I viewed)\n // But let's check if the starter has it in package.json just in case.\n // Based on previous view of package.json in test project, it had react-secure-storage.\n // Let's install it to be safe if the starter uses it elsewhere or if I missed it.\n await installPackage(projectPath, 'react-secure-storage');\n\n // 7. Format Code\n spinner.text = 'Formatting code...';\n const packageManager = await detectPackageManager(projectPath);\n await runScript(projectPath, packageManager, 'format');\n\n spinner.succeed(pc.green('Redux Toolkit setup successfully!'));\n } catch (error) {\n spinner.fail('Failed to setup Redux Toolkit.');\n throw error;\n } finally {\n await deleteDirectory(tempDir);\n }\n};\n", "import path from 'node:path';\nimport { fileExists, readFile } from '../../../core/files';\nimport { PROJECT_PATHS } from '../../../config/paths';\nimport { findLayoutPath } from '../dark-theme/utils'; // Reuse utility\n\nexport const checkIsAlreadySetup = async (\n projectPath: string,\n): Promise<{ isSetup: boolean; reason: string }> => {\n const storePath = path.join(projectPath, PROJECT_PATHS.STORE);\n const packageJsonPath = path.join(projectPath, 'package.json');\n\n if (fileExists(storePath)) {\n return { isSetup: true, reason: 'src/store directory exists' };\n }\n\n if (fileExists(packageJsonPath)) {\n const packageJson = JSON.parse(await readFile(packageJsonPath));\n if (\n (packageJson.dependencies && packageJson.dependencies['@reduxjs/toolkit']) ||\n (packageJson.devDependencies && packageJson.devDependencies['@reduxjs/toolkit'])\n ) {\n return { isSetup: true, reason: '@reduxjs/toolkit is installed' };\n }\n }\n\n return { isSetup: false, reason: '' };\n};\n\nexport const validateProjectStructure = async (projectPath: string): Promise<void> => {\n const providersIndexPath = path.join(projectPath, PROJECT_PATHS.PROVIDERS_INDEX);\n // We check for layout just to ensure it's a valid next app, reusing the robust check\n const layoutPath = await findLayoutPath(projectPath);\n\n if (!layoutPath || !fileExists(providersIndexPath)) {\n throw new Error(\n 'Project structure mismatch. Ensure src/app/layout.tsx (or src/app/[locale]/layout.tsx) and src/providers/index.ts exist.',\n );\n }\n};\n", "import path from 'node:path';\nimport degit from 'degit';\nimport { copyFile, readFile, writeFile, fileExists } from '../../../core/files';\nimport { PROJECT_PATHS } from '../../../config/paths';\nimport { Ora } from 'ora';\nimport fs from 'node:fs/promises';\n\nexport const fetchAssets = async (tempDir: string, spinner: Ora): Promise<void> => {\n spinner.text = 'Fetching assets from starter repo...';\n const emitter = degit('teispace/nextjs-starter', {\n cache: false,\n force: true,\n verbose: false,\n });\n await emitter.clone(tempDir);\n};\n\nexport const copyReduxFiles = async (projectPath: string, tempDir: string): Promise<void> => {\n // Copy StoreProvider\n const sourceProviderPath = path.join(tempDir, 'src/providers/StoreProvider.tsx');\n const destProviderPath = path.join(projectPath, PROJECT_PATHS.STORE_PROVIDER);\n await copyFile(sourceProviderPath, destProviderPath);\n\n // Copy src/store directory\n const sourceStoreDir = path.join(tempDir, 'src/store');\n const destStoreDir = path.join(projectPath, PROJECT_PATHS.STORE);\n await fs.cp(sourceStoreDir, destStoreDir, { recursive: true });\n};\n\nexport const createCounterFeature = async (projectPath: string, tempDir: string): Promise<void> => {\n const sourceFeatureDir = path.join(tempDir, 'src/features/counter');\n const destFeatureDir = path.join(projectPath, PROJECT_PATHS.COUNTER_FEATURE);\n\n // Copy the entire directory first\n await fs.cp(sourceFeatureDir, destFeatureDir, { recursive: true });\n\n // Modify Counter.tsx to remove i18n\n const counterComponentPath = path.join(destFeatureDir, 'components/Counter.tsx');\n if (await fileExists(counterComponentPath)) {\n let content = await readFile(counterComponentPath);\n\n // Remove imports\n content = content.replace(/import \\{ useTranslations \\} from 'next-intl';\\n?/, '');\n\n // Remove hook usage\n content = content.replace(/const t = useTranslations\\('Count'\\);\\n?/, '');\n\n // Replace translations with hardcoded strings\n // {t('currentCount', { count: value })} -> Current Count: {value}\n content = content.replace(\n /\\{t\\('currentCount', \\{ count: value \\}\\)\\}/g,\n 'Current Count: {value}',\n );\n\n // {t('increment')} -> Increment\n content = content.replace(/\\{t\\('increment'\\)\\}/g, 'Increment');\n\n // {t('decrement')} -> Decrement\n content = content.replace(/\\{t\\('decrement'\\)\\}/g, 'Decrement');\n\n // {t('reset')} -> Reset\n content = content.replace(/\\{t\\('reset'\\)\\}/g, 'Reset');\n\n await writeFile(counterComponentPath, content);\n }\n};\n", "import path from 'node:path';\nimport { fileExists, readFile, writeFile } from '../../../core/files';\nimport { PROJECT_PATHS } from '../../../config/paths';\n\nexport const updateProvidersIndex = async (projectPath: string): Promise<void> => {\n const providersIndexPath = path.join(projectPath, PROJECT_PATHS.PROVIDERS_INDEX);\n let providersContent = await readFile(providersIndexPath);\n if (!providersContent.includes('StoreProvider')) {\n providersContent += \"export * from './StoreProvider';\\n\";\n await writeFile(providersIndexPath, providersContent);\n }\n};\n\nexport const updateRootProvider = async (projectPath: string): Promise<void> => {\n const rootProviderPath = path.join(projectPath, 'src/providers/RootProvider.tsx');\n if (fileExists(rootProviderPath)) {\n let rootProviderContent = await readFile(rootProviderPath);\n\n // Add import\n if (!rootProviderContent.includes('StoreProvider')) {\n rootProviderContent = rootProviderContent.replace(\n /import \\{ (.*?) \\} from '@\\/providers';/,\n \"import { $1, StoreProvider } from '@/providers';\",\n );\n // Fallback if regex didn't match (e.g. no named imports yet)\n if (!rootProviderContent.includes('StoreProvider')) {\n if (rootProviderContent.includes(\"from '@/providers'\")) {\n // Try to append to existing import\n rootProviderContent = rootProviderContent.replace(\n /\\} from '@\\/providers'/,\n \", StoreProvider } from '@/providers'\",\n );\n } else {\n rootProviderContent =\n \"import { StoreProvider } from '@/providers';\\n\" + rootProviderContent;\n }\n }\n }\n\n // Wrap children\n // We want StoreProvider to be the outermost (or close to it)\n if (!rootProviderContent.includes('<StoreProvider>')) {\n const returnMatch = rootProviderContent.match(/return \\(\\s*([\\s\\S]*?)\\s*\\);/);\n if (returnMatch) {\n rootProviderContent = rootProviderContent.replace(\n /return \\(\\s*<([^>]+)([^>]*)>([\\s\\S]*)<\\/\\1>\\s*\\);/,\n (match, tag, attrs, content) => {\n return `return (\\n <StoreProvider>\\n <${tag}${attrs}>${content}</${tag}>\\n </StoreProvider>\\n );`;\n },\n );\n await writeFile(rootProviderPath, rootProviderContent);\n }\n }\n }\n};\n\nexport const updatePage = async (projectPath: string): Promise<void> => {\n // Try to find the page file\n const possiblePagePaths = [\n path.join(projectPath, PROJECT_PATHS.ROOT_PAGE),\n path.join(projectPath, 'src/app/[locale]/page.tsx'),\n ];\n\n let pagePath = '';\n for (const p of possiblePagePaths) {\n if (fileExists(p)) {\n pagePath = p;\n break;\n }\n }\n\n if (pagePath) {\n let pageContent = await readFile(pagePath);\n\n // Add import\n if (!pageContent.includes('Counter')) {\n pageContent =\n \"import { Counter } from '@/features/counter/components/Counter';\\n\" + pageContent;\n }\n\n // Add Component\n if (!pageContent.includes('<Counter />')) {\n // Look for the closing tag of the main container (usually div or main)\n // We'll just append it to the end of the children of the first element\n // This is a bit risky but standard for simple injections\n const lastDivIndex = pageContent.lastIndexOf('</div>');\n const lastMainIndex = pageContent.lastIndexOf('</main>');\n\n const insertIndex = lastMainIndex !== -1 ? lastMainIndex : lastDivIndex;\n\n if (insertIndex !== -1) {\n pageContent =\n pageContent.slice(0, insertIndex) +\n '\\n <div className=\"mt-8\">\\n <h2 className=\"text-2xl font-bold mb-4\">Redux Counter</h2>\\n <Counter />\\n </div>\\n' +\n pageContent.slice(insertIndex);\n await writeFile(pagePath, pageContent);\n }\n }\n }\n};\n", "import path from 'node:path';\nimport pc from 'picocolors';\nimport { deleteDirectory } from '../../../core/files';\nimport { installPackage, runScript, detectPackageManager } from '../../../core/package-manager';\nimport { startSpinner } from '../../../config/spinner';\nimport { checkIsAlreadySetup, validateProjectStructure } from './checks';\nimport { fetchAssets, copyI18nFiles } from './assets';\nimport {\n updateNextConfig,\n updateTypesIndex,\n updateConfigIndex,\n migrateToLocaleStructure,\n updateRootProvider,\n} from './injectors';\n\nexport const setupI18n = async (projectPath: string): Promise<void> => {\n const spinner = startSpinner('Setting up Internationalization (next-intl)...');\n const tempDir = path.join(projectPath, '.next-maker-temp-i18n');\n\n try {\n // 1. Pre-check\n const { isSetup, reason } = await checkIsAlreadySetup(projectPath);\n if (isSetup) {\n spinner.fail(`i18n is already set up (${reason}).`);\n return;\n }\n\n // 2. Validation\n await validateProjectStructure(projectPath);\n\n // 3. Fetch Assets\n await fetchAssets(tempDir, spinner);\n\n // 4. Copy Files\n spinner.text = 'Copying i18n files...';\n await copyI18nFiles(projectPath, tempDir);\n\n // 5. Inject Code & Migrate Structure\n spinner.text = 'Configuring project structure...';\n await updateNextConfig(projectPath);\n await updateTypesIndex(projectPath);\n await updateConfigIndex(projectPath);\n await updateRootProvider(projectPath);\n\n spinner.text = 'Migrating to [locale] structure...';\n await migrateToLocaleStructure(projectPath);\n\n // 6. Install Dependencies\n spinner.text = 'Installing dependencies...';\n await installPackage(projectPath, 'next-intl');\n\n // 7. Format Code\n spinner.text = 'Formatting code...';\n const packageManager = await detectPackageManager(projectPath);\n await runScript(projectPath, packageManager, 'format');\n\n spinner.succeed(pc.green('Internationalization setup successfully!'));\n } catch (error) {\n spinner.fail('Failed to setup Internationalization.');\n throw error;\n } finally {\n await deleteDirectory(tempDir);\n }\n};\n", "import path from 'node:path';\nimport { fileExists, readFile } from '../../../core/files';\nimport { PROJECT_PATHS } from '../../../config/paths';\n\nexport const checkIsAlreadySetup = async (\n projectPath: string,\n): Promise<{ isSetup: boolean; reason: string }> => {\n const i18nDir = path.join(projectPath, PROJECT_PATHS.I18N_DIR);\n const packageJsonPath = path.join(projectPath, 'package.json');\n\n if (fileExists(i18nDir)) {\n return { isSetup: true, reason: 'src/i18n directory exists' };\n }\n\n if (fileExists(packageJsonPath)) {\n const packageJson = JSON.parse(await readFile(packageJsonPath));\n if (\n (packageJson.dependencies && packageJson.dependencies['next-intl']) ||\n (packageJson.devDependencies && packageJson.devDependencies['next-intl'])\n ) {\n return { isSetup: true, reason: 'next-intl is installed' };\n }\n }\n\n return { isSetup: false, reason: '' };\n};\n\nexport const validateProjectStructure = async (projectPath: string): Promise<void> => {\n const rootLayoutPath = path.join(projectPath, PROJECT_PATHS.ROOT_LAYOUT);\n const localeLayoutPath = path.join(projectPath, 'src/app/[locale]/layout.tsx');\n\n if (!fileExists(rootLayoutPath) && !fileExists(localeLayoutPath)) {\n throw new Error('Project structure mismatch. Ensure src/app/layout.tsx exists.');\n }\n};\n", "import path from 'node:path';\nimport degit from 'degit';\nimport { copyFile } from '../../../core/files';\nimport { PROJECT_PATHS } from '../../../config/paths';\nimport { Ora } from 'ora';\nimport fs from 'node:fs/promises';\n\nexport const fetchAssets = async (tempDir: string, spinner: Ora): Promise<void> => {\n spinner.text = 'Fetching assets from starter repo...';\n const emitter = degit('teispace/nextjs-starter', {\n cache: false,\n force: true,\n verbose: false,\n });\n await emitter.clone(tempDir);\n};\n\nexport const copyI18nFiles = async (projectPath: string, tempDir: string): Promise<void> => {\n // Copy src/i18n directory\n const sourceI18nDir = path.join(tempDir, 'src/i18n');\n const destI18nDir = path.join(projectPath, PROJECT_PATHS.I18N_DIR);\n await fs.cp(sourceI18nDir, destI18nDir, { recursive: true });\n\n // Copy src/proxy.ts\n const sourceProxyPath = path.join(tempDir, 'src/proxy.ts');\n const destProxyPath = path.join(projectPath, PROJECT_PATHS.PROXY);\n await copyFile(sourceProxyPath, destProxyPath);\n\n // Copy src/types/i18n.ts\n const sourceTypesPath = path.join(tempDir, 'src/types/i18n.ts');\n const destTypesPath = path.join(projectPath, PROJECT_PATHS.I18N_TYPES);\n await copyFile(sourceTypesPath, destTypesPath);\n\n // Copy src/lib/config/app-locales.ts\n const sourceLocalesPath = path.join(tempDir, 'src/lib/config/app-locales.ts');\n const destLocalesPath = path.join(projectPath, PROJECT_PATHS.APP_LOCALES);\n await copyFile(sourceLocalesPath, destLocalesPath);\n};\n", "import path from 'node:path';\nimport { fileExists, readFile, writeFile, deleteFile } from '../../../core/files';\nimport { PROJECT_PATHS } from '../../../config/paths';\nimport fs from 'node:fs/promises';\n\nexport const updateNextConfig = async (projectPath: string): Promise<void> => {\n const nextConfigPath = path.join(projectPath, PROJECT_PATHS.NEXT_CONFIG);\n if (fileExists(nextConfigPath)) {\n let content = await readFile(nextConfigPath);\n if (!content.includes('createNextIntlPlugin')) {\n content = \"import createNextIntlPlugin from 'next-intl/plugin';\\n\" + content;\n\n const exportDefaultRegex = /export default (.*?);/;\n if (exportDefaultRegex.test(content)) {\n content = content.replace(\n exportDefaultRegex,\n '\\nconst withNextIntl = createNextIntlPlugin();\\nexport default withNextIntl($1);',\n );\n } else {\n // Fallback if no export default found (unlikely but safe)\n content += '\\nconst withNextIntl = createNextIntlPlugin();\\n';\n content += 'export default withNextIntl(nextConfig);\\n';\n }\n\n await writeFile(nextConfigPath, content);\n }\n }\n};\n\nexport const updateTypesIndex = async (projectPath: string): Promise<void> => {\n const typesIndexPath = path.join(projectPath, PROJECT_PATHS.TYPES_INDEX);\n if (fileExists(typesIndexPath)) {\n let content = await readFile(typesIndexPath);\n if (!content.includes('./i18n')) {\n content += \"export * from './i18n';\\n\";\n await writeFile(typesIndexPath, content);\n }\n }\n};\n\nexport const updateConfigIndex = async (projectPath: string): Promise<void> => {\n const configIndexPath = path.join(projectPath, PROJECT_PATHS.CONFIG_INDEX);\n if (fileExists(configIndexPath)) {\n let content = await readFile(configIndexPath);\n if (!content.includes('./app-locales')) {\n content += \"export * from './app-locales';\\n\";\n await writeFile(configIndexPath, content);\n }\n }\n};\n\nexport const updateRootProvider = async (projectPath: string): Promise<void> => {\n const rootProviderPath = path.join(projectPath, 'src/providers/RootProvider.tsx');\n if (fileExists(rootProviderPath)) {\n let content = await readFile(rootProviderPath);\n\n // Handle 'use client'\n const useClientDirective = \"'use client';\";\n const hasUseClient = content.includes(useClientDirective);\n\n if (hasUseClient) {\n content = content.replace(useClientDirective, '').trim();\n }\n\n // Add imports\n if (!content.includes('next-intl')) {\n const imports = `import { SupportedLocale } from '@/types/i18n';\nimport { NextIntlClientProvider, AbstractIntlMessages } from 'next-intl';\n`;\n content = imports + content;\n }\n\n // Re-add 'use client' at the top\n if (hasUseClient) {\n content = useClientDirective + '\\n' + content;\n }\n\n // Update Props\n // Replace props type or signature\n if (!content.includes('locale: SupportedLocale')) {\n // Try to find the props definition\n // This assumes a specific structure, might need to be more robust\n // We'll look for the component definition\n const componentRegex = /export const RootProvider = \\(\\{([\\s\\S]*?)\\}: \\{([\\s\\S]*?)\\}\\) => \\{/;\n const match = content.match(componentRegex);\n\n if (match) {\n const newParams = `\\n children,\\n locale,\\n messages,`;\n const newTypes = `\\n children: React.ReactNode;\\n locale: SupportedLocale;\\n messages: AbstractIntlMessages;`;\n\n content = content.replace(\n match[0],\n `export const RootProvider = ({${newParams}\\n}: {${newTypes}\\n}) => {`,\n );\n }\n }\n\n // Wrap with NextIntlClientProvider\n if (!content.includes('<NextIntlClientProvider')) {\n const returnMatch = content.match(/return \\(\\s*([\\s\\S]*?)\\s*\\);/);\n if (returnMatch) {\n // We want NextIntlClientProvider to be inside CustomThemeProvider if possible, or just wrap children\n // But usually it wraps everything inside the provider\n // Let's wrap the inner content\n content = content.replace(/return \\(\\s*<([^>]+)([^>]*)>([\\s\\S]*)<\\/\\1>\\s*\\);/, (match) => {\n return match.replace(\n /\\{children\\}/,\n `<NextIntlClientProvider locale={locale} messages={messages}>\\n {children}\\n </NextIntlClientProvider>`,\n );\n });\n }\n }\n\n await writeFile(rootProviderPath, content);\n }\n};\n\nexport const migrateToLocaleStructure = async (projectPath: string): Promise<void> => {\n const rootLayoutPath = path.join(projectPath, PROJECT_PATHS.ROOT_LAYOUT);\n const rootPagePath = path.join(projectPath, PROJECT_PATHS.ROOT_PAGE);\n const localeDir = path.join(projectPath, 'src/app/[locale]');\n\n // Create [locale] directory\n await fs.mkdir(localeDir, { recursive: true });\n\n // Move Layout\n if (fileExists(rootLayoutPath)) {\n const destLayoutPath = path.join(localeDir, 'layout.tsx');\n let content = await readFile(rootLayoutPath);\n\n // Add imports\n if (!content.includes('next-intl')) {\n content =\n `import { routing } from '@/i18n/routing';\nimport { hasLocale } from 'next-intl';\nimport { notFound } from 'next/navigation';\nimport { setRequestLocale, getMessages } from 'next-intl/server';\n` + content;\n }\n\n // Add generateStaticParams\n if (!content.includes('generateStaticParams')) {\n const metadataEndIndex = content.indexOf('};', content.indexOf('export const metadata'));\n if (metadataEndIndex !== -1) {\n const insertPos = metadataEndIndex + 2;\n content =\n content.slice(0, insertPos) +\n `\\n\\nexport function generateStaticParams() {\n return routing.locales.map((locale) => ({ locale }));\n}` +\n content.slice(insertPos);\n }\n }\n\n // Update RootLayout signature and body\n // Replace props type\n content = content.replace(\n /Readonly<\\{\\s*children:\\s*React\\.ReactNode;\\s*}>/,\n `Readonly<{\n children: React.ReactNode;\n params: Promise<{ locale: string }>;\n}>`,\n );\n\n // Add logic inside function\n // Handle both async and non-async function definitions\n const functionBodyRegex =\n /export default (async )?function RootLayout\\(\\{\\s*children,?\\s*\\}\\s*:/;\n const functionMatch = content.match(functionBodyRegex);\n\n if (functionMatch) {\n const isAsync = functionMatch[1];\n\n // Ensure it's async\n if (!isAsync) {\n content = content.replace('export default function', 'export default async function');\n }\n\n // 1. Inject params destructuring\n content = content.replace(\n /export default (async )?function RootLayout\\(\\{\\s*children,?\\s*\\}\\s*:/,\n 'export default async function RootLayout({ children, params }:',\n );\n\n // 2. Inject logic at start of function\n const bodyStartRegex = /export default async function RootLayout[\\s\\S]*?\\)\\s*\\{/;\n const bodyMatch = content.match(bodyStartRegex);\n\n if (bodyMatch && bodyMatch.index !== undefined) {\n const bodyOpenBrace = bodyMatch.index + bodyMatch[0].length - 1;\n const logic = `\n const { locale } = await params;\n\n if (!hasLocale(routing.locales, locale)) {\n notFound();\n }\n\n setRequestLocale(locale);\n\n const messages = await getMessages();\n`;\n content = content.slice(0, bodyOpenBrace + 1) + logic + content.slice(bodyOpenBrace + 1);\n }\n\n // 3. Update RootProvider usage\n content = content.replace(\n /<RootProvider>/,\n '<RootProvider locale={locale} messages={messages}>',\n );\n\n // 4. Update html lang\n content = content.replace(/<html lang=\"en\"/, '<html lang={locale}');\n }\n\n await writeFile(destLayoutPath, content);\n await deleteFile(rootLayoutPath);\n }\n\n // Move Page\n if (fileExists(rootPagePath)) {\n const destPagePath = path.join(localeDir, 'page.tsx');\n let content = await readFile(rootPagePath);\n\n // Add imports\n if (!content.includes('next-intl')) {\n content =\n `import { SupportedLocale } from '@/types/i18n';\nimport { setRequestLocale } from 'next-intl/server';\n` + content;\n }\n\n // Update Page signature\n content = content.replace(\n /export default function Home\\(\\)/,\n `type Props = {\n params: Promise<{ locale: string }>;\n};\n\nexport default async function Home(props: Props)`,\n );\n\n // Inject logic\n const bodyOpenBrace = content.indexOf('export default async function Home(props: Props) {');\n if (bodyOpenBrace !== -1) {\n const logic = `\n const locale = (await props.params).locale as SupportedLocale;\n setRequestLocale(locale);\n`;\n const braceIndex = content.indexOf('{', bodyOpenBrace);\n content = content.slice(0, braceIndex + 1) + logic + content.slice(braceIndex + 1);\n }\n\n await writeFile(destPagePath, content);\n await deleteFile(rootPagePath);\n }\n};\n", "import { Command } from 'commander';\nimport { registerAppCommand } from './app';\nimport { registerFeatureCommand } from './feature';\nimport { registerSliceCommand } from './slice';\nimport { registerServiceCommand } from './service';\nimport { registerSetupCommand } from './setup';\n\nexport const registerCommands = (program: Command) => {\n registerAppCommand(program);\n registerSetupCommand(program);\n registerFeatureCommand(program);\n registerSliceCommand(program);\n registerServiceCommand(program);\n};\n"],
|
|
5
|
+
"mappings": ";AAAA,OAAS,WAAAA,OAAe,YCCxB,OAAOC,OAAU,YACjB,OAAOC,MAAQ,aCFf,OAAOC,OAA2B,MAG3B,SAASC,EAAaC,EAAO,GAAIC,EAAwB,CAC9D,IAAMC,EAAUJ,GAAI,CAAE,KAAAE,EAAM,GAAGC,CAAQ,CAAC,EACxC,OAAAC,EAAQ,MAAM,EACPA,CACT,CCPA,OAAOC,OAAc,WAGrB,GAAM,CAAE,OAAAC,EAAO,EAAID,GAoCNE,GAA0B,MAAOC,GAAkD,CAC9F,IAAMC,EAAW,MAAMH,GAAuB,CAC5C,CACE,KAAM,QACN,KAAM,cACN,QAAS,4BACT,QAASE,GAAe,SACxB,KAAM,CAAC,CAACA,EACR,SAAWE,GACJ,gBAAgB,KAAKA,CAAK,EAGxB,GAFE,oGAIb,EACA,CACE,KAAM,QACN,KAAM,cACN,QAAS,uBACT,QAAS,uBACX,EACA,CACE,KAAM,QACN,KAAM,SACN,QAAS,UACT,QAAS,UACX,EACA,CACE,KAAM,QACN,KAAM,UACN,QAAS,WACT,QAAS,QACT,SAAWA,GACJ,kBAAkB,KAAKA,CAAK,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", "startSpinner", "text", "options", "spinner", "Enquirer", "prompt", "promptForProjectDetails", "initialName", "response", "value", "httpsPattern", "sshPattern", "answers", "baseUrl", "fs", "path", "existsSync", "readFile", "filePath", "writeFile", "content", "copyFile", "source", "destination", "deleteFile", "deleteDirectory", "dirPath", "updateJson", "update", "json", "updatedJson", "fileExists", "exec", "promisify", "execAsync", "initializeGit", "cwd", "gitRemote", "error", "exec", "promisify", "execAsync", "installDependencies", "cwd", "manager", "command", "error", "runScript", "script", "getPackageManager", "userAgent", "detectPackageManager", "existsSync", "path", "installPackages", "packages", "getInstallCommand", "installPackage", "packageName", "pc", "colorMap", "s", "print", "message", "color", "colorFn", "text", "error", "message", "print", "logError", "log", "message", "print", "printBanner", "setupCancellationHandlers", "options", "logger", "m", "exitOnCancel", "onCancel", "onUncaught", "err", "onRejection", "reason", "capitalize", "str", "kebabToCamel", "_", "letter", "kebabToPascal", "ora", "spinner", "degit", "cloneTemplate", "projectPath", "spinner", "startSpinner", "degit", "error", "path", "PROJECT_PATHS", "PACKAGES", "configurePackageJson", "projectPath", "answers", "spinner", "startSpinner", "gitRemote", "gitHomepage", "gitIssues", "updateJson", "path", "PROJECT_PATHS", "pkg", "PACKAGES", "error", "path", "cleanupFeatures", "projectPath", "answers", "spinner", "startSpinner", "cleanupHttpClient", "cleanupSecureStorage", "cleanupRedux", "cleanupDarkMode", "cleanupI18n", "cleanupLicense", "cleanupChangelog", "cleanupConfig", "error", "httpUtilsPath", "path", "PROJECT_PATHS", "keepSecureStorage", "deleteDirectory", "writeFile", "deleteFile", "utilsIndexPath", "fileExists", "content", "readFile", "configIndexPath", "constantsPath", "typesIndexPath", "httpTypesPath", "typesContent", "providersIndexPath", "providersIndexContent", "pagesToClean", "pagePath", "globalsCssPath", "cssContent", "layoutPath", "layoutContent", "nextConfigPath", "configContent", "counterComponentPath", "path", "generateRootProvider", "projectPath", "answers", "imports", "providers", "rootProviderContent", "content", "writeFile", "path", "PROJECT_PATHS", "generateLayout", "basicLayout", "counterImport", "counterComponent", "basicPage", "path", "readdir", "setupDevTools", "projectPath", "answers", "setupPreCommitHooks", "setupCommitizen", "setupCiCd", "setupGithubTemplates", "setupCommunityFiles", "setupDocker", "setupReadme", "deleteDirectory", "path", "PROJECT_PATHS", "deleteFile", "updateJson", "pkg", "PACKAGES", "githubPath", "issueTemplatePath", "prTemplatePath", "replacePlaceholders", "content", "fileExists", "readFile", "writeFile", "files", "readdir", "file", "filePath", "allCommunityFiles", "envPath", "envContent", "updateEnvVar", "key", "value", "regex", "findReadmes", "dir", "entries", "entry", "fullPath", "allReadmes", "rootReadmePath", "readmePath", "simpleReadme", "registerAppCommand", "program", "name", "createApp", "initialName", "printBanner", "log", "answers", "promptForProjectDetails", "projectPath", "path", "fileExists", "pc", "spinner", "startSpinner", "performCleanup", "deleteDirectory", "cleanupErr", "handleSignal", "cloneTemplate", "configurePackageJson", "cleanupFeatures", "generateRootProvider", "generateLayout", "setupDevTools", "initializeGit", "installDependencies", "runScript", "envExamplePath", "envPath", "err", "pc", "path", "Enquirer", "prompt", "promptForFeatureDetails", "featureName", "hasRedux", "httpClient", "skipStore", "storeOption", "skipService", "serviceClient", "questions", "value", "answers", "readFile", "access", "path", "detectProjectSetup", "projectPath", "hasRedux", "hasAxios", "hasFetch", "hasI18n", "packageJsonPath", "packageJsonContent", "packageJson", "dependencies", "axiosClientPath", "fetchClientPath", "httpClient", "error", "featureExists", "featureName", "basePath", "featurePath", "writeFile", "mkdir", "path", "generateFeatureStructure", "options", "featurePath", "mkdir", "path", "generateComponentFile", "generateHookFile", "generateTypesFile", "generateIndexFile", "generateStoreFiles", "generateServiceFile", "generateComponentFile", "options", "featureName", "featurePath", "componentName", "kebabToPascal", "hookName", "content", "writeFile", "path", "generateHookFile", "createStore", "generateTypesFile", "generateStoreFiles", "persistStore", "camelName", "kebabToCamel", "sliceContent", "selectorsContent", "persistContent", "storeIndexContent", "generateServiceFile", "httpClient", "generateIndexFile", "createService", "readFile", "writeFile", "path", "registerFeatureInRootReducer", "projectPath", "featureName", "withPersist", "basePath", "path", "rootReducerPath", "content", "readFile", "camelName", "kebabToCamel", "reducerName", "importName", "importPath", "importStatement", "importRegex", "imports", "lastImport", "lastImportIndex", "combineReducersRegex", "match", "reducersContent", "newReducerEntry", "updatedReducersContent", "writeFile", "error", "registerSliceInRootReducer", "sliceName", "readFile", "writeFile", "path", "registerApiEndpoints", "options", "serviceName", "projectPath", "camelName", "kebabToCamel", "apiConfigPath", "path", "content", "readFile", "newEndpoint", "closingBracePattern", "insertPosition", "beforeClosing", "afterClosing", "hasExistingEndpoints", "needsComma", "updatedContent", "writeFile", "error", "registerFeatureCommand", "program", "name", "options", "projectPath", "logError", "log", "pc", "spinner", "detection", "detectProjectSetup", "featureOptions", "promptForFeatureDetails", "basePath", "path", "featurePath", "featureExists", "generateFeatureStructure", "registerApiEndpoints", "registerFeatureInRootReducer", "displayPath", "importPath", "error", "pc", "path", "existsSync", "mkdir", "Enquirer", "prompt", "promptForSliceDetails", "sliceName", "persist", "noPersist", "questions", "value", "answers", "writeFile", "mkdir", "path", "generateSliceFiles", "options", "sliceName", "slicePath", "persistSlice", "mkdir", "componentName", "kebabToPascal", "camelName", "kebabToCamel", "generateTypesFile", "generateSliceFile", "generateSelectorsFile", "generatePersistFile", "generateIndexFile", "content", "writeFile", "path", "access", "path", "sliceExists", "projectPath", "sliceName", "basePath", "slicePath", "registerSliceCommand", "program", "name", "options", "projectPath", "logError", "log", "pc", "spinner", "detection", "detectProjectSetup", "sliceOptions", "promptForSliceDetails", "basePath", "featureName", "slicePath", "customPath", "path", "featureStorePath", "existsSync", "mkdir", "sliceExists", "generateSliceFiles", "registerSliceInRootReducer", "displayPath", "importPath", "error", "pc", "path", "existsSync", "mkdir", "enquirer", "promptForServiceDetails", "name", "axiosFlag", "fetchFlag", "availableClients", "serviceName", "input", "httpClient", "writeFile", "path", "generateServiceFiles", "options", "generateServiceFile", "serviceName", "servicePath", "httpClient", "camelName", "kebabToCamel", "content", "fileName", "writeFile", "path", "existsSync", "path", "serviceExists", "projectPath", "serviceName", "basePath", "servicePath", "registerServiceCommand", "program", "name", "options", "projectPath", "logError", "log", "pc", "spinner", "detection", "detectProjectSetup", "availableClients", "serviceOptions", "promptForServiceDetails", "basePath", "featureName", "servicePath", "customPath", "path", "existsSync", "mkdir", "serviceExists", "generateServiceFiles", "registerApiEndpoints", "displayPath", "importPath", "error", "pc", "Enquirer", "path", "pc", "path", "path", "findLayoutPath", "projectPath", "possibleLayoutPaths", "path", "PROJECT_PATHS", "p", "fileExists", "readFile", "checkIsAlreadySetup", "projectPath", "themeProviderPath", "path", "PROJECT_PATHS", "globalsCssPath", "packageJsonPath", "fileExists", "packageJson", "readFile", "validateProjectStructure", "providersIndexPath", "layoutPath", "findLayoutPath", "path", "degit", "fetchAssets", "tempDir", "spinner", "degit", "copyThemeProvider", "projectPath", "themeProviderPath", "path", "PROJECT_PATHS", "sourceProviderPath", "copyFile", "path", "updateProvidersIndex", "projectPath", "providersIndexPath", "path", "PROJECT_PATHS", "providersContent", "readFile", "writeFile", "updateRootProvider", "rootProviderPath", "fileExists", "rootProviderContent", "match", "tag", "attrs", "content", "updateGlobalsCss", "tempDir", "globalsCssPath", "sourceCssPath", "darkThemeCss", "sourceCss", "variantMatch", "themeMatch", "cssContent", "lastImportIndex", "endOfLineIndex", "updateLayout", "layoutPath", "layoutContent", "setupDarkTheme", "projectPath", "spinner", "startSpinner", "tempDir", "path", "isSetup", "reason", "checkIsAlreadySetup", "layoutPath", "validateProjectStructure", "fetchAssets", "copyThemeProvider", "updateProvidersIndex", "updateRootProvider", "updateGlobalsCss", "updateLayout", "installPackage", "packageManager", "detectPackageManager", "runScript", "pc", "error", "deleteDirectory", "path", "pc", "path", "checkIsAlreadySetup", "projectPath", "storePath", "path", "PROJECT_PATHS", "packageJsonPath", "fileExists", "packageJson", "readFile", "validateProjectStructure", "providersIndexPath", "findLayoutPath", "path", "degit", "fs", "fetchAssets", "tempDir", "spinner", "degit", "copyReduxFiles", "projectPath", "sourceProviderPath", "path", "destProviderPath", "PROJECT_PATHS", "copyFile", "sourceStoreDir", "destStoreDir", "createCounterFeature", "sourceFeatureDir", "destFeatureDir", "counterComponentPath", "fileExists", "content", "readFile", "writeFile", "path", "updateProvidersIndex", "projectPath", "providersIndexPath", "path", "PROJECT_PATHS", "providersContent", "readFile", "writeFile", "updateRootProvider", "rootProviderPath", "fileExists", "rootProviderContent", "match", "tag", "attrs", "content", "updatePage", "possiblePagePaths", "pagePath", "p", "pageContent", "lastDivIndex", "lastMainIndex", "insertIndex", "setupRedux", "projectPath", "spinner", "startSpinner", "tempDir", "path", "isSetup", "reason", "checkIsAlreadySetup", "validateProjectStructure", "fetchAssets", "copyReduxFiles", "createCounterFeature", "updateProvidersIndex", "updateRootProvider", "updatePage", "installPackage", "packageManager", "detectPackageManager", "runScript", "pc", "error", "deleteDirectory", "path", "pc", "path", "checkIsAlreadySetup", "projectPath", "i18nDir", "path", "PROJECT_PATHS", "packageJsonPath", "fileExists", "packageJson", "readFile", "validateProjectStructure", "rootLayoutPath", "localeLayoutPath", "path", "degit", "fs", "fetchAssets", "tempDir", "spinner", "degit", "copyI18nFiles", "projectPath", "sourceI18nDir", "path", "destI18nDir", "PROJECT_PATHS", "sourceProxyPath", "destProxyPath", "copyFile", "sourceTypesPath", "destTypesPath", "sourceLocalesPath", "destLocalesPath", "path", "fs", "updateNextConfig", "projectPath", "nextConfigPath", "path", "PROJECT_PATHS", "fileExists", "content", "readFile", "exportDefaultRegex", "writeFile", "updateTypesIndex", "typesIndexPath", "updateConfigIndex", "configIndexPath", "updateRootProvider", "rootProviderPath", "useClientDirective", "hasUseClient", "componentRegex", "match", "migrateToLocaleStructure", "rootLayoutPath", "rootPagePath", "localeDir", "destLayoutPath", "metadataEndIndex", "insertPos", "functionBodyRegex", "functionMatch", "bodyStartRegex", "bodyMatch", "bodyOpenBrace", "deleteFile", "destPagePath", "logic", "braceIndex", "setupI18n", "projectPath", "spinner", "startSpinner", "tempDir", "path", "isSetup", "reason", "checkIsAlreadySetup", "validateProjectStructure", "fetchAssets", "copyI18nFiles", "updateNextConfig", "updateTypesIndex", "updateConfigIndex", "updateRootProvider", "migrateToLocaleStructure", "installPackage", "packageManager", "detectPackageManager", "runScript", "pc", "error", "deleteDirectory", "prompt", "Enquirer", "registerSetupCommand", "program", "options", "log", "pc", "feature", "setupDarkTheme", "setupRedux", "setupI18n", "error", "spinner", "logError", "registerCommands", "program", "registerAppCommand", "registerSetupCommand", "registerFeatureCommand", "registerSliceCommand", "registerServiceCommand", "main", "setupCancellationHandlers", "m", "error", "program", "Command", "registerCommands", "err", "message"]
|
|
7
7
|
}
|