@codefast/cli 0.3.1-canary.11 โ 0.3.1-canary.13
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 +24 -0
- package/dist/index.cjs +166 -144
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +166 -144
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["webpack://@codefast/cli/./src/commands/create-project/utils.ts","webpack://@codefast/cli/./src/commands/create-project/project-name.ts","webpack://@codefast/cli/./src/commands/create-project/check-existing-project.ts","webpack://@codefast/cli/./src/commands/create-project/constants.ts","webpack://@codefast/cli/./src/commands/create-project/config-files.ts","webpack://@codefast/cli/./src/commands/create-project/dependencies.ts","webpack://@codefast/cli/./src/commands/create-project/environment.ts","webpack://@codefast/cli/./src/commands/create-project/next-project.ts","webpack://@codefast/cli/./src/commands/create-project/command.ts","webpack://@codefast/cli/./src/commands/update-exports/analyze-imports.ts","webpack://@codefast/cli/./src/commands/update-exports/types.ts","webpack://@codefast/cli/./src/commands/update-exports/config.ts","webpack://@codefast/cli/./src/commands/update-exports/file-utils.ts","webpack://@codefast/cli/./src/commands/update-exports/generate-exports.ts","webpack://@codefast/cli/./src/commands/update-exports/process-package.ts","webpack://@codefast/cli/./src/commands/update-exports/command.ts","webpack://@codefast/cli/./src/lib/package-info.ts","webpack://@codefast/cli/./src/index.ts"],"sourcesContent":["import { execSync } from \"node:child_process\";\nimport fs from \"node:fs\";\nimport readline from \"node:readline\";\n\n/**\n * Represents an interface for reading and writing data to the console or other input/output streams.\n *\n * This interface allows interaction with standard input and output streams by reading input and writing output\n * in a controlled manner. It is commonly used for creating command-line interfaces or handling user input.\n */\nexport const rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout,\n});\n\n/**\n * Asks a user a question and returns their response as a trimmed string.\n *\n * @param question - The question to present to the user.\n * @returns A promise that resolves with the user's response as a trimmed string.\n */\nexport function prompt(question: string): Promise<string> {\n return new Promise((resolve) => {\n rl.question(question, (answer) => {\n resolve(answer.trim());\n });\n });\n}\n\n/**\n * Executes a shell command synchronously and inherits the output behavior of the current process.\n *\n * @param command - The shell command to be executed.\n * @returns void\n */\nexport function runCommand(command: string): void {\n execSync(command, { stdio: \"inherit\" });\n}\n\n/**\n * Writes configuration content to a specified file.\n *\n * @param filePath - The path of the file where the configuration content should be written.\n * @param content - The configuration content to write into the file.\n * @returns void\n */\nexport function writeConfigFile(filePath: string, content: string): void {\n fs.writeFileSync(filePath, content);\n console.log(`๐ Created ${filePath}`);\n}\n","import fs from \"node:fs\";\nimport path from \"node:path\";\n\nimport { prompt } from \"@/commands/create-project/utils\";\n\n/**\n * Validates the given project name against various criteria to ensure it is suitable for use.\n *\n * The validation checks include:\n * - Ensuring the name is not empty or comprised only of whitespace.\n * - Restricting the maximum length of the name to 100 characters.\n * - Enforcing URL-friendly naming conventions, prohibiting special characters such as `@` or names resembling scoped\n * packages.\n * - Preventing the use of prohibited project names such as '.' or '..'.\n * - Restricting the use of reserved system names on Windows.\n * - Ensuring that the specified project name does not conflict with an existing directory in the current working\n * directory.\n * - Verifying that the current directory has write permissions for the creation of a new project.\n *\n * @param name - The proposed project name to be validated.\n * @returns An object indicating whether the project name is valid. If invalid, an error message is provided.\n */\nfunction validateProjectName(name: string): { valid: boolean; error?: string } {\n // Check if the name is empty or contains only spaces.\n if (!name || /^\\s*$/.test(name)) {\n return { valid: false, error: \"Project name cannot be empty or contain only whitespace.\" };\n }\n\n // Check the name length\n if (name.length > 100) {\n return { valid: false, error: \"Project name is too long (maximum 100 characters).\" };\n }\n\n // Check the package name format according to npm standard (scoped packages are not allowed).\n const npmNameRegex = /^[a-z0-9-~][a-z0-9-._~]*$/;\n\n if (!npmNameRegex.test(name)) {\n return {\n valid: false,\n error:\n \"Project name must be URL-friendly (letters, numbers, hyphens, underscores, dots; no @ or scoped packages).\",\n };\n }\n\n // Check if the name contains only dots.\n if (name === \".\" || name === \"..\") {\n return { valid: false, error: \"Project name cannot be '.' or '..'.\" };\n }\n\n // Checking system keywords on Windows\n const reservedNames = /^(?<reserved>CON|PRN|AUX|NUL|COM[1-9]|LPT[1-9])$/i;\n\n if (reservedNames.test(name)) {\n return { valid: false, error: `Project name \"${name}\" is a reserved system name.` };\n }\n\n // Check the existence of the directory\n const fullPath = path.resolve(process.cwd(), name);\n\n if (fs.existsSync(fullPath)) {\n return { valid: false, error: `A directory named \"${name}\" already exists.` };\n }\n\n // Check write permission\n try {\n fs.accessSync(process.cwd(), fs.constants.W_OK);\n } catch {\n return { valid: false, error: \"Cannot create project: No write permission in current directory.\" };\n }\n\n return { valid: true };\n}\n\n/**\n * Asynchronously prompts the user to enter a valid project name, validating the input and retrying up to a specified\n * number of attempts if necessary.\n *\n * @param initialName - An optional initial project name to validate; if not provided, the user will be prompted to\n * enter a name.\n * @param attempts - The current number of validation attempts made. Defaults to 0.\n * @param maxAttempts - The maximum number of validation attempts allowed. Defaults to 3.\n * @returns A promise that resolves to a valid project name as a string.\n * @throws An error if the maximum number of validation attempts is exceeded.\n */\nexport async function getValidProjectName(initialName?: string, attempts = 0, maxAttempts = 3): Promise<string> {\n const projectName = initialName ?? (await prompt(\"Enter project name: \"));\n\n const validation = validateProjectName(projectName);\n\n if (validation.valid) {\n return projectName;\n }\n\n if (attempts >= maxAttempts - 1) {\n throw new Error(`โ Exceeded maximum attempts to enter a valid project name.`);\n }\n\n console.error(`โ ${validation.error} (${maxAttempts - attempts - 1} attempts remaining)`);\n\n return getValidProjectName(undefined, attempts + 1, maxAttempts);\n}\n","import fs from \"node:fs\";\nimport path from \"node:path\";\n\nimport { getValidProjectName } from \"@/commands/create-project/project-name\";\nimport { prompt } from \"@/commands/create-project/utils\";\n\n/**\n * Checks if a package.json file exists in the current directory and determines the project name.\n * If package.json exists, it prompts the user to confirm continuing with the existing project\n * and retrieves the project name from package.json or the provided argument.\n * If package.json does not exist, it validates the provided project name or prompts for a new one.\n *\n * @param projectNameArg - Optional project name provided as an argument.\n * @returns A promise that resolves to an object containing the project name and a boolean indicating if package.json\n * exists.\n * @throws An error if the user aborts the operation or if the project name cannot be determined.\n */\nexport async function checkExistingProject(\n projectNameArg?: string,\n): Promise<{ packageJsonExists: boolean; projectName: string }> {\n const packageJsonPath = path.join(process.cwd(), \"package.json\");\n const packageJsonExists = fs.existsSync(packageJsonPath);\n\n if (packageJsonExists) {\n console.log(`โ ๏ธ A package.json file has been detected in the current directory.`);\n const confirm = await prompt(\"Do you want to continue configuring this existing project? [Y/n]: \");\n\n // Default to 'Y' if the input is empty; otherwise, check for 'y' or 'Y'\n if (confirm === \"\" || confirm.toLowerCase() === \"y\") {\n const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, \"utf8\"));\n const projectName = packageJson.name ?? (await getValidProjectName(projectNameArg));\n\n return { projectName, packageJsonExists };\n }\n\n console.log(\"Aborting...\");\n throw new Error(\"User aborted the operation.\");\n }\n\n const projectName = await getValidProjectName(projectNameArg);\n\n return { projectName, packageJsonExists };\n}\n","/**\n * Main dependencies need to be installed\n */\nexport const MAIN_DEPENDENCIES = [\n \"@codefast/ui\",\n \"@codefast/hooks\",\n \"recharts\",\n \"react-hook-form\",\n \"next-themes\",\n \"date-fns\",\n \"lucide-react\",\n];\n\n/**\n * Development dependencies are grouped by function.\n */\nexport const DEV_DEPENDENCIES = {\n commitLint: [\"@commitlint/cli\", \"@commitlint/config-conventional\", \"@commitlint/types\"],\n gitTools: [\"simple-git-hooks\"],\n formatting: [\"prettier\", \"prettier-plugin-packagejson\", \"prettier-plugin-tailwindcss\", \"lint-staged\"],\n linting: [\"@codefast/eslint-config\"],\n};\n\n/**\n * Packages that need to be removed from the project\n */\nexport const PACKAGES_TO_REMOVE = [\"@eslint/eslintrc\", \"eslint-config-next\"];\n\n/**\n * Define a schema for a configuration file\n */\nexport interface ConfigFile {\n /** Configuration file content */\n content: string;\n /** Path to the configuration file */\n path: string;\n /** Description of file purpose options */\n description?: string;\n}\n\n/**\n * Define configuration categories\n */\nexport type ConfigCategory = \"deployment\" | \"formatting\" | \"linting\" | \"styles\";\n\n/**\n * Type for the configuration groups\n */\nexport type ConfigGroups = Record<ConfigCategory, ConfigFile[]>;\n\n/**\n * Group configurations by tool type\n */\nexport const configGroups: ConfigGroups = {\n deployment: [\n {\n path: \".vercelignore\",\n content: `#-------------------------------------------------------------------------------\n# Dependencies and package managers\n#-------------------------------------------------------------------------------\n\n# Node dependencies\nnode_modules\n.pnpm-store\n.yarn\n\n#-------------------------------------------------------------------------------\n# Development and environment\n#-------------------------------------------------------------------------------\n\n# Environment variables (except examples)\n.env*\n!.env.example\n\n# Build artifacts\n.next\nbuild\ndist\n.git\n.github\n.turbo\n.changeset\n.eslintcache\n\n# Debug logs\nnpm-debug.log*\nyarn-debug.log*\n\n#-------------------------------------------------------------------------------\n# Testing\n#-------------------------------------------------------------------------------\n\n# Test coverage reports and config snapshots\ncoverage\n*.test.*\n*.e2e.*\n\n#-------------------------------------------------------------------------------\n# Editor and IDE configuration\n#-------------------------------------------------------------------------------\n\n# IDE project files\n.idea\n*.suo\n*.ntvs*\n*.njsproj\n*.sln\n\n#-------------------------------------------------------------------------------\n# Operating system files\n#-------------------------------------------------------------------------------\n\n# System metadata files\n.DS_Store\nThumbs.db\n\n#-------------------------------------------------------------------------------\n# Deployment\n#-------------------------------------------------------------------------------\n\n# Vercel deployment configuration\n.vercel\n`,\n description: \"Ignore files that should not be deployed to Vercel\",\n },\n ],\n formatting: [\n {\n path: \"prettier.config.mjs\",\n content: `/**\n * @see https://prettier.io/docs/en/configuration.html\n * @type {import('prettier').Config}\n */\nconst config = {\n plugins: [\"prettier-plugin-packagejson\", \"prettier-plugin-tailwindcss\"],\n printWidth: 100,\n tailwindAttributes: [\"classNames\"],\n tailwindFunctions: [\"tv\"],\n};\n\nexport default config;\n`,\n description: \"Prettier configuration for source code formatting\",\n },\n {\n path: \".editorconfig\",\n content: `# https://editorconfig.org\nroot = true\n\n[*]\ncharset = utf-8\ninsert_final_newline = true\n\nend_of_line = lf\nindent_style = space\nindent_size = 2\nmax_line_length = 120\n\ntrim_trailing_whitespace = true\n\n[Makefile]\nindent_style = tab\n\n[{go.mod,go.sum,*.go}]\nindent_style = tab\n\n[*.rs]\n# Keep in sync with rustfmt\nindent_size = 4\n`,\n description: \"Editor configuration for source code formatting\",\n },\n {\n path: \".prettierignore\",\n content: `# changesets\n.changeset\n\n# debug\nnpm-debug.log*\nyarn-debug.log*\nyarn-error.log*\n.pnpm-debug.log*\n\n# lock files\npackage-lock.json\nyarn.lock\npnpm-lock.yaml\nsrc/app/globals.css\n`,\n description: \"\",\n },\n ],\n linting: [\n {\n path: \"commitlint.config.mjs\",\n content: `/**\n * @see https://commitlint.js.org/reference/configuration.html\n * @type {import('@commitlint/types').UserConfig}\n */\nconst config = {\n extends: [\"@commitlint/config-conventional\"],\n rules: {\n \"body-max-line-length\": [2, \"always\", 350],\n },\n};\n\nexport default config;\n`,\n description: \"Commitlint configuration\",\n },\n {\n path: \"eslint.config.mjs\",\n content: `import { config } from \"@codefast/eslint-config/next\";\n/**\n * @see https://eslint.org/docs/latest/use/configure/configuration-files\n * @type {import('eslint').Linter.Config[]}\n */\nconst eslintConfig = [...config];\n\nexport default eslintConfig;\n`,\n description: \"ESLint configuration for the project\",\n },\n {\n path: \"lint-staged.config.mjs\",\n content: `import { relative } from \"node:path\";\n\n/**\n * Builds an ESLint command with the given filenames.\n *\n * @param {string[]} filenames - An array of filenames to be passed to the\n * ESLint command.\n * @returns {string} - The generated ESLint command.\n */\nfunction buildEslintCommand(filenames) {\n return \\`next lint --fix --max-warnings 0 --file \\${filenames.map((file) => relative(import.meta.dirname, file)).\n join(\" --file \")}\\`;\n}\n\n/**\n * @see https://www.npmjs.com/package/lint-staged\n * @type {import('lint-staged').Configuration}\n */\nconst config = {\n \"*.{js,mjs,jsx,ts,tsx}\": [buildEslintCommand, \"prettier --list-different --write\"],\n \"*.{json,css,md,mdx}\": [\"prettier --list-different --write\"],\n};\n\nexport default config;\n`,\n description: \"Configure lint-staged for pre-commit checks\",\n },\n ],\n styles: [\n {\n path: \"src/lib/fonts.ts\",\n content: `import { cn } from \"@codefast/ui\";\nimport { Geist, Geist_Mono as GeistMono } from \"next/font/google\";\n\nconst fontGeistSans = Geist({\n subsets: [\"latin\"],\n variable: \"--font-geist-sans\",\n});\n\nconst fontGeistMono = GeistMono({\n subsets: [\"latin\"],\n variable: \"--font-geist-mono\",\n});\n\nexport const fontVariables = cn(fontGeistSans.variable, fontGeistMono.variable);\n`,\n description: \"Font configuration for the application\",\n },\n {\n path: \"src/app/globals.css\",\n content: `@import \"tailwindcss\";\n\n@import \"@codefast/ui/styles.css\";\n\n@source '../../node_modules/@codefast/ui';\n\n@custom-variant dark (&:where(.dark, .dark *));\n\n@layer base {\n :root {\n --font-sans: var(--font-geist-sans);\n --font-mono: var(--font-geist-mono);\n --input: var(--color-neutral-200);\n --border: var(--color-neutral-200);\n --ring: var(--color-neutral-400);\n --background: var(--color-white);\n --foreground: var(--color-neutral-950);\n --primary: var(--color-sky-500);\n --primary-foreground: var(--color-neutral-50);\n --secondary: var(--color-neutral-100);\n --secondary-foreground: var(--color-neutral-900);\n --destructive: var(--color-red-600);\n --accent: var(--color-neutral-100);\n --accent-foreground: var(--color-neutral-900);\n --muted: var(--color-neutral-100);\n --muted-foreground: var(--color-neutral-500);\n --popover: var(--color-white);\n --popover-foreground: var(--color-neutral-950);\n --popover-overlay: --alpha(var(--color-neutral-900) / 20%);\n --card: var(--color-white);\n --card-foreground: var(--color-neutral-950);\n --sidebar: var(--color-neutral-50);\n --sidebar-foreground: var(--color-neutral-950);\n --sidebar-primary: var(--color-sky-500);\n --sidebar-primary-foreground: var(--color-neutral-50);\n --sidebar-accent: var(--color-neutral-100);\n --sidebar-accent-foreground: var(--color-neutral-900);\n --sidebar-border: var(--color-neutral-200);\n --sidebar-ring: var(--color-neutral-400);\n --chart-1: var(--color-orange-600);\n --chart-2: var(--color-teal-600);\n --chart-3: var(--color-cyan-600);\n --chart-4: var(--color-amber-600);\n --chart-5: var(--color-amber-500);\n }\n .dark {\n --input: var(--color-neutral-700);\n --border: --alpha(var(--color-neutral-700) / 50%);\n --ring: var(--color-neutral-500);\n --background: var(--color-neutral-950);\n --foreground: var(--color-neutral-50);\n --primary: var(--color-sky-700);\n --primary-foreground: var(--color-neutral-50);\n --secondary: var(--color-neutral-800);\n --secondary-foreground: var(--color-neutral-50);\n --destructive: var(--color-red-400);\n --accent: var(--color-neutral-700);\n --accent-foreground: var(--color-neutral-50);\n --muted: var(--color-neutral-800);\n --muted-foreground: var(--color-neutral-400);\n --popover: var(--color-neutral-800);\n --popover-foreground: var(--color-neutral-50);\n --popover-overlay: --alpha(var(--color-neutral-900) / 80%);\n --card: var(--color-neutral-900);\n --card-foreground: var(--color-neutral-50);\n --sidebar: var(--color-neutral-900);\n --sidebar-foreground: var(--color-neutral-50);\n --sidebar-primary: var(--color-sky-700);\n --sidebar-primary-foreground: var(--color-neutral-50);\n --sidebar-accent: var(--color-neutral-800);\n --sidebar-accent-foreground: var(--color-neutral-50);\n --sidebar-border: var(--color-neutral-800);\n --sidebar-ring: var(--color-neutral-600);\n --chart-1: var(--color-blue-700);\n --chart-2: var(--color-emerald-500);\n --chart-3: var(--color-amber-500);\n --chart-4: var(--color-purple-500);\n --chart-5: var(--color-rose-500);\n }\n}\n`,\n description: \"Global CSS variables for the application\",\n },\n ],\n};\n","import fs from \"node:fs\";\nimport path from \"node:path\";\n\nimport { configGroups } from \"@/commands/create-project/constants\";\nimport { writeConfigFile } from \"@/commands/create-project/utils\";\n\n/**\n * Updates the PostCSS configuration file in the specified project directory by adding a type comment for improved\n * editor support.\n *\n * This function checks if a `postcss.config.mjs` file exists in the provided directory.\n * If the file is found, it determines whether the type comment for PostCSS configuration has already been added.\n * If the type comment is missing, it updates the file by inserting the comment above the configuration object\n * definition.\n *\n * @param projectDir - The root directory of the project where the `postcss.config.mjs` file is located\n * @returns void\n */\nexport function updatePostcssConfig(projectDir: string): void {\n const postcssConfigPath = path.join(projectDir, \"postcss.config.mjs\");\n\n if (!fs.existsSync(postcssConfigPath)) {\n console.warn(`โ ๏ธ postcss.config.mjs not found, skipping update.`);\n\n return;\n }\n\n let content = fs.readFileSync(postcssConfigPath, \"utf8\");\n const typeComment = `/** @type {import('postcss-load-config').Config} */\\n`;\n\n // Check if the comment already exists to avoid adding duplicates.\n if (content.includes(typeComment)) {\n console.log(`๐ postcss.config.mjs already contains type comment, no changes made.`);\n } else {\n content = content.replace(\"const config = {\", `${typeComment}const config = {`);\n fs.writeFileSync(postcssConfigPath, content);\n console.log(`๐ Updated postcss.config.mjs with type comment.`);\n }\n}\n\n/**\n * Updates the layout file in a specified project directory by modifying font imports,\n * HTML tag properties, and body className to conform to the necessary changes for using `fontVariables` and\n * applying proper configurations.\n *\n * @param projectDir - The root directory of the project where the layout file resides.\n * @returns void - This function does not return a value.\n */\nexport function updateLayoutFile(projectDir: string): void {\n const layoutPath = path.join(projectDir, \"src/app/layout.tsx\");\n\n if (!fs.existsSync(layoutPath)) {\n console.warn(`โ ๏ธ src/app/layout.tsx not found, skipping update.`);\n\n return;\n }\n\n let content = fs.readFileSync(layoutPath, \"utf8\");\n\n // Check if the file already uses fontVariables in <html> tag\n if (content.includes('<html className={cn(fontVariables, \"antialiased\")} lang=\"en\">')) {\n console.log(`๐ src/app/layout.tsx already uses fontVariables in html tag, no changes made.`);\n\n return;\n }\n\n // Replace font imports and definitions with fontVariables import\n const newImports = `import type { Metadata } from \"next\";\n\nimport { cn } from \"@codefast/ui\";\n\nimport { fontVariables } from \"@/lib/fonts\";\nimport \"@/app/globals.css\";`;\n\n // Remove existing font imports and definitions\n content = content.replaceAll(/import\\s+{[^}]+}\\s+from\\s+[\"']next\\/font\\/google[\"'];\\s*/g, \"\");\n content = content.replace(/const\\s+geistSans\\s*=[^;]+;\\s*const\\s+geistMono\\s*=[^;]+;\\s*/, \"\");\n content = content.replace(\n /import\\s+type\\s+{[^}]+}\\s+from\\s+[\"']next[\"'];\\s*import\\s+[\"']\\.\\/globals\\.css[\"'];\\s*/,\n newImports,\n );\n\n // Update the HTML tag to include className and remove className from the BODY\n const htmlRegex = /<html\\s+lang=\"en\"\\s*>/;\n const newHtml = `<html className={cn(fontVariables, \"antialiased\")} lang=\"en\">`;\n\n content = content.replace(htmlRegex, newHtml);\n\n const bodyRegex = /<body\\s+className={`[^`]*`}\\s*>/;\n const newBody = `<body>`;\n\n content = content.replace(bodyRegex, newBody);\n\n try {\n fs.writeFileSync(layoutPath, content);\n console.log(`๐ Updated src/app/layout.tsx to use fontVariables in html tag and removed className from body`);\n } catch (error: unknown) {\n const errorMessage = error instanceof Error ? error.message : \"Unknown error occurred\";\n\n console.warn(`โ ๏ธ Failed to update src/app/layout.tsx: ${errorMessage}`);\n }\n}\n\n/**\n * Updates the scripts and hooks in the package.json file of the specified project directory.\n * Adds formatting, linting, pre-commit, and commit-msg hooks to the package.json configuration.\n *\n * @param projectDir - The path to the project directory containing the package.json file\n * @returns void\n */\nexport function updatePackageJson(projectDir: string): void {\n const packageJsonPath = path.join(projectDir, \"package.json\");\n const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, \"utf8\"));\n\n packageJson.scripts = {\n ...packageJson.scripts,\n \"deploy:preview\": \"vercel deploy --archive=tgz\",\n \"deploy:prod\": \"vercel deploy --archive=tgz --prod\",\n format: \"prettier --write --ignore-unknown .\",\n \"format:check\": \"prettier --check --ignore-unknown .\",\n lint: \"next lint --fix --max-warnings 0\",\n \"lint:check\": \"next lint --max-warnings 0\",\n \"package:install\": \"pnpm install\",\n \"package:outdated\": \"pnpm outdated\",\n \"package:upgrade\": \"pnpm update --latest\",\n preview: \"pnpm build && pnpm start\",\n };\n\n packageJson[\"simple-git-hooks\"] = {\n \"pre-commit\": \"pnpm lint-staged\",\n \"commit-msg\": \"pnpm commitlint --edit\",\n };\n\n fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2));\n console.log(`๐ Updated package.json`);\n}\n\n/**\n * Updates the Next.js configuration file to add experimental optimizePackageImports for `@codefast/ui`.\n *\n * @param projectDir - The root directory of the project where the next.config.ts file is located\n * @returns void\n */\nexport function updateNextConfig(projectDir: string): void {\n const nextConfigPath = path.join(projectDir, \"next.config.ts\");\n\n if (!fs.existsSync(nextConfigPath)) {\n console.warn(`โ ๏ธ next.config.ts not found, skipping update.`);\n\n return;\n }\n\n let content = fs.readFileSync(nextConfigPath, \"utf8\");\n\n // Check if the experimental configuration already exists\n if (content.includes('optimizePackageImports: [\"@codefast/ui\"]')) {\n console.log(`๐ next.config.ts already contains optimizePackageImports configuration, no changes made.`);\n\n return;\n }\n\n // Add the experimental configuration\n const configPattern = /const nextConfig: NextConfig = \\{/;\n const experimentalConfig = `const nextConfig: NextConfig = {\n experimental: {\n optimizePackageImports: [\"@codefast/ui\"],\n },`;\n\n content = content.replace(configPattern, experimentalConfig);\n\n try {\n fs.writeFileSync(nextConfigPath, content);\n console.log(`๐ Updated next.config.ts with optimizePackageImports configuration.`);\n } catch (error: unknown) {\n const errorMessage = error instanceof Error ? error.message : \"Unknown error occurred\";\n\n console.warn(`โ ๏ธ Failed to update next.config.ts: ${errorMessage}`);\n }\n}\n\n/**\n * Creates configuration files in the specified project directory.\n *\n * @param projectDir - The absolute path to the project directory where the configuration files will be created\n *\n * @returns Nothing.\n */\nexport function createConfigFiles(projectDir: string): void {\n console.log(`\\n๐ Creating configuration files...`);\n\n // Iterate through each configuration category (linting, formatting, styles)\n for (const [category, configs] of Object.entries(configGroups)) {\n console.log(`\\n๐ Setting up ${category} configurations:`);\n\n for (const { path: filePath, content, description } of configs) {\n const fullPath = path.join(projectDir, filePath);\n const dir = path.dirname(fullPath);\n\n // Create a directory if it doesn't exist\n if (!fs.existsSync(dir)) {\n fs.mkdirSync(dir, { recursive: true });\n }\n\n // Write the configuration file and log its description\n writeConfigFile(fullPath, content);\n\n if (description) {\n console.log(` โน๏ธ ${filePath}: ${description}`);\n }\n }\n }\n}\n","import * as fs from \"node:fs\";\nimport * as path from \"node:path\";\n\nimport { DEV_DEPENDENCIES, MAIN_DEPENDENCIES, PACKAGES_TO_REMOVE } from \"@/commands/create-project/constants\";\nimport { runCommand } from \"@/commands/create-project/utils\";\n\n/**\n * Installs project dependencies and development tools required for the application.\n *\n * This function handles the installation of both runtime and development dependencies\n * using the package manager. It ensures the necessary libraries and tools are added to the project\n * for proper operation and coding standards enforcement.\n *\n * @returns void - Does not return a value.\n */\nexport function installDependencies(): void {\n console.log(`\\n๐ Installing dependencies...`);\n\n // Install main dependencies\n if (MAIN_DEPENDENCIES.length > 0) {\n runCommand(`pnpm add ${MAIN_DEPENDENCIES.join(\" \")}`);\n }\n\n // Install development dependencies\n const allDevDependencies = Object.values(DEV_DEPENDENCIES).flat().join(\" \");\n\n if (allDevDependencies) {\n runCommand(`pnpm add -D ${allDevDependencies}`);\n }\n}\n\n/**\n * Removes unnecessary packages that might conflict with the project configuration\n * or are redundant due to alternative packages being used.\n *\n * @returns void - Does not return a value.\n */\nexport function cleanupPackages(): void {\n console.log(`\\n๐งน Cleaning up unnecessary packages...`);\n\n // Read package.json to check existing dependencies\n const packageJsonPath = path.join(process.cwd(), \"package.json\");\n\n if (!fs.existsSync(packageJsonPath)) {\n console.warn(`โ ๏ธ package.json not found, skipping cleanup.`);\n\n return;\n }\n\n let packageJson;\n\n try {\n packageJson = JSON.parse(fs.readFileSync(packageJsonPath, \"utf8\"));\n } catch (error: unknown) {\n const errorMessage = error instanceof Error ? error.message : \"Unknown error occurred\";\n\n console.warn(`โ ๏ธ Error reading package.json: ${errorMessage}, skipping cleanup.`);\n\n return;\n }\n\n // Get existing dependencies and devDependencies\n const dependencies = packageJson.dependencies ?? {};\n const devDependencies = packageJson.devDependencies ?? {};\n\n // Filter packages to remove only those that exist in package.json\n const packagesToRemove = PACKAGES_TO_REMOVE.filter((pkg) => pkg in dependencies || pkg in devDependencies);\n\n if (packagesToRemove.length > 0) {\n runCommand(`pnpm remove ${packagesToRemove.join(\" \")}`);\n } else {\n console.log(`โน๏ธ No unnecessary packages found in package.json to remove.`);\n }\n}\n","import { execSync } from \"node:child_process\";\n\n/**\n * Checks the current environment to ensure PNPM is installed.\n * If PNPM is not detected, logs an error message and terminates the process.\n *\n * @returns void\n */\nexport function checkEnvironment(): void {\n try {\n execSync(\"pnpm --version\", { stdio: \"ignore\" });\n } catch {\n console.error(`โ PNPM chฦฐa ฤฦฐแปฃc cร i ฤแบทt. Vui lรฒng cร i ฤแบทt PNPM trฦฐแปc.`);\n process.exit(1);\n }\n}\n","import { runCommand } from \"@/commands/create-project/utils\";\n\n/**\n * Creates a new Next.js project with predefined configuration flags.\n *\n * @param projectName - The name of the project to be created.\n * @returns void\n */\nexport function createNextProject(projectName: string): void {\n console.log(`๐ฆ Creating Next.js project...`);\n const flags = [\n \"--ts\",\n \"--tailwind\",\n \"--eslint\",\n \"--app\",\n \"--turbo\",\n \"--use-pnpm\",\n \"--src-dir\",\n \"--turbopack\",\n '--import-alias \"@/*\"',\n ].join(\" \");\n\n runCommand(`npx create-next-app@latest ${projectName} ${flags}`);\n}\n","import type { Command } from \"commander\";\n\nimport { checkExistingProject } from \"@/commands/create-project/check-existing-project\";\nimport {\n createConfigFiles,\n updateLayoutFile,\n updateNextConfig,\n updatePackageJson,\n updatePostcssConfig,\n} from \"@/commands/create-project/config-files\";\nimport { cleanupPackages, installDependencies } from \"@/commands/create-project/dependencies\";\nimport { checkEnvironment } from \"@/commands/create-project/environment\";\nimport { createNextProject } from \"@/commands/create-project/next-project\";\nimport { rl, runCommand } from \"@/commands/create-project/utils\";\n\n/**\n * Sets up the \"create-project\" command in the provided CLI program. This command allows users\n * to create a new Next.js project with a recommended configuration.\n *\n * The \"create-project\" command includes features such as scaffolding a Next.js project, applying\n * TypeScript, TailwindCSS, ESLint, Prettier, Git hooks, and other tools, ensuring a streamlined\n * development experience.\n *\n * @param program - The CLI program instance in which the command will be registered.\n */\nexport function createProjectCommand(program: Command): void {\n program\n .command(\"create-project [name]\")\n .description(\"Create a new Next.js project with recommended setup\")\n .action(async (projectNameArg) => {\n try {\n // Check environment (PNPM, write permissions)\n checkEnvironment();\n\n // Check if package.json exists and get the project name\n const { projectName, packageJsonExists } = await checkExistingProject(projectNameArg);\n\n if (!packageJsonExists) {\n console.log(`\\n๐ Starting project creation for ${projectName}...\\n`);\n createNextProject(projectName);\n process.chdir(projectName);\n console.log(`๐ Moved to ${projectName}`);\n }\n\n // Update layout.tsx to use fontVariables\n updateLayoutFile(process.cwd());\n\n // Edit the postcss.config.mjs file\n updatePostcssConfig(process.cwd());\n\n // Install dependencies\n installDependencies();\n\n // Remove unwanted packages\n cleanupPackages();\n\n // Create configuration files\n createConfigFiles(process.cwd());\n\n // Update next.config.ts with experimental configuration\n updateNextConfig(process.cwd());\n\n // Update package.json\n updatePackageJson(process.cwd());\n\n // Enable git hooks\n console.log(`\\n๐ Activating git hooks...`);\n runCommand(\"pnpm simple-git-hooks\");\n\n // Run Prettier to format the file\n console.log(`\\n๐ Formatting files with Prettier...`);\n runCommand(\"pnpm format\");\n\n // Completion notice\n console.log(`\\nโ
Project ${packageJsonExists ? \"configured\" : \"created\"} successfully!`);\n console.log(`- Project: ${projectName}`);\n console.log(\"- Next.js with TypeScript\");\n console.log(\"- TailwindCSS and @codefast/ui\");\n console.log(\"- ESLint, Prettier, Commitlint, and Git Hooks\");\n console.log(\"- Lint-staged for pre-commit checks\");\n console.log(`\\n๐ Project directory: ${process.cwd()}`);\n console.log(`\\n๐ To start development:`);\n console.log(`cd ${projectName} && pnpm dev`);\n } catch (error: unknown) {\n const errorMessage = error instanceof Error ? error.message : \"Unknown error occurred\";\n\n console.error(`\\nโ An error occurred: ${errorMessage}`);\n process.exit(1);\n } finally {\n // Close readline interface\n rl.close();\n }\n });\n}\n","import type { SourceFile } from \"ts-morph\";\n\nimport { Project } from \"ts-morph\";\n\nimport type { AnalysisResult, ImportPath, PackageConfig } from \"@/commands/update-exports/types\";\n\n/**\n * Creates a regex to remove specified prefixes from paths\n * @param prefixes - Array of prefixes to remove\n * @returns RegExp matching any prefix\n */\nfunction makeRegexPrefixesToRemove(prefixes: string[]): RegExp {\n // Matches: ^\\.?\\/?(prefix1|prefix2)\\/(.*)\n // - ^\\.?\\/? : Optional ./ or /\n // - (prefix1|prefix2): Any prefix from the list\n // - \\/(.*) : Remaining path after prefix\n const prefixPattern = prefixes.join(\"|\");\n\n return new RegExp(`^.?\\\\/?(?:${prefixPattern})\\\\/(.*)$`);\n}\n\n/**\n * Processes an export path by removing specified prefixes\n * @param modulePath - Path to process\n * @param regexPattern - Regex for prefix removal\n * @returns Processed path starting with ./\n */\nfunction processExportPath(modulePath: string, regexPattern: RegExp): string {\n let processedPath = modulePath;\n const match = processedPath.match(regexPattern);\n\n if (match) {\n const remainingPath = match[1];\n\n processedPath = remainingPath.startsWith(\"./\") ? remainingPath : `./${remainingPath}`;\n }\n\n return processedPath;\n}\n\n/**\n * Analyzes imports from an index.ts file\n * @param indexFilePath - Path to index.ts\n * @param packageConfig - Package configuration\n * @returns AnalysisResult containing import paths\n */\nexport function analyzeImports(indexFilePath: string, packageConfig: PackageConfig): AnalysisResult {\n const project = new Project();\n let sourceFile: SourceFile;\n\n try {\n sourceFile = project.addSourceFileAtPath(indexFilePath);\n } catch (error) {\n console.error(`Error loading source file at ${indexFilePath}:`, error);\n\n return { imports: [] };\n }\n\n const imports: ImportPath[] = [];\n const prefixesToRemove = packageConfig.exportPathPrefixesToRemove ?? [];\n const regexPattern = makeRegexPrefixesToRemove(prefixesToRemove);\n\n for (const exportDecl of sourceFile.getExportDeclarations()) {\n let moduleSpecifier = exportDecl.getModuleSpecifierValue();\n\n if (!moduleSpecifier) {\n continue;\n }\n\n // Normalize @/ to ./\n if (moduleSpecifier.startsWith(\"@/\")) {\n moduleSpecifier = `./${moduleSpecifier.slice(2)}`;\n }\n\n const isExternal = !moduleSpecifier.startsWith(\".\");\n\n if (isExternal) {\n continue;\n }\n\n const parts = moduleSpecifier.split(\"/\").filter(Boolean);\n\n if (parts.length < 2) {\n continue;\n }\n\n let directory;\n\n if (parts.length <= 1) {\n directory = \".\";\n } else {\n directory = parts.slice(0, -1).join(\"/\");\n\n if (directory.startsWith(\"./\")) {\n directory = directory.slice(2);\n }\n }\n\n const name = parts.at(-1) ?? \"\";\n\n const importPath: ImportPath = {\n originalPath: moduleSpecifier,\n directory,\n name,\n exportPath: processExportPath(moduleSpecifier, regexPattern),\n };\n\n imports.push(importPath);\n }\n\n return { imports };\n}\n","import { z } from \"zod\";\n\n/**\n * Represents the schema for package configuration.\n *\n * @param cjsOutputPattern - A string specifying the output pattern for the CommonJS format.\n * @param esmOutputPattern - A string specifying the output pattern for the ESM format.\n * @param packageJsonPath - A string representing the path to the package.json file.\n * @param srcIndexPath - A string specifying the path to the source index file.\n * @param typesOutputCjsPattern - A string defining the output pattern for type declarations in the CommonJS format.\n * @param typesOutputPattern - A string defining the output pattern for type declarations in general.\n * @param exportPathPrefixesToRemove - An optional array of strings specifying prefixes to remove from export paths.\n */\nexport const PackageConfigSchema = z.interface({\n cjsOutputPattern: z.string(),\n esmOutputPattern: z.string(),\n packageJsonPath: z.string(),\n srcIndexPath: z.string(),\n typesOutputCjsPattern: z.string(),\n typesOutputPattern: z.string(),\n \"exportPathPrefixesToRemove?\": z.array(z.string()),\n});\n\n/**\n * Represents the schema structure for the script configuration.\n *\n * This schema outlines the required and optional fields necessary for defining\n * configurations for custom packages, default package settings, and the pattern\n * used for finding package files.\n *\n * @param customPackageConfigs - A record where keys are strings and values are partials of PackageConfigSchema giving\n * the configurations for custom packages. This allows defining overrides or additional\n * configuration for specific packages.\n * @param defaultPackageConfig - The default package configuration, uniformly applied unless overridden by customPackageConfigs.\n * @param packagesGlob - A string indicating the glob pattern used to identify package files.\n */\nexport const ScriptConfigSchema = z.interface({\n customPackageConfigs: z.record(z.string(), PackageConfigSchema.partial()),\n defaultPackageConfig: PackageConfigSchema,\n packagesGlob: z.string(),\n});\n\n/**\n * Represents the configuration settings for a package.\n *\n * This type is derived from the `PackageConfigSchema` using the `zod` library.\n *\n * @typeParam T - The inferred type of the package configuration schema.\n *\n * @returns The inferred type from `PackageConfigSchema` representing the package configuration.\n */\nexport type PackageConfig = z.infer<typeof PackageConfigSchema>;\n/**\n * Represents the configuration for a script based on the `ScriptConfigSchema`.\n * This type infers its structure using `z.infer`.\n *\n * @typeParam T - The type inferred from the schema definition.\n *\n * @returns The inferred type that matches the schema.\n */\nexport type ScriptConfig = z.infer<typeof ScriptConfigSchema>;\n\n/**\n * Represents an import path for a module or file, including its directory, export path, name, and original path.\n *\n * @param directory - The directory containing the import.\n * @param exportPath - The resolved path of the export from the directory.\n * @param name - The name of the import.\n * @param originalPath - The original unresolved path of the import as provided in the source.\n */\nexport interface ImportPath {\n directory: string;\n exportPath: string;\n name: string;\n originalPath: string;\n}\n\n/**\n * Represents the result of an analysis process, including the identified import paths.\n *\n * @typeParam ImportPath - The type representing an individual import path.\n */\nexport interface AnalysisResult {\n imports: ImportPath[];\n}\n\n/**\n * Represents the configuration settings for exporting modules in different formats.\n *\n * This interface defines the required structure for specifying export configurations\n * in terms of import and require formats, including default exports and type exports.\n */\nexport interface ExportConfig {\n import: {\n default: string;\n types: string;\n };\n require: {\n default: string;\n types: string;\n };\n}\n\n/**\n * Represents a target for export, which can either be an `ExportConfig` object\n * or a string defining the target.\n *\n * @typeParam ExportConfig - Defines the configuration type for export when not using a string as a target.\n */\nexport type ExportTarget = ExportConfig | string;\n/**\n * Represents the structure of package exports, mapping export paths to their targets.\n *\n * This type is primarily used to define a dictionary where the keys are export paths\n * (strings) and the values are the targets to which these paths resolve.\n *\n * @typeParam ExportTarget - The type representing the value of each export target.\n * @returns A record that maps export path strings to their corresponding export targets.\n */\nexport type PackageExports = Record<string, ExportTarget>;\n\n/**\n * Represents the structure of a `package.json` file in a Node.js project.\n *\n * This interface defines the essential fields for describing a package, such as its name, version,\n * and an optional `exports` field used for specifying module exports.\n *\n * @typeParam T - An optional type parameter for customizing the `exports` field (if applicable).\n * @returns An object adhering to the `PackageJson` structure.\n */\nexport interface PackageJson {\n name: string;\n version: string;\n exports?: PackageExports;\n}\n\n/**\n * Represents the configuration options for a process.\n *\n * The `ProcessOptions` interface allows the customization of process behavior\n * through various optional parameters.\n *\n * @param dryRun - Indicates if the process should run in a simulation mode without making changes.\n * @param configPath - Specifies the file path to a configuration file, if provided.\n * @param packageFilter - Filters packages that should be processed, if specified.\n */\nexport interface ProcessOptions {\n dryRun: boolean;\n configPath?: string;\n packageFilter?: string;\n}\n","import { merge } from \"lodash-es\";\nimport fs from \"node:fs\";\nimport path from \"node:path\";\n\nimport type { PackageConfig, ScriptConfig } from \"@/commands/update-exports/types\";\n\nimport { ScriptConfigSchema } from \"@/commands/update-exports/types\";\n\n// Cache for storing configuration to avoid repeated file reads\nlet cachedConfig: null | ScriptConfig = null;\n\n/**\n * Loads and validates configuration from a file\n * @param configPath - Optional path to the config file\n * @returns Partial ScriptConfig or empty object if not found/invalid\n */\nfunction loadConfigFile(configPath?: string): Partial<ScriptConfig> {\n if (!configPath) {\n return {};\n }\n\n try {\n const fullPath = path.resolve(configPath);\n\n if (!fs.existsSync(fullPath)) {\n console.warn(`Configuration file not found at ${fullPath}`);\n\n return {};\n }\n\n const configContent = fs.readFileSync(fullPath, \"utf8\");\n const config = JSON.parse(configContent);\n\n // Validate against schema\n return ScriptConfigSchema.parse(config);\n } catch (error) {\n console.error(\"Error reading configuration file:\", error);\n\n return {};\n }\n}\n\n/**\n * Retrieves merged configuration, using cache if no path is provided\n * @param configPath - Optional path to override default config\n * @returns Merged ScriptConfig\n */\nexport function getConfig(configPath?: string): ScriptConfig {\n if (cachedConfig && !configPath) {\n return cachedConfig;\n }\n\n const userConfig = loadConfigFile(configPath);\n const config = merge({}, defaultConfig, userConfig) as ScriptConfig;\n\n // Cache config if no path is provided\n if (!configPath) {\n cachedConfig = config;\n }\n\n return config;\n}\n\n/**\n * Retrieves configuration for a specific package\n * @param packageName - Name of the package\n * @param config - Optional ScriptConfig to use\n * @returns PackageConfig combining defaults and custom settings\n */\nexport function getPackageConfig(packageName: string, config?: ScriptConfig): PackageConfig {\n const configObj = config ?? getConfig();\n const customConfig = configObj.customPackageConfigs[packageName] ?? {};\n\n return {\n ...configObj.defaultPackageConfig,\n ...customConfig,\n };\n}\n\n// Default configuration for the script\nexport const defaultConfig: ScriptConfig = {\n packagesGlob: \"./packages/**/package.json\",\n defaultPackageConfig: {\n cjsOutputPattern: \"./dist/cjs/{dir}/{name}.cjs\",\n esmOutputPattern: \"./dist/esm/{dir}/{name}.js\",\n packageJsonPath: \"package.json\",\n srcIndexPath: \"src/index.ts\",\n typesOutputCjsPattern: \"./dist/types/{dir}/{name}.d.ts\",\n typesOutputPattern: \"./dist/types/{dir}/{name}.d.ts\",\n },\n customPackageConfigs: {\n \"@codefast/ui\": {\n exportPathPrefixesToRemove: [\"components\"],\n },\n \"@codefast/style-guide\": {\n exportPathPrefixesToRemove: [\"configs\"],\n },\n },\n};\n","import fs from \"node:fs\";\nimport path from \"node:path\";\n\nimport type { AnalysisResult, PackageExports, PackageJson } from \"@/commands/update-exports/types\";\n\n// Constants for file operations\nconst EXPORTS_ANALYSIS_DIR = \".exports-analysis\";\nconst EXPORTS_PREVIEW_FILE = \"exports-preview.json\";\nconst EXPORTS_ANALYSIS_FILE = \"exports-analysis.json\";\nconst ENCODING = \"utf8\";\nconst JSON_INDENT = 2;\n/**\n * Utility functions for file and directory operations\n */\nconst FileUtils = {\n /**\n * Checks if a file exists\n * @param filePath - Path to check\n * @returns True if a file exists\n */\n exists(filePath: string): boolean {\n return fs.existsSync(filePath);\n },\n\n /**\n * Creates a directory if it doesn't exist\n * @param dirPath - Directory path\n */\n ensureDirectoryExists(dirPath: string): void {\n if (!fs.existsSync(dirPath)) {\n fs.mkdirSync(dirPath, { recursive: true });\n }\n },\n\n /**\n * Reads and parses a JSON file\n * @param filePath - Path to JSON file\n * @returns Parsed content or null if error\n */\n readJsonFile<T>(filePath: string): null | T {\n try {\n const content = fs.readFileSync(filePath, ENCODING);\n\n return JSON.parse(content) as T;\n } catch (error) {\n console.error(`Error reading JSON file at ${filePath}:`, error);\n\n return null;\n }\n },\n\n /**\n * Writes content to a JSON file\n * @param filePath - Path to write\n * @param content - Content to write\n * @returns True if successful\n */\n writeJsonFile<T>(filePath: string, content: T): boolean {\n try {\n fs.writeFileSync(filePath, `${JSON.stringify(content, null, JSON_INDENT)}\\n`, ENCODING);\n\n return true;\n } catch (error) {\n console.error(`Error writing JSON file at ${filePath}:`, error);\n\n return false;\n }\n },\n\n /**\n * Gets the exports analysis directory path\n * @param packageDir - Package directory\n * @returns Analysis directory path\n */\n getAnalysisDir(packageDir: string): string {\n const outputDir = path.join(packageDir, EXPORTS_ANALYSIS_DIR);\n\n this.ensureDirectoryExists(outputDir);\n\n return outputDir;\n },\n\n /**\n * Creates a timestamped backup filename\n * @param baseFilename - Original filename\n * @returns Backup filename with timestamp\n */\n createBackupFilename(baseFilename: string): string {\n const timestamp = new Date().toISOString().replaceAll(/[:.]/g, \"-\");\n\n return `${baseFilename}.backup.${timestamp}`;\n },\n};\n\n/**\n * Checks if a file exists\n * @param filePath - Path to check\n * @returns True if a file exists\n */\nexport function fileExists(filePath: string): boolean {\n return FileUtils.exists(filePath);\n}\n\n/**\n * Reads and parses package.json content\n * @param filePath - Path to package.json\n * @returns Parsed PackageJson or null if error\n */\nexport function readPackageJson(filePath: string): null | PackageJson {\n return FileUtils.readJsonFile<PackageJson>(filePath);\n}\n\n/**\n * Creates a backup of package.json\n * @param filePath - Path to package.json\n * @returns True if backup was successful\n */\nexport function backupPackageJson(filePath: string): boolean {\n try {\n const content = fs.readFileSync(filePath, ENCODING);\n const dir = path.dirname(filePath);\n const backupDir = path.join(dir, EXPORTS_ANALYSIS_DIR);\n\n FileUtils.ensureDirectoryExists(backupDir);\n\n const baseName = path.basename(filePath);\n const backupPath = path.join(backupDir, FileUtils.createBackupFilename(baseName));\n\n fs.writeFileSync(backupPath, content, ENCODING);\n\n return true;\n } catch (error) {\n console.error(`Error backing up package.json at ${filePath}:`, error);\n\n return false;\n }\n}\n\n/**\n * Saves updated package.json content\n * @param filePath - Path to package.json\n * @param content - Updated content\n * @returns True if save was successful\n */\nexport function savePackageJson(filePath: string, content: PackageJson): boolean {\n return FileUtils.writeJsonFile(filePath, content);\n}\n\n/**\n * Saves the given JSON content to a specified file within the analysis directory.\n *\n * @param packageDir - The root directory where the analysis directory resides.\n * @param fileName - The name of the file to which the JSON content will be written.\n * @param content - The JSON content to save to the file.\n */\nexport function saveJsonToFile<T>(packageDir: string, fileName: string, content: T): void {\n const outputDir = FileUtils.getAnalysisDir(packageDir);\n\n FileUtils.writeJsonFile(path.join(outputDir, fileName), content);\n}\n\n/**\n * Saves exports analysis results\n * @param packageDir - Package directory\n * @param analysis - Analysis results\n */\nexport function saveExportsAnalysis(packageDir: string, analysis: AnalysisResult): void {\n saveJsonToFile(packageDir, EXPORTS_ANALYSIS_FILE, analysis);\n}\n\n/**\n * Saves preview of generated exports\n * @param packageDir - Package directory\n * @param exports - Generated exports\n */\nexport function saveExportsPreview(packageDir: string, exports: PackageExports): void {\n saveJsonToFile(packageDir, EXPORTS_PREVIEW_FILE, exports);\n}\n","import type { ImportPath, PackageExports, ScriptConfig } from \"@/commands/update-exports/types\";\n\nimport { getPackageConfig } from \"@/commands/update-exports/config\";\n\n/**\n * Formats an output path based on a pattern, directory, and name\n * @param pattern - Output pattern\n * @param directory - Directory path\n * @param name - Module name\n * @returns Formatted output path\n */\nfunction formatOutputPath(pattern: string, directory: string, name: string): string {\n const dirPart = directory === \".\" ? \"\" : `${directory}/`;\n\n return pattern.replace(\"{dir}/\", dirPart).replace(\"{dir}\", directory).replace(\"{name}\", name);\n}\n\n/**\n * Generates export structure for package.json\n * @param packageName - Name of the package\n * @param imports - Analyzed import paths\n * @param existingExports - Current exports to preserve\n * @param config - Optional ScriptConfig\n * @returns Updated PackageExports\n */\nexport function generateExports(\n packageName: string,\n imports: ImportPath[],\n existingExports: PackageExports = {},\n config?: ScriptConfig,\n): PackageExports {\n const packageConfig = getPackageConfig(packageName, config);\n\n const exports: PackageExports = {\n \".\": existingExports[\".\"] ?? {\n import: {\n types: \"./dist/types/index.d.ts\",\n default: \"./dist/esm/index.js\",\n },\n require: {\n types: \"./dist/types/index.d.cts\",\n default: \"./dist/cjs/index.cjs\",\n },\n },\n };\n\n // Preserve existing CSS exports\n if (existingExports[\"./styles.css\"]) {\n exports[\"./styles.css\"] = existingExports[\"./styles.css\"];\n }\n\n // Generate exports for each import path\n for (const importPath of imports) {\n const { directory, name, exportPath } = importPath;\n\n const esmOutput = formatOutputPath(packageConfig.esmOutputPattern, directory, name);\n const cjsOutput = formatOutputPath(packageConfig.cjsOutputPattern, directory, name);\n const typesOutput = formatOutputPath(packageConfig.typesOutputPattern, directory, name);\n const typesCjsOutput = formatOutputPath(packageConfig.typesOutputCjsPattern, directory, name);\n\n exports[exportPath] = {\n import: {\n types: typesOutput,\n default: esmOutput,\n },\n require: {\n types: typesCjsOutput,\n default: cjsOutput,\n },\n };\n }\n\n return exports;\n}\n","import { glob } from \"glob\";\nimport path from \"node:path\";\n\nimport type { ProcessOptions, ScriptConfig } from \"@/commands/update-exports/types\";\n\nimport { analyzeImports } from \"@/commands/update-exports/analyze-imports\";\nimport { getConfig, getPackageConfig } from \"@/commands/update-exports/config\";\nimport {\n backupPackageJson,\n fileExists,\n readPackageJson,\n saveExportsAnalysis,\n saveExportsPreview,\n savePackageJson,\n} from \"@/commands/update-exports/file-utils\";\nimport { generateExports } from \"@/commands/update-exports/generate-exports\";\n\nconst DEFAULT_IGNORE_PATTERN = [\"**/node_modules/**\"];\n\n/**\n * Finds all package.json files in the workspace\n * @param config - Optional ScriptConfig\n * @returns Array of package.json paths\n */\nexport async function findAllPackages(config?: ScriptConfig): Promise<string[]> {\n const configObj = config ?? getConfig();\n\n return await glob(configObj.packagesGlob, {\n ignore: DEFAULT_IGNORE_PATTERN,\n });\n}\n\n/**\n * Processes a single package\n * @param packageJsonPath - Path to package.json\n * @param options - Processing options\n * @returns True if processing was successful\n */\nexport function processPackage(packageJsonPath: string, options: ProcessOptions): boolean {\n const packageDir = path.dirname(packageJsonPath);\n const packageJson = readPackageJson(packageJsonPath);\n\n if (!packageJson) {\n console.error(`Failed to read ${packageJsonPath}`);\n\n return false;\n }\n\n const packageName = packageJson.name;\n\n // Skip if package doesn't match filter\n if (options.packageFilter && packageName !== options.packageFilter) {\n console.debug(`Skipping ${packageName} (does not match filter)`);\n\n return false;\n }\n\n console.info(`Processing package: ${packageName}`);\n\n const config = getConfig(options.configPath);\n const packageConfig = getPackageConfig(packageName, config);\n const srcIndexPath = path.join(packageDir, packageConfig.srcIndexPath);\n\n if (!fileExists(srcIndexPath)) {\n console.error(`Source file not found at ${srcIndexPath}`);\n\n return false;\n }\n\n // Analyze imports\n console.info(`Analyzing imports from ${srcIndexPath}...`);\n const { imports } = analyzeImports(srcIndexPath, packageConfig);\n\n if (imports.length === 0) {\n console.warn(`No imports found to analyze in ${packageName}`);\n\n return false;\n }\n\n console.log(`Analysis complete. Found ${imports.length} subpath exports.`);\n\n // Save analysis results\n saveExportsAnalysis(packageDir, { imports });\n\n // Generate new exports\n const newExports = generateExports(packageName, imports, packageJson.exports, config);\n\n // Compare export counts\n const currentExportsCount = packageJson.exports ? Object.keys(packageJson.exports).length : 0;\n const newExportsCount = Object.keys(newExports).length;\n\n console.info(`Exports: ${currentExportsCount} -> ${newExportsCount}`);\n\n if (options.dryRun) {\n saveExportsPreview(packageDir, newExports);\n console.warn(`Saved exports preview to .exports-analysis`);\n console.warn(`Dry run: no changes saved for ${packageName}`);\n\n return true;\n }\n\n // Backup package.json\n if (backupPackageJson(packageJsonPath)) {\n console.log(`Backed up ${packageJsonPath}`);\n }\n\n // Update package.json\n const updatedPackageJson = { ...packageJson, exports: newExports };\n\n if (savePackageJson(packageJsonPath, updatedPackageJson)) {\n console.log(`Updated exports for ${packageName}`);\n\n return true;\n }\n\n console.error(`Failed to update ${packageJsonPath}`);\n\n return false;\n}\n\n/**\n * Processes all packages in the workspace\n * @param options - Processing options\n */\nexport async function processAllPackages(options: ProcessOptions): Promise<void> {\n try {\n console.info(\"Searching for packages...\");\n const config = getConfig(options.configPath);\n const packageJsonPaths = await findAllPackages(config);\n\n if (packageJsonPaths.length === 0) {\n console.warn(\"No packages found.\");\n\n return;\n }\n\n console.log(`Found ${packageJsonPaths.length} packages.`);\n\n let successCount = 0;\n let skipCount = 0;\n let errorCount = 0;\n\n for (const packageJsonPath of packageJsonPaths) {\n const result = processPackage(packageJsonPath, options);\n\n if (result) {\n successCount++;\n } else if (options.packageFilter) {\n skipCount++;\n } else {\n errorCount++;\n }\n }\n\n console.log(\"Completed exports update.\");\n console.info(`Stats: ${successCount} succeeded, ${skipCount} skipped, ${errorCount} failed`);\n } catch (error) {\n console.error(\"Error processing packages:\", error);\n throw error;\n }\n}\n","import type { Command } from \"commander\";\n\nimport type { ProcessOptions } from \"@/commands/update-exports/types\";\n\nimport { processAllPackages } from \"@/commands/update-exports/process-package\";\n\n/**\n * Creates a commander command for updating exports\n * @param program - Commander program instance\n */\nexport function createUpdateExportsCommand(program: Command): void {\n // noinspection RequiredAttributes\n program\n .command(\"update-exports\")\n .description(\"Updates exports for all packages\")\n .option(\"-p, --package <package>\", \"Filter by package name\")\n .option(\"-d, --dry-run\", \"Run without making changes\")\n .option(\"-c, --config <path>\", \"Path to configuration file\")\n .action(async (options) => {\n const processorOptions: ProcessOptions = {\n packageFilter: options.package,\n dryRun: Boolean(options.dryRun),\n configPath: options.config,\n };\n\n try {\n await processAllPackages(processorOptions);\n } catch (error) {\n console.error(\"Error processing packages:\", error);\n process.exit(1);\n }\n });\n}\n","import { readFileSync } from \"node:fs\";\nimport { dirname, resolve } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\nexport interface PackageInfo {\n name: string;\n version: string;\n}\n\nexport function getPackageInfo(): PackageInfo {\n const __filename = fileURLToPath(import.meta.url);\n const __dirname = dirname(__filename);\n const packageJsonPath = resolve(__dirname, \"../package.json\");\n\n return JSON.parse(readFileSync(packageJsonPath, \"utf8\")) as PackageInfo;\n}\n\nexport function getPackageVersion(): string {\n return getPackageInfo().version;\n}\n","\n\nimport { Command } from \"commander\";\n\nimport { createProjectCommand } from \"@/commands/create-project/command\";\nimport { createUpdateExportsCommand } from \"@/commands/update-exports\";\nimport { getPackageVersion } from \"@/lib/package-info\";\n\nfunction main(): void {\n const program = new Command();\n\n program\n .name(\"codefast\")\n .description(\"CodeFast CLI - A development toolkit for CodeFast.\")\n .version(getPackageVersion(), \"-v, --version\", \"display CLI version\");\n\n createUpdateExportsCommand(program);\n createProjectCommand(program);\n\n program.action(() => {\n console.log('Use \"codefast create-project\" to create a new Next.js project.');\n console.log('Use \"codefast update-exports\" to update exports.');\n console.log('Run \"codefast --help\" to see all available commands.');\n program.help();\n });\n\n program.parse(process.argv);\n}\n\nmain();\n"],"names":["rl","readline","process","prompt","question","Promise","resolve","answer","runCommand","command","execSync","writeConfigFile","filePath","content","fs","console","validateProjectName","name","npmNameRegex","reservedNames","fullPath","path","getValidProjectName","initialName","attempts","maxAttempts","projectName","validation","Error","undefined","checkExistingProject","projectNameArg","packageJsonPath","packageJsonExists","confirm","packageJson","JSON","MAIN_DEPENDENCIES","DEV_DEPENDENCIES","PACKAGES_TO_REMOVE","configGroups","updatePostcssConfig","projectDir","postcssConfigPath","typeComment","updateLayoutFile","layoutPath","newImports","htmlRegex","newHtml","bodyRegex","newBody","error","errorMessage","updatePackageJson","updateNextConfig","nextConfigPath","configPattern","experimentalConfig","createConfigFiles","category","configs","Object","description","dir","installDependencies","allDevDependencies","cleanupPackages","dependencies","devDependencies","packagesToRemove","pkg","checkEnvironment","createNextProject","flags","createProjectCommand","program","makeRegexPrefixesToRemove","prefixes","prefixPattern","RegExp","processExportPath","modulePath","regexPattern","processedPath","match","remainingPath","analyzeImports","indexFilePath","packageConfig","project","Project","sourceFile","imports","prefixesToRemove","exportDecl","moduleSpecifier","isExternal","parts","Boolean","directory","importPath","PackageConfigSchema","z","ScriptConfigSchema","cachedConfig","loadConfigFile","configPath","configContent","config","getConfig","userConfig","merge","defaultConfig","getPackageConfig","packageName","configObj","customConfig","EXPORTS_ANALYSIS_DIR","EXPORTS_PREVIEW_FILE","EXPORTS_ANALYSIS_FILE","ENCODING","JSON_INDENT","FileUtils","dirPath","packageDir","outputDir","baseFilename","timestamp","Date","fileExists","readPackageJson","backupPackageJson","backupDir","baseName","backupPath","savePackageJson","saveJsonToFile","fileName","saveExportsAnalysis","analysis","saveExportsPreview","exports","formatOutputPath","pattern","dirPart","generateExports","existingExports","exportPath","esmOutput","cjsOutput","typesOutput","typesCjsOutput","DEFAULT_IGNORE_PATTERN","findAllPackages","glob","processPackage","options","srcIndexPath","newExports","currentExportsCount","newExportsCount","updatedPackageJson","processAllPackages","packageJsonPaths","successCount","skipCount","errorCount","result","createUpdateExportsCommand","processorOptions","getPackageInfo","__filename","fileURLToPath","__dirname","dirname","readFileSync","getPackageVersion","main","Command"],"mappings":";;;;;;;;;;;AAUO,MAAMA,KAAKC,kDAAAA,CAAAA,UAAAA,CAAAA,eAAwB,CAAC;IACzC,OAAOC,QAAQ,KAAK;IACpB,QAAQA,QAAQ,MAAM;AACxB;AAQO,SAASC,aAAOC,QAAgB;IACrC,OAAO,IAAIC,QAAQ,CAACC;QAClBN,GAAG,QAAQ,CAACI,UAAU,CAACG;YACrBD,QAAQC,OAAO,IAAI;QACrB;IACF;AACF;AAQO,SAASC,WAAWC,OAAe;IACxCC,IAAAA,wDAAAA,QAAAA,EAASD,SAAS;QAAE,OAAO;IAAU;AACvC;AASO,SAASE,gBAAgBC,QAAgB,EAAEC,OAAe;IAC/DC,4CAAAA,CAAAA,UAAAA,CAAAA,aAAgB,CAACF,UAAUC;IAC3BE,QAAQ,GAAG,CAAC,CAAC,WAAW,EAAEH,UAAU;AACtC;AC3BA,SAASI,oBAAoBC,IAAY;IAEvC,IAAI,CAACA,QAAQ,QAAQ,IA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,kBACR,WAAW,CAAC,oCACZ,MAAM,CAAC,2BAA2B,0BAClC,MAAM,CAAC,iBAAiB,8BACxB,MAAM,CAAC,uBAAuB,8BAC9B,MAAM,CAAC,OAAOiF;QACb,MAAMa,mBAAmC;YACvC,eAAeb,QAAQ,OAAO;YAC9B,QAAQ1D,QAAQ0D,QAAQ,MAAM;YAC9B,YAAYA,QAAQ,MAAM;QAC5B;QAEA,IAAI;YACF,MAAMM,mBAAmBO;QAC3B,EAAE,OAAOtH,OAAO;YACdrC,QAAQ,KAAK,CAAC,8BAA8BqC;YAC5ClD,QAAQ,IAAI,CAAC;QACf;IACF;AACJ;ACvBO,SAASyK;IACd,MAAMC,aAAaC,IAAAA,8CAAAA,aAAAA,EAAc,YAAY,GAAG;IAChD,MAAMC,YAAYC,IAAAA,+CAAAA,OAAAA,EAAQH;IAC1B,MAAM5I,kBAAkB1B,IAAAA,+CAAAA,OAAAA,EAAQwK,WAAW;IAE3C,OAAO1I,KAAK,KAAK,CAAC4I,IAAAA,6CAAAA,YAAAA,EAAahJ,iBAAiB;AAClD;AAEO,SAASiJ;IACd,OAAON,iBAAiB,OAAO;AACjC;ACXA,SAASO;IACP,MAAMtG,UAAU,IAAIuG,sCAAAA,OAAOA;IAE3BvG,QACG,IAAI,CAAC,YACL,WAAW,CAAC,sDACZ,OAAO,CAACqG,qBAAqB,iBAAiB;IAEjDR,2BAA2B7F;IAC3BD,qBAAqBC;IAErBA,QAAQ,MAAM,CAAC;QACb7D,QAAQ,GAAG,CAAC;QACZA,QAAQ,GAAG,CAAC;QACZA,QAAQ,GAAG,CAAC;QACZ6D,QAAQ,IAAI;IACd;IAEAA,QAAQ,KAAK,CAAC1E,QAAQ,IAAI;AAC5B;AAEAgL"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["webpack://@codefast/cli/./src/commands/create-project/utils.ts","webpack://@codefast/cli/./src/commands/create-project/project-name.ts","webpack://@codefast/cli/./src/commands/create-project/check-existing-project.ts","webpack://@codefast/cli/./src/commands/create-project/constants.ts","webpack://@codefast/cli/./src/commands/create-project/config-files.ts","webpack://@codefast/cli/./src/commands/create-project/dependencies.ts","webpack://@codefast/cli/./src/commands/create-project/environment.ts","webpack://@codefast/cli/./src/commands/create-project/next-project.ts","webpack://@codefast/cli/./src/commands/create-project/command.ts","webpack://@codefast/cli/./src/commands/update-exports/analyze-imports.ts","webpack://@codefast/cli/./src/commands/update-exports/types.ts","webpack://@codefast/cli/./src/commands/update-exports/config.ts","webpack://@codefast/cli/./src/commands/update-exports/file-utils.ts","webpack://@codefast/cli/./src/commands/update-exports/generate-exports.ts","webpack://@codefast/cli/./src/commands/update-exports/process-package.ts","webpack://@codefast/cli/./src/commands/update-exports/command.ts","webpack://@codefast/cli/./src/lib/package-info.ts","webpack://@codefast/cli/./src/index.ts"],"sourcesContent":["import { execSync } from \"node:child_process\";\nimport fs from \"node:fs\";\nimport readline from \"node:readline\";\n\n/**\n * Represents an interface for reading and writing data to the console or other input/output streams.\n *\n * This interface allows interaction with standard input and output streams by reading input and writing output\n * in a controlled manner. It is commonly used for creating command-line interfaces or handling user input.\n */\nexport const rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout,\n});\n\n/**\n * Asks a user a question and returns their response as a trimmed string.\n *\n * @param question - The question to present to the user.\n * @returns A promise that resolves with the user's response as a trimmed string.\n */\nexport function prompt(question: string): Promise<string> {\n return new Promise((resolve) => {\n rl.question(question, (answer) => {\n resolve(answer.trim());\n });\n });\n}\n\n/**\n * Executes a shell command synchronously and inherits the output behavior of the current process.\n *\n * @param command - The shell command to be executed.\n * @returns void\n */\nexport function runCommand(command: string): void {\n execSync(command, { stdio: \"inherit\" });\n}\n\n/**\n * File operation and validation utilities for configuration management\n */\nexport const FileUtils = {\n /**\n * Checks if a file exists at the specified path\n */\n exists(filePath: string): boolean {\n return fs.existsSync(filePath);\n },\n\n /**\n * Reads a file's content with error handling\n */\n readFile(filePath: string): string {\n try {\n return fs.readFileSync(filePath, \"utf8\");\n } catch (error) {\n throw new Error(`Failed to read file ${filePath}: ${getErrorMessage(error)}`);\n }\n },\n\n /**\n * Writes content to a file with error handling\n */\n writeFile(filePath: string, content: string): void {\n try {\n fs.writeFileSync(filePath, content);\n } catch (error) {\n throw new Error(`Failed to write to file ${filePath}: ${getErrorMessage(error)}`);\n }\n },\n\n /**\n * Writes configuration content to a specified file.\n *\n * @param filePath - The path of the file where the configuration content should be written.\n * @param content - The configuration content to write into the file.\n * @returns void\n */\n writeConfigFile(filePath: string, content: string): void {\n fs.writeFileSync(filePath, content);\n console.log(`๐ Created ${filePath}`);\n },\n\n /**\n * Validates a file path and logs appropriate warning if not found\n * @returns true if a file exists, false otherwise\n */\n validatePath(filePath: string, filename: string): boolean {\n if (!this.exists(filePath)) {\n console.warn(`โ ๏ธ ${filename} not found, skipping update.`);\n\n return false;\n }\n\n return true;\n },\n};\n\n/**\n * Extracts an error message from any error type\n */\nexport function getErrorMessage(error: unknown): string {\n return error instanceof Error ? error.message : \"Unknown error occurred\";\n}\n","import fs from \"node:fs\";\nimport path from \"node:path\";\n\nimport { prompt } from \"@/commands/create-project/utils\";\n\n/**\n * Validates the given project name against various criteria to ensure it is suitable for use.\n *\n * The validation checks include:\n * - Ensuring the name is not empty or comprised only of whitespace.\n * - Restricting the maximum length of the name to 100 characters.\n * - Enforcing URL-friendly naming conventions, prohibiting special characters such as `@` or names resembling scoped\n * packages.\n * - Preventing the use of prohibited project names such as '.' or '..'.\n * - Restricting the use of reserved system names on Windows.\n * - Ensuring that the specified project name does not conflict with an existing directory in the current working\n * directory.\n * - Verifying that the current directory has write permissions for the creation of a new project.\n *\n * @param name - The proposed project name to be validated.\n * @returns An object indicating whether the project name is valid. If invalid, an error message is provided.\n */\nfunction validateProjectName(name: string): { valid: boolean; error?: string } {\n // Check if the name is empty or contains only spaces.\n if (!name || /^\\s*$/.test(name)) {\n return { valid: false, error: \"Project name cannot be empty or contain only whitespace.\" };\n }\n\n // Check the name length\n if (name.length > 100) {\n return { valid: false, error: \"Project name is too long (maximum 100 characters).\" };\n }\n\n // Check the package name format according to npm standard (scoped packages are not allowed).\n const npmNameRegex = /^[a-z0-9-~][a-z0-9-._~]*$/;\n\n if (!npmNameRegex.test(name)) {\n return {\n valid: false,\n error:\n \"Project name must be URL-friendly (letters, numbers, hyphens, underscores, dots; no @ or scoped packages).\",\n };\n }\n\n // Check if the name contains only dots.\n if (name === \".\" || name === \"..\") {\n return { valid: false, error: \"Project name cannot be '.' or '..'.\" };\n }\n\n // Checking system keywords on Windows\n const reservedNames = /^(?<reserved>CON|PRN|AUX|NUL|COM[1-9]|LPT[1-9])$/i;\n\n if (reservedNames.test(name)) {\n return { valid: false, error: `Project name \"${name}\" is a reserved system name.` };\n }\n\n // Check the existence of the directory\n const fullPath = path.resolve(process.cwd(), name);\n\n if (fs.existsSync(fullPath)) {\n return { valid: false, error: `A directory named \"${name}\" already exists.` };\n }\n\n // Check write permission\n try {\n fs.accessSync(process.cwd(), fs.constants.W_OK);\n } catch {\n return { valid: false, error: \"Cannot create project: No write permission in current directory.\" };\n }\n\n return { valid: true };\n}\n\n/**\n * Asynchronously prompts the user to enter a valid project name, validating the input and retrying up to a specified\n * number of attempts if necessary.\n *\n * @param initialName - An optional initial project name to validate; if not provided, the user will be prompted to\n * enter a name.\n * @param attempts - The current number of validation attempts made. Defaults to 0.\n * @param maxAttempts - The maximum number of validation attempts allowed. Defaults to 3.\n * @returns A promise that resolves to a valid project name as a string.\n * @throws An error if the maximum number of validation attempts is exceeded.\n */\nexport async function getValidProjectName(initialName?: string, attempts = 0, maxAttempts = 3): Promise<string> {\n const projectName = initialName ?? (await prompt(\"Enter project name: \"));\n\n const validation = validateProjectName(projectName);\n\n if (validation.valid) {\n return projectName;\n }\n\n if (attempts >= maxAttempts - 1) {\n throw new Error(`โ Exceeded maximum attempts to enter a valid project name.`);\n }\n\n console.error(`โ ${validation.error} (${maxAttempts - attempts - 1} attempts remaining)`);\n\n return getValidProjectName(undefined, attempts + 1, maxAttempts);\n}\n","import fs from \"node:fs\";\nimport path from \"node:path\";\n\nimport { getValidProjectName } from \"@/commands/create-project/project-name\";\nimport { prompt } from \"@/commands/create-project/utils\";\n\n/**\n * Checks if a package.json file exists in the current directory and determines the project name.\n * If package.json exists, it prompts the user to confirm continuing with the existing project\n * and retrieves the project name from package.json or the provided argument.\n * If package.json does not exist, it validates the provided project name or prompts for a new one.\n *\n * @param projectNameArg - Optional project name provided as an argument.\n * @returns A promise that resolves to an object containing the project name and a boolean indicating if package.json\n * exists.\n * @throws An error if the user aborts the operation or if the project name cannot be determined.\n */\nexport async function checkExistingProject(\n projectNameArg?: string,\n): Promise<{ packageJsonExists: boolean; projectName: string }> {\n const packageJsonPath = path.join(process.cwd(), \"package.json\");\n const packageJsonExists = fs.existsSync(packageJsonPath);\n\n if (packageJsonExists) {\n console.log(`โ ๏ธ A package.json file has been detected in the current directory.`);\n const confirm = await prompt(\"Do you want to continue configuring this existing project? [Y/n]: \");\n\n // Default to 'Y' if the input is empty; otherwise, check for 'y' or 'Y'\n if (confirm === \"\" || confirm.toLowerCase() === \"y\") {\n const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, \"utf8\"));\n const projectName = packageJson.name ?? (await getValidProjectName(projectNameArg));\n\n return { projectName, packageJsonExists };\n }\n\n console.log(\"Aborting...\");\n throw new Error(\"User aborted the operation.\");\n }\n\n const projectName = await getValidProjectName(projectNameArg);\n\n return { projectName, packageJsonExists };\n}\n","/**\n * Main dependencies need to be installed\n */\nexport const MAIN_DEPENDENCIES = [\n \"@codefast/ui\",\n \"@codefast/hooks\",\n \"recharts\",\n \"react-hook-form\",\n \"next-themes\",\n \"date-fns\",\n \"lucide-react\",\n];\n\n/**\n * Development dependencies are grouped by function.\n */\nexport const DEV_DEPENDENCIES = {\n commitLint: [\"@commitlint/cli\", \"@commitlint/config-conventional\", \"@commitlint/types\"],\n gitTools: [\"simple-git-hooks\"],\n formatting: [\"prettier\", \"prettier-plugin-packagejson\", \"prettier-plugin-tailwindcss\", \"lint-staged\"],\n linting: [\"@codefast/eslint-config\"],\n};\n\n/**\n * Packages that need to be removed from the project\n */\nexport const PACKAGES_TO_REMOVE = [\"@eslint/eslintrc\", \"eslint-config-next\"];\n\n/**\n * Define a schema for a configuration file\n */\nexport interface ConfigFile {\n /** Configuration file content */\n content: string;\n /** Path to the configuration file */\n path: string;\n /** Description of file purpose options */\n description?: string;\n}\n\n/**\n * Define configuration categories\n */\nexport type ConfigCategory = \"deployment\" | \"formatting\" | \"linting\" | \"styles\";\n\n/**\n * Type for the configuration groups\n */\nexport type ConfigGroups = Record<ConfigCategory, ConfigFile[]>;\n\n/**\n * Group configurations by tool type\n */\nexport const configGroups: ConfigGroups = {\n deployment: [\n {\n path: \".vercelignore\",\n content: `#-------------------------------------------------------------------------------\n# Dependencies and package managers\n#-------------------------------------------------------------------------------\n\n# Node dependencies\nnode_modules\n.pnpm-store\n.yarn\n\n#-------------------------------------------------------------------------------\n# Development and environment\n#-------------------------------------------------------------------------------\n\n# Environment variables (except examples)\n.env*\n!.env.example\n\n# Build artifacts\n.next\nbuild\ndist\n.git\n.github\n.turbo\n.changeset\n.eslintcache\n\n# Debug logs\nnpm-debug.log*\nyarn-debug.log*\n\n#-------------------------------------------------------------------------------\n# Testing\n#-------------------------------------------------------------------------------\n\n# Test coverage reports and config snapshots\ncoverage\n*.test.*\n*.e2e.*\n\n#-------------------------------------------------------------------------------\n# Editor and IDE configuration\n#-------------------------------------------------------------------------------\n\n# IDE project files\n.idea\n*.suo\n*.ntvs*\n*.njsproj\n*.sln\n\n#-------------------------------------------------------------------------------\n# Operating system files\n#-------------------------------------------------------------------------------\n\n# System metadata files\n.DS_Store\nThumbs.db\n\n#-------------------------------------------------------------------------------\n# Deployment\n#-------------------------------------------------------------------------------\n\n# Vercel deployment configuration\n.vercel\n`,\n description: \"Ignore files that should not be deployed to Vercel\",\n },\n ],\n formatting: [\n {\n path: \"prettier.config.mjs\",\n content: `/**\n * @see https://prettier.io/docs/en/configuration.html\n * @type {import('prettier').Config}\n */\nconst config = {\n plugins: [\"prettier-plugin-packagejson\", \"prettier-plugin-tailwindcss\"],\n printWidth: 100,\n tailwindAttributes: [\"classNames\"],\n tailwindFunctions: [\"tv\"],\n};\n\nexport default config;\n`,\n description: \"Prettier configuration for source code formatting\",\n },\n {\n path: \".editorconfig\",\n content: `# https://editorconfig.org\nroot = true\n\n[*]\ncharset = utf-8\ninsert_final_newline = true\n\nend_of_line = lf\nindent_style = space\nindent_size = 2\nmax_line_length = 120\n\ntrim_trailing_whitespace = true\n\n[Makefile]\nindent_style = tab\n\n[{go.mod,go.sum,*.go}]\nindent_style = tab\n\n[*.rs]\n# Keep in sync with rustfmt\nindent_size = 4\n`,\n description: \"Editor configuration for source code formatting\",\n },\n {\n path: \".prettierignore\",\n content: `# changesets\n.changeset\n\n# debug\nnpm-debug.log*\nyarn-debug.log*\nyarn-error.log*\n.pnpm-debug.log*\n\n# lock files\npackage-lock.json\nyarn.lock\npnpm-lock.yaml\n`,\n description: \"\",\n },\n ],\n linting: [\n {\n path: \"commitlint.config.mjs\",\n content: `/**\n * @see https://commitlint.js.org/reference/configuration.html\n * @type {import('@commitlint/types').UserConfig}\n */\nconst config = {\n extends: [\"@commitlint/config-conventional\"],\n rules: {\n \"body-max-line-length\": [2, \"always\", 350],\n },\n};\n\nexport default config;\n`,\n description: \"Commitlint configuration\",\n },\n {\n path: \"eslint.config.mjs\",\n content: `import { config } from \"@codefast/eslint-config/next\";\n\n/**\n * @see https://eslint.org/docs/latest/use/configure/configuration-files\n * @type {import('eslint').Linter.Config[]}\n */\nconst eslintConfig = [...config];\n\nexport default eslintConfig;\n`,\n description: \"ESLint configuration for the project\",\n },\n {\n path: \"lint-staged.config.mjs\",\n content: `import { relative } from \"node:path\";\n\n/**\n * Builds an ESLint command with the given filenames.\n *\n * @param {string[]} filenames - An array of filenames to be passed to the\n * ESLint command.\n * @returns {string} - The generated ESLint command.\n */\nfunction buildEslintCommand(filenames) {\n return \\`next lint --fix --max-warnings 0 --file \\${filenames.map((file) => relative(import.meta.dirname, file)).\n join(\" --file \")}\\`;\n}\n\n/**\n * @see https://www.npmjs.com/package/lint-staged\n * @type {import('lint-staged').Configuration}\n */\nconst config = {\n \"*.{js,mjs,jsx,ts,tsx}\": [buildEslintCommand, \"prettier --list-different --write\"],\n \"*.{json,css,md,mdx}\": [\"prettier --list-different --write\"],\n};\n\nexport default config;\n`,\n description: \"Configure lint-staged for pre-commit checks\",\n },\n ],\n styles: [\n {\n path: \"src/lib/fonts.ts\",\n content: `import { cn } from \"@codefast/ui\";\nimport { Geist, Geist_Mono as GeistMono } from \"next/font/google\";\n\nconst fontGeistSans = Geist({\n subsets: [\"latin\"],\n variable: \"--font-geist-sans\",\n});\n\nconst fontGeistMono = GeistMono({\n subsets: [\"latin\"],\n variable: \"--font-geist-mono\",\n});\n\nexport const fontVariables = cn(fontGeistSans.variable, fontGeistMono.variable);\n`,\n description: \"Font configuration for the application\",\n },\n {\n path: \"src/app/globals.css\",\n content: `@import \"tailwindcss\";\n\n@import \"@codefast/ui/styles.css\";\n\n@source '../../node_modules/@codefast/ui';\n\n@custom-variant dark (&:where(.dark, .dark *));\n\n@layer base {\n :root {\n --font-sans: var(--font-geist-sans);\n --font-mono: var(--font-geist-mono);\n\n --input: var(--color-neutral-200);\n --border: var(--color-neutral-200);\n --ring: var(--color-neutral-400);\n --background: var(--color-white);\n --foreground: var(--color-neutral-950);\n --primary: var(--color-sky-500);\n --primary-foreground: var(--color-neutral-50);\n --secondary: var(--color-neutral-100);\n --secondary-foreground: var(--color-neutral-900);\n --destructive: var(--color-red-600);\n --accent: var(--color-neutral-100);\n --accent-foreground: var(--color-neutral-900);\n --muted: var(--color-neutral-100);\n --muted-foreground: var(--color-neutral-500);\n --popover: var(--color-white);\n --popover-foreground: var(--color-neutral-950);\n --popover-overlay: --alpha(var(--color-neutral-900) / 20%);\n --card: var(--color-white);\n --card-foreground: var(--color-neutral-950);\n --sidebar: var(--color-neutral-50);\n --sidebar-foreground: var(--color-neutral-950);\n --sidebar-primary: var(--color-sky-500);\n --sidebar-primary-foreground: var(--color-neutral-50);\n --sidebar-accent: var(--color-neutral-100);\n --sidebar-accent-foreground: var(--color-neutral-900);\n --sidebar-border: var(--color-neutral-200);\n --sidebar-ring: var(--color-neutral-400);\n --chart-1: var(--color-orange-600);\n --chart-2: var(--color-teal-600);\n --chart-3: var(--color-cyan-600);\n --chart-4: var(--color-amber-600);\n --chart-5: var(--color-amber-500);\n }\n\n .dark {\n --input: var(--color-neutral-700);\n --border: --alpha(var(--color-neutral-700) / 50%);\n --ring: var(--color-neutral-500);\n --background: var(--color-neutral-950);\n --foreground: var(--color-neutral-50);\n --primary: var(--color-sky-700);\n --primary-foreground: var(--color-neutral-50);\n --secondary: var(--color-neutral-800);\n --secondary-foreground: var(--color-neutral-50);\n --destructive: var(--color-red-400);\n --accent: var(--color-neutral-700);\n --accent-foreground: var(--color-neutral-50);\n --muted: var(--color-neutral-800);\n --muted-foreground: var(--color-neutral-400);\n --popover: var(--color-neutral-800);\n --popover-foreground: var(--color-neutral-50);\n --popover-overlay: --alpha(var(--color-neutral-900) / 80%);\n --card: var(--color-neutral-900);\n --card-foreground: var(--color-neutral-50);\n --sidebar: var(--color-neutral-900);\n --sidebar-foreground: var(--color-neutral-50);\n --sidebar-primary: var(--color-sky-700);\n --sidebar-primary-foreground: var(--color-neutral-50);\n --sidebar-accent: var(--color-neutral-800);\n --sidebar-accent-foreground: var(--color-neutral-50);\n --sidebar-border: var(--color-neutral-800);\n --sidebar-ring: var(--color-neutral-600);\n --chart-1: var(--color-blue-700);\n --chart-2: var(--color-emerald-500);\n --chart-3: var(--color-amber-500);\n --chart-4: var(--color-purple-500);\n --chart-5: var(--color-rose-500);\n }\n}\n`,\n description: \"Global CSS variables for the application\",\n },\n ],\n};\n","import fs from \"node:fs\";\nimport path from \"node:path\";\n\nimport { configGroups } from \"@/commands/create-project/constants\";\nimport { FileUtils, getErrorMessage } from \"@/commands/create-project/utils\";\n\n/**\n * Updates a file if it exists and doesn't already have the specified modifications\n */\nfunction updateFileIfNeeded(\n filePath: string,\n filename: string,\n checkFn: (content: string) => boolean,\n updateFn: (content: string) => string,\n successMessage: string,\n alreadyUpdatedMessage: string,\n): void {\n if (!FileUtils.validatePath(filePath, filename)) {\n return;\n }\n\n const content = FileUtils.readFile(filePath);\n\n if (checkFn(content)) {\n console.log(`๐ ${alreadyUpdatedMessage}`);\n\n return;\n }\n\n try {\n const updatedContent = updateFn(content);\n\n FileUtils.writeFile(filePath, updatedContent);\n console.log(`๐ ${successMessage}`);\n } catch (error) {\n console.warn(`โ ๏ธ Failed to update ${filename}: ${getErrorMessage(error)}`);\n }\n}\n\n/**\n * Updates the PostCSS configuration file by adding a type comment for improved editor support\n */\nexport function updatePostcssConfig(projectDir: string): void {\n const postcssConfigPath = path.join(projectDir, \"postcss.config.mjs\");\n const typeComment = `/** @type {import('postcss-load-config').Config} */\\n`;\n\n updateFileIfNeeded(\n postcssConfigPath,\n \"postcss.config.mjs\",\n (content) => content.includes(typeComment),\n (content) => content.replace(\"const config = {\", `${typeComment}const config = {`),\n \"Updated postcss.config.mjs with type comment.\",\n \"postcss.config.mjs already contains type comment, no changes made.\",\n );\n}\n\n/**\n * Updates the layout file to use fontVariables and apply proper configurations\n */\nexport function updateLayoutFile(projectDir: string): void {\n const layoutPath = path.join(projectDir, \"src/app/layout.tsx\");\n const htmlTarget = '<html className={cn(fontVariables, \"antialiased\")} lang=\"en\">';\n\n updateFileIfNeeded(\n layoutPath,\n \"src/app/layout.tsx\",\n (content) => content.includes(htmlTarget),\n (content) => {\n // Import replacements\n const newImports = `import type { Metadata } from \"next\";\nimport type { JSX, ReactNode } from \"react\";\nimport { cn } from \"@codefast/ui\";\nimport { fontVariables } from \"@/lib/fonts\";\nimport \"@/app/globals.css\";`;\n\n let result = content;\n\n // Remove existing font imports and definitions\n result = result.replaceAll(/import\\s+{[^}]+}\\s+from\\s+[\"']next\\/font\\/google[\"'];\\s*/g, \"\");\n result = result.replace(/const\\s+geistSans\\s*=[^;]+;\\s*const\\s+geistMono\\s*=[^;]+;\\s*/, \"\");\n result = result.replace(\n /import\\s+type\\s+{[^}]+}\\s+from\\s+[\"']next[\"'];\\s*import\\s+[\"']\\.\\/globals\\.css[\"'];\\s*/,\n newImports,\n );\n\n // Update React.ReactNode to ReactNode and add a return type\n result = result.replace(\n /export default function RootLayout\\({\\s*children,\\s*}\\s*:\\s*Readonly<{\\s*children:\\s*React\\.ReactNode;\\s*}>\\)\\s*{/,\n `export default function RootLayout({ children }: Readonly<{ children: ReactNode }>): JSX.Element {`,\n );\n\n // Update HTML and body tags\n result = result.replace(/<html\\s+lang=\"en\"\\s*>/, htmlTarget);\n result = result.replace(/<body\\s+className={`[^`]*`}\\s*>/, `<body>`);\n\n return result;\n },\n \"Updated src/app/layout.tsx to use fontVariables in html tag, removed className from body, modified ReactNode import, and added return type to RootLayout\",\n \"src/app/layout.tsx already uses fontVariables in html tag, no changes made.\",\n );\n}\n\n/**\n * Updates the scripts and hooks in the package.json file\n */\nexport function updatePackageJson(projectDir: string): void {\n const packageJsonPath = path.join(projectDir, \"package.json\");\n\n if (!FileUtils.validatePath(packageJsonPath, \"package.json\")) {\n return;\n }\n\n try {\n const packageJson = JSON.parse(FileUtils.readFile(packageJsonPath));\n\n packageJson.scripts = {\n ...packageJson.scripts,\n \"check-types\": \"tsc --noEmit\",\n \"deploy:preview\": \"vercel deploy --archive=tgz\",\n \"deploy:prod\": \"vercel deploy --archive=tgz --prod\",\n format: \"prettier --write --ignore-unknown .\",\n \"format:check\": \"prettier --check --ignore-unknown .\",\n lint: \"next lint --fix --max-warnings 0\",\n \"lint:check\": \"next lint --max-warnings 0\",\n \"package:install\": \"pnpm install\",\n \"package:outdated\": \"pnpm outdated\",\n \"package:upgrade\": \"pnpm update --latest\",\n preview: \"pnpm build && pnpm start\",\n };\n\n packageJson[\"simple-git-hooks\"] = {\n \"pre-commit\": \"pnpm lint-staged\",\n \"commit-msg\": \"pnpm commitlint --edit\",\n };\n\n FileUtils.writeFile(packageJsonPath, JSON.stringify(packageJson, null, 2));\n console.log(`๐ Updated package.json`);\n } catch (error) {\n console.warn(`โ ๏ธ Failed to update package.json: ${getErrorMessage(error)}`);\n }\n}\n\n/**\n * Updates the Next.js configuration file to add experimental optimizePackageImports\n */\nexport function updateNextConfig(projectDir: string): void {\n const nextConfigPath = path.join(projectDir, \"next.config.ts\");\n const optimizePackagesConfig = 'optimizePackageImports: [\"@codefast/ui\"]';\n\n updateFileIfNeeded(\n nextConfigPath,\n \"next.config.ts\",\n (content) => content.includes(optimizePackagesConfig),\n (content) =>\n content.replace(\n /const nextConfig: NextConfig = \\{/,\n `const nextConfig: NextConfig = {\n experimental: {\n optimizePackageImports: [\"@codefast/ui\"],\n },`,\n ),\n \"Updated next.config.ts with optimizePackageImports configuration.\",\n \"next.config.ts already contains optimizePackageImports configuration, no changes made.\",\n );\n}\n\n/**\n * Updates the page.tsx file by adding JSX.Element return type to the Home component\n */\nexport function updatePageFile(projectDir: string): void {\n const pagePath = path.join(projectDir, \"src/app/page.tsx\");\n\n updateFileIfNeeded(\n pagePath,\n \"src/app/page.tsx\",\n (content) => content.includes(\"): JSX.Element\"),\n (content) => {\n let result = content;\n\n // Add JSX import if not present\n if (!result.includes(\"import type { JSX }\")) {\n if (result.includes(\"import type {\")) {\n // Add JSX to existing type import\n result = result.replace(\n /import type {(?<types>[^}]+)} from \"react\";/,\n 'import type {$1, JSX } from \"react\";',\n );\n } else if (result.includes(\"import {\")) {\n // Add type import before the first import\n result = result.replace(/import {/, 'import type { JSX } from \"react\";\\n\\nimport {');\n } else {\n // Add type import at the beginning of the file\n result = `import type { JSX } from \"react\";\\n\\n${result}`;\n }\n }\n\n // Add JSX.Element return type to the Home component\n result = result.replace(/export default function Home\\(\\) {/, \"export default function Home(): JSX.Element {\");\n\n return result;\n },\n \"Updated src/app/page.tsx to add JSX.Element return type to Home component\",\n \"src/app/page.tsx already has JSX.Element return type, no changes made.\",\n );\n}\n\n/**\n * Creates configuration files in the specified project directory\n */\nexport function createConfigFiles(projectDir: string): void {\n console.log(`\\n๐ Creating configuration files...`);\n\n // Iterate through each configuration category (linting, formatting, styles)\n for (const [category, configs] of Object.entries(configGroups)) {\n console.log(`\\n๐ Setting up ${category} configurations:`);\n\n for (const { path: filePath, content, description } of configs) {\n const fullPath = path.join(projectDir, filePath);\n const dir = path.dirname(fullPath);\n\n // Create a directory if it doesn't exist\n if (!FileUtils.exists(dir)) {\n fs.mkdirSync(dir, { recursive: true });\n }\n\n // Write the configuration file and log its description\n FileUtils.writeConfigFile(fullPath, content);\n\n if (description) {\n console.log(` โน๏ธ ${filePath}: ${description}`);\n }\n }\n }\n}\n","import * as fs from \"node:fs\";\nimport * as path from \"node:path\";\n\nimport { DEV_DEPENDENCIES, MAIN_DEPENDENCIES, PACKAGES_TO_REMOVE } from \"@/commands/create-project/constants\";\nimport { getErrorMessage, runCommand } from \"@/commands/create-project/utils\";\n\n/**\n * Installs project dependencies and development tools required for the application.\n *\n * This function handles the installation of both runtime and development dependencies\n * using the package manager. It ensures the necessary libraries and tools are added to the project\n * for proper operation and coding standards enforcement.\n *\n * @returns void - Does not return a value.\n */\nexport function installDependencies(): void {\n console.log(`\\n๐ Installing dependencies...`);\n\n // Install main dependencies\n if (MAIN_DEPENDENCIES.length > 0) {\n runCommand(`pnpm add ${MAIN_DEPENDENCIES.join(\" \")}`);\n }\n\n // Install development dependencies\n const allDevDependencies = Object.values(DEV_DEPENDENCIES).flat().join(\" \");\n\n if (allDevDependencies) {\n runCommand(`pnpm add -D ${allDevDependencies}`);\n }\n}\n\n/**\n * Removes unnecessary packages that might conflict with the project configuration\n * or are redundant due to alternative packages being used.\n *\n * @returns void - Does not return a value.\n */\nexport function cleanupPackages(): void {\n console.log(`\\n๐งน Cleaning up unnecessary packages...`);\n\n // Read package.json to check existing dependencies\n const packageJsonPath = path.join(process.cwd(), \"package.json\");\n\n if (!fs.existsSync(packageJsonPath)) {\n console.warn(`โ ๏ธ package.json not found, skipping cleanup.`);\n\n return;\n }\n\n let packageJson;\n\n try {\n packageJson = JSON.parse(fs.readFileSync(packageJsonPath, \"utf8\"));\n } catch (error) {\n console.warn(`โ ๏ธ Error reading package.json: ${getErrorMessage(error)}, skipping cleanup.`);\n\n return;\n }\n\n // Get existing dependencies and devDependencies\n const dependencies = packageJson.dependencies ?? {};\n const devDependencies = packageJson.devDependencies ?? {};\n\n // Filter packages to remove only those that exist in package.json\n const packagesToRemove = PACKAGES_TO_REMOVE.filter((pkg) => pkg in dependencies || pkg in devDependencies);\n\n if (packagesToRemove.length > 0) {\n runCommand(`pnpm remove ${packagesToRemove.join(\" \")}`);\n } else {\n console.log(`โน๏ธ No unnecessary packages found in package.json to remove.`);\n }\n}\n","import { execSync } from \"node:child_process\";\n\n/**\n * Checks the current environment to ensure PNPM is installed.\n * If PNPM is not detected, logs an error message and terminates the process.\n *\n * @returns void\n */\nexport function checkEnvironment(): void {\n try {\n execSync(\"pnpm --version\", { stdio: \"ignore\" });\n } catch {\n console.error(`โ PNPM chฦฐa ฤฦฐแปฃc cร i ฤแบทt. Vui lรฒng cร i ฤแบทt PNPM trฦฐแปc.`);\n process.exit(1);\n }\n}\n","import { runCommand } from \"@/commands/create-project/utils\";\n\n/**\n * Creates a new Next.js project with predefined configuration flags.\n *\n * @param projectName - The name of the project to be created.\n * @returns void\n */\nexport function createNextProject(projectName: string): void {\n console.log(`๐ฆ Creating Next.js project...`);\n const flags = [\n \"--ts\",\n \"--tailwind\",\n \"--eslint\",\n \"--app\",\n \"--turbo\",\n \"--use-pnpm\",\n \"--src-dir\",\n \"--turbopack\",\n '--import-alias \"@/*\"',\n ].join(\" \");\n\n runCommand(`npx create-next-app@latest ${projectName} ${flags}`);\n}\n","import { Command } from \"commander\";\n\nimport { checkExistingProject } from \"@/commands/create-project/check-existing-project\";\nimport {\n createConfigFiles,\n updateLayoutFile,\n updateNextConfig,\n updatePackageJson,\n updatePageFile,\n updatePostcssConfig,\n} from \"@/commands/create-project/config-files\";\nimport { cleanupPackages, installDependencies } from \"@/commands/create-project/dependencies\";\nimport { checkEnvironment } from \"@/commands/create-project/environment\";\nimport { createNextProject } from \"@/commands/create-project/next-project\";\nimport { getErrorMessage, rl, runCommand } from \"@/commands/create-project/utils\";\n\nexport const createProjectCommand = new Command()\n .name(\"create-project [name]\")\n .description(\"Create a new Next.js project with recommended setup\")\n .action(async (projectNameArg) => {\n try {\n // Check environment (PNPM, write permissions)\n checkEnvironment();\n\n // Check if package.json exists and get the project name\n const { projectName, packageJsonExists } = await checkExistingProject(projectNameArg);\n\n if (!packageJsonExists) {\n console.log(`\\n๐ Starting project creation for ${projectName}...\\n`);\n createNextProject(projectName);\n process.chdir(projectName);\n console.log(`๐ Moved to ${projectName}`);\n }\n\n // Update layout.tsx to use fontVariables\n updateLayoutFile(process.cwd());\n\n // Update page.tsx to add JSX.Element return types\n updatePageFile(process.cwd());\n\n // Edit the postcss.config.mjs file\n updatePostcssConfig(process.cwd());\n\n // Install dependencies\n installDependencies();\n\n // Remove unwanted packages\n cleanupPackages();\n\n // Create configuration files\n createConfigFiles(process.cwd());\n\n // Update next.config.ts with experimental configuration\n updateNextConfig(process.cwd());\n\n // Update package.json\n updatePackageJson(process.cwd());\n\n // Enable git hooks\n console.log(`\\n๐ Activating git hooks...`);\n runCommand(\"pnpm simple-git-hooks\");\n\n // Run Prettier to format the file\n console.log(`\\n๐ Formatting files with Prettier...`);\n runCommand(\"pnpm format\");\n\n // Run ESLint\n console.log(`\\n๐ Running ESLint to check code style...`);\n runCommand(\"pnpm lint\");\n\n // Completion notice\n console.log(`\\nโ
Project ${packageJsonExists ? \"configured\" : \"created\"} successfully!`);\n console.log(`- Project: ${projectName}`);\n console.log(\"- Next.js with TypeScript\");\n console.log(\"- TailwindCSS and @codefast/ui\");\n console.log(\"- ESLint, Prettier, Commitlint, and Git Hooks\");\n console.log(\"- Lint-staged for pre-commit checks\");\n console.log(`\\n๐ Project directory: ${process.cwd()}`);\n console.log(`\\n๐ To start development:`);\n console.log(`cd ${projectName} && pnpm dev`);\n } catch (error) {\n console.error(`\\nโ An error occurred: ${getErrorMessage(error)}`);\n process.exit(1);\n } finally {\n // Close readline interface\n rl.close();\n process.exit(0);\n }\n });\n","import type { SourceFile } from \"ts-morph\";\n\nimport { Project } from \"ts-morph\";\n\nimport type { AnalysisResult, ImportPath, PackageConfig } from \"@/commands/update-exports/types\";\n\n/**\n * Creates a regex to remove specified prefixes from paths\n * @param prefixes - Array of prefixes to remove\n * @returns RegExp matching any prefix\n */\nfunction makeRegexPrefixesToRemove(prefixes: string[]): RegExp {\n // Matches: ^\\.?\\/?(prefix1|prefix2)\\/(.*)\n // - ^\\.?\\/? : Optional ./ or /\n // - (prefix1|prefix2): Any prefix from the list\n // - \\/(.*) : Remaining path after prefix\n const prefixPattern = prefixes.join(\"|\");\n\n return new RegExp(`^.?\\\\/?(?:${prefixPattern})\\\\/(.*)$`);\n}\n\n/**\n * Processes an export path by removing specified prefixes\n * @param modulePath - Path to process\n * @param regexPattern - Regex for prefix removal\n * @returns Processed path starting with ./\n */\nfunction processExportPath(modulePath: string, regexPattern: RegExp): string {\n let processedPath = modulePath;\n const match = processedPath.match(regexPattern);\n\n if (match) {\n const remainingPath = match[1];\n\n processedPath = remainingPath.startsWith(\"./\") ? remainingPath : `./${remainingPath}`;\n }\n\n return processedPath;\n}\n\n/**\n * Analyzes imports from an index.ts file\n * @param indexFilePath - Path to index.ts\n * @param packageConfig - Package configuration\n * @returns AnalysisResult containing import paths\n */\nexport function analyzeImports(indexFilePath: string, packageConfig: PackageConfig): AnalysisResult {\n const project = new Project();\n let sourceFile: SourceFile;\n\n try {\n sourceFile = project.addSourceFileAtPath(indexFilePath);\n } catch (error) {\n console.error(`Error loading source file at ${indexFilePath}:`, error);\n\n return { imports: [] };\n }\n\n const imports: ImportPath[] = [];\n const prefixesToRemove = packageConfig.exportPathPrefixesToRemove ?? [];\n const regexPattern = makeRegexPrefixesToRemove(prefixesToRemove);\n\n for (const exportDecl of sourceFile.getExportDeclarations()) {\n let moduleSpecifier = exportDecl.getModuleSpecifierValue();\n\n if (!moduleSpecifier) {\n continue;\n }\n\n // Normalize @/ to ./\n if (moduleSpecifier.startsWith(\"@/\")) {\n moduleSpecifier = `./${moduleSpecifier.slice(2)}`;\n }\n\n const isExternal = !moduleSpecifier.startsWith(\".\");\n\n if (isExternal) {\n continue;\n }\n\n const parts = moduleSpecifier.split(\"/\").filter(Boolean);\n\n if (parts.length < 2) {\n continue;\n }\n\n let directory;\n\n if (parts.length <= 1) {\n directory = \".\";\n } else {\n directory = parts.slice(0, -1).join(\"/\");\n\n if (directory.startsWith(\"./\")) {\n directory = directory.slice(2);\n }\n }\n\n const name = parts.at(-1) ?? \"\";\n\n const importPath: ImportPath = {\n originalPath: moduleSpecifier,\n directory,\n name,\n exportPath: processExportPath(moduleSpecifier, regexPattern),\n };\n\n imports.push(importPath);\n }\n\n return { imports };\n}\n","import { z } from \"zod\";\n\n/**\n * Represents the schema for package configuration.\n *\n * @param cjsOutputPattern - A string specifying the output pattern for the CommonJS format.\n * @param esmOutputPattern - A string specifying the output pattern for the ESM format.\n * @param packageJsonPath - A string representing the path to the package.json file.\n * @param srcIndexPath - A string specifying the path to the source index file.\n * @param typesOutputCjsPattern - A string defining the output pattern for type declarations in the CommonJS format.\n * @param typesOutputPattern - A string defining the output pattern for type declarations in general.\n * @param exportPathPrefixesToRemove - An optional array of strings specifying prefixes to remove from export paths.\n */\nexport const PackageConfigSchema = z.interface({\n cjsOutputPattern: z.string(),\n esmOutputPattern: z.string(),\n packageJsonPath: z.string(),\n srcIndexPath: z.string(),\n typesOutputCjsPattern: z.string(),\n typesOutputPattern: z.string(),\n \"exportPathPrefixesToRemove?\": z.array(z.string()),\n});\n\n/**\n * Represents the schema structure for the script configuration.\n *\n * This schema outlines the required and optional fields necessary for defining\n * configurations for custom packages, default package settings, and the pattern\n * used for finding package files.\n *\n * @param customPackageConfigs - A record where keys are strings and values are partials of PackageConfigSchema giving\n * the configurations for custom packages. This allows defining overrides or additional\n * configuration for specific packages.\n * @param defaultPackageConfig - The default package configuration, uniformly applied unless overridden by customPackageConfigs.\n * @param packagesGlob - A string indicating the glob pattern used to identify package files.\n */\nexport const ScriptConfigSchema = z.interface({\n customPackageConfigs: z.record(z.string(), PackageConfigSchema.partial()),\n defaultPackageConfig: PackageConfigSchema,\n packagesGlob: z.string(),\n});\n\n/**\n * Represents the configuration settings for a package.\n *\n * This type is derived from the `PackageConfigSchema` using the `zod` library.\n *\n * @typeParam T - The inferred type of the package configuration schema.\n *\n * @returns The inferred type from `PackageConfigSchema` representing the package configuration.\n */\nexport type PackageConfig = z.infer<typeof PackageConfigSchema>;\n/**\n * Represents the configuration for a script based on the `ScriptConfigSchema`.\n * This type infers its structure using `z.infer`.\n *\n * @typeParam T - The type inferred from the schema definition.\n *\n * @returns The inferred type that matches the schema.\n */\nexport type ScriptConfig = z.infer<typeof ScriptConfigSchema>;\n\n/**\n * Represents an import path for a module or file, including its directory, export path, name, and original path.\n *\n * @param directory - The directory containing the import.\n * @param exportPath - The resolved path of the export from the directory.\n * @param name - The name of the import.\n * @param originalPath - The original unresolved path of the import as provided in the source.\n */\nexport interface ImportPath {\n directory: string;\n exportPath: string;\n name: string;\n originalPath: string;\n}\n\n/**\n * Represents the result of an analysis process, including the identified import paths.\n *\n * @typeParam ImportPath - The type representing an individual import path.\n */\nexport interface AnalysisResult {\n imports: ImportPath[];\n}\n\n/**\n * Represents the configuration settings for exporting modules in different formats.\n *\n * This interface defines the required structure for specifying export configurations\n * in terms of import and require formats, including default exports and type exports.\n */\nexport interface ExportConfig {\n import: {\n default: string;\n types: string;\n };\n require: {\n default: string;\n types: string;\n };\n}\n\n/**\n * Represents a target for export, which can either be an `ExportConfig` object\n * or a string defining the target.\n *\n * @typeParam ExportConfig - Defines the configuration type for export when not using a string as a target.\n */\nexport type ExportTarget = ExportConfig | string;\n/**\n * Represents the structure of package exports, mapping export paths to their targets.\n *\n * This type is primarily used to define a dictionary where the keys are export paths\n * (strings) and the values are the targets to which these paths resolve.\n *\n * @typeParam ExportTarget - The type representing the value of each export target.\n * @returns A record that maps export path strings to their corresponding export targets.\n */\nexport type PackageExports = Record<string, ExportTarget>;\n\n/**\n * Represents the structure of a `package.json` file in a Node.js project.\n *\n * This interface defines the essential fields for describing a package, such as its name, version,\n * and an optional `exports` field used for specifying module exports.\n *\n * @typeParam T - An optional type parameter for customizing the `exports` field (if applicable).\n * @returns An object adhering to the `PackageJson` structure.\n */\nexport interface PackageJson {\n name: string;\n version: string;\n exports?: PackageExports;\n}\n\n/**\n * Represents the configuration options for a process.\n *\n * The `ProcessOptions` interface allows the customization of process behavior\n * through various optional parameters.\n *\n * @param dryRun - Indicates if the process should run in a simulation mode without making changes.\n * @param configPath - Specifies the file path to a configuration file, if provided.\n * @param packageFilter - Filters packages that should be processed, if specified.\n */\nexport interface ProcessOptions {\n dryRun: boolean;\n configPath?: string;\n packageFilter?: string;\n}\n","import { merge } from \"lodash-es\";\nimport fs from \"node:fs\";\nimport path from \"node:path\";\n\nimport type { PackageConfig, ScriptConfig } from \"@/commands/update-exports/types\";\n\nimport { ScriptConfigSchema } from \"@/commands/update-exports/types\";\n\n// Cache for storing configuration to avoid repeated file reads\nlet cachedConfig: null | ScriptConfig = null;\n\n/**\n * Loads and validates configuration from a file\n * @param configPath - Optional path to the config file\n * @returns Partial ScriptConfig or empty object if not found/invalid\n */\nfunction loadConfigFile(configPath?: string): Partial<ScriptConfig> {\n if (!configPath) {\n return {};\n }\n\n try {\n const fullPath = path.resolve(configPath);\n\n if (!fs.existsSync(fullPath)) {\n console.warn(`Configuration file not found at ${fullPath}`);\n\n return {};\n }\n\n const configContent = fs.readFileSync(fullPath, \"utf8\");\n const config = JSON.parse(configContent);\n\n // Validate against schema\n return ScriptConfigSchema.parse(config);\n } catch (error) {\n console.error(\"Error reading configuration file:\", error);\n\n return {};\n }\n}\n\n/**\n * Retrieves merged configuration, using cache if no path is provided\n * @param configPath - Optional path to override default config\n * @returns Merged ScriptConfig\n */\nexport function getConfig(configPath?: string): ScriptConfig {\n if (cachedConfig && !configPath) {\n return cachedConfig;\n }\n\n const userConfig = loadConfigFile(configPath);\n const config = merge({}, defaultConfig, userConfig) as ScriptConfig;\n\n // Cache config if no path is provided\n if (!configPath) {\n cachedConfig = config;\n }\n\n return config;\n}\n\n/**\n * Retrieves configuration for a specific package\n * @param packageName - Name of the package\n * @param config - Optional ScriptConfig to use\n * @returns PackageConfig combining defaults and custom settings\n */\nexport function getPackageConfig(packageName: string, config?: ScriptConfig): PackageConfig {\n const configObj = config ?? getConfig();\n const customConfig = configObj.customPackageConfigs[packageName] ?? {};\n\n return {\n ...configObj.defaultPackageConfig,\n ...customConfig,\n };\n}\n\n// Default configuration for the script\nexport const defaultConfig: ScriptConfig = {\n packagesGlob: \"./packages/**/package.json\",\n defaultPackageConfig: {\n cjsOutputPattern: \"./dist/cjs/{dir}/{name}.cjs\",\n esmOutputPattern: \"./dist/esm/{dir}/{name}.js\",\n packageJsonPath: \"package.json\",\n srcIndexPath: \"src/index.ts\",\n typesOutputCjsPattern: \"./dist/types/{dir}/{name}.d.ts\",\n typesOutputPattern: \"./dist/types/{dir}/{name}.d.ts\",\n },\n customPackageConfigs: {\n \"@codefast/ui\": {\n exportPathPrefixesToRemove: [\"components\"],\n },\n \"@codefast/style-guide\": {\n exportPathPrefixesToRemove: [\"configs\"],\n },\n },\n};\n","import fs from \"node:fs\";\nimport path from \"node:path\";\n\nimport type { AnalysisResult, PackageExports, PackageJson } from \"@/commands/update-exports/types\";\n\n// Constants for file operations\nconst EXPORTS_ANALYSIS_DIR = \".exports-analysis\";\nconst EXPORTS_PREVIEW_FILE = \"exports-preview.json\";\nconst EXPORTS_ANALYSIS_FILE = \"exports-analysis.json\";\nconst ENCODING = \"utf8\";\nconst JSON_INDENT = 2;\n/**\n * Utility functions for file and directory operations\n */\nconst FileUtils = {\n /**\n * Checks if a file exists\n * @param filePath - Path to check\n * @returns True if a file exists\n */\n exists(filePath: string): boolean {\n return fs.existsSync(filePath);\n },\n\n /**\n * Creates a directory if it doesn't exist\n * @param dirPath - Directory path\n */\n ensureDirectoryExists(dirPath: string): void {\n if (!fs.existsSync(dirPath)) {\n fs.mkdirSync(dirPath, { recursive: true });\n }\n },\n\n /**\n * Reads and parses a JSON file\n * @param filePath - Path to JSON file\n * @returns Parsed content or null if error\n */\n readJsonFile<T>(filePath: string): null | T {\n try {\n const content = fs.readFileSync(filePath, ENCODING);\n\n return JSON.parse(content) as T;\n } catch (error) {\n console.error(`Error reading JSON file at ${filePath}:`, error);\n\n return null;\n }\n },\n\n /**\n * Writes content to a JSON file\n * @param filePath - Path to write\n * @param content - Content to write\n * @returns True if successful\n */\n writeJsonFile<T>(filePath: string, content: T): boolean {\n try {\n fs.writeFileSync(filePath, `${JSON.stringify(content, null, JSON_INDENT)}\\n`, ENCODING);\n\n return true;\n } catch (error) {\n console.error(`Error writing JSON file at ${filePath}:`, error);\n\n return false;\n }\n },\n\n /**\n * Gets the exports analysis directory path\n * @param packageDir - Package directory\n * @returns Analysis directory path\n */\n getAnalysisDir(packageDir: string): string {\n const outputDir = path.join(packageDir, EXPORTS_ANALYSIS_DIR);\n\n this.ensureDirectoryExists(outputDir);\n\n return outputDir;\n },\n\n /**\n * Creates a timestamped backup filename\n * @param baseFilename - Original filename\n * @returns Backup filename with timestamp\n */\n createBackupFilename(baseFilename: string): string {\n const timestamp = new Date().toISOString().replaceAll(/[:.]/g, \"-\");\n\n return `${baseFilename}.backup.${timestamp}`;\n },\n};\n\n/**\n * Checks if a file exists\n * @param filePath - Path to check\n * @returns True if a file exists\n */\nexport function fileExists(filePath: string): boolean {\n return FileUtils.exists(filePath);\n}\n\n/**\n * Reads and parses package.json content\n * @param filePath - Path to package.json\n * @returns Parsed PackageJson or null if error\n */\nexport function readPackageJson(filePath: string): null | PackageJson {\n return FileUtils.readJsonFile<PackageJson>(filePath);\n}\n\n/**\n * Creates a backup of package.json\n * @param filePath - Path to package.json\n * @returns True if backup was successful\n */\nexport function backupPackageJson(filePath: string): boolean {\n try {\n const content = fs.readFileSync(filePath, ENCODING);\n const dir = path.dirname(filePath);\n const backupDir = path.join(dir, EXPORTS_ANALYSIS_DIR);\n\n FileUtils.ensureDirectoryExists(backupDir);\n\n const baseName = path.basename(filePath);\n const backupPath = path.join(backupDir, FileUtils.createBackupFilename(baseName));\n\n fs.writeFileSync(backupPath, content, ENCODING);\n\n return true;\n } catch (error) {\n console.error(`Error backing up package.json at ${filePath}:`, error);\n\n return false;\n }\n}\n\n/**\n * Saves updated package.json content\n * @param filePath - Path to package.json\n * @param content - Updated content\n * @returns True if save was successful\n */\nexport function savePackageJson(filePath: string, content: PackageJson): boolean {\n return FileUtils.writeJsonFile(filePath, content);\n}\n\n/**\n * Saves the given JSON content to a specified file within the analysis directory.\n *\n * @param packageDir - The root directory where the analysis directory resides.\n * @param fileName - The name of the file to which the JSON content will be written.\n * @param content - The JSON content to save to the file.\n */\nexport function saveJsonToFile<T>(packageDir: string, fileName: string, content: T): void {\n const outputDir = FileUtils.getAnalysisDir(packageDir);\n\n FileUtils.writeJsonFile(path.join(outputDir, fileName), content);\n}\n\n/**\n * Saves exports analysis results\n * @param packageDir - Package directory\n * @param analysis - Analysis results\n */\nexport function saveExportsAnalysis(packageDir: string, analysis: AnalysisResult): void {\n saveJsonToFile(packageDir, EXPORTS_ANALYSIS_FILE, analysis);\n}\n\n/**\n * Saves preview of generated exports\n * @param packageDir - Package directory\n * @param exports - Generated exports\n */\nexport function saveExportsPreview(packageDir: string, exports: PackageExports): void {\n saveJsonToFile(packageDir, EXPORTS_PREVIEW_FILE, exports);\n}\n","import type { ImportPath, PackageExports, ScriptConfig } from \"@/commands/update-exports/types\";\n\nimport { getPackageConfig } from \"@/commands/update-exports/config\";\n\n/**\n * Formats an output path based on a pattern, directory, and name\n * @param pattern - Output pattern\n * @param directory - Directory path\n * @param name - Module name\n * @returns Formatted output path\n */\nfunction formatOutputPath(pattern: string, directory: string, name: string): string {\n const dirPart = directory === \".\" ? \"\" : `${directory}/`;\n\n return pattern.replace(\"{dir}/\", dirPart).replace(\"{dir}\", directory).replace(\"{name}\", name);\n}\n\n/**\n * Generates export structure for package.json\n * @param packageName - Name of the package\n * @param imports - Analyzed import paths\n * @param existingExports - Current exports to preserve\n * @param config - Optional ScriptConfig\n * @returns Updated PackageExports\n */\nexport function generateExports(\n packageName: string,\n imports: ImportPath[],\n existingExports: PackageExports = {},\n config?: ScriptConfig,\n): PackageExports {\n const packageConfig = getPackageConfig(packageName, config);\n\n const exports: PackageExports = {\n \".\": existingExports[\".\"] ?? {\n import: {\n types: \"./dist/types/index.d.ts\",\n default: \"./dist/esm/index.js\",\n },\n require: {\n types: \"./dist/types/index.d.cts\",\n default: \"./dist/cjs/index.cjs\",\n },\n },\n };\n\n // Preserve existing CSS exports\n if (existingExports[\"./styles.css\"]) {\n exports[\"./styles.css\"] = existingExports[\"./styles.css\"];\n }\n\n // Generate exports for each import path\n for (const importPath of imports) {\n const { directory, name, exportPath } = importPath;\n\n const esmOutput = formatOutputPath(packageConfig.esmOutputPattern, directory, name);\n const cjsOutput = formatOutputPath(packageConfig.cjsOutputPattern, directory, name);\n const typesOutput = formatOutputPath(packageConfig.typesOutputPattern, directory, name);\n const typesCjsOutput = formatOutputPath(packageConfig.typesOutputCjsPattern, directory, name);\n\n exports[exportPath] = {\n import: {\n types: typesOutput,\n default: esmOutput,\n },\n require: {\n types: typesCjsOutput,\n default: cjsOutput,\n },\n };\n }\n\n return exports;\n}\n","import { glob } from \"glob\";\nimport path from \"node:path\";\n\nimport type { ProcessOptions, ScriptConfig } from \"@/commands/update-exports/types\";\n\nimport { analyzeImports } from \"@/commands/update-exports/analyze-imports\";\nimport { getConfig, getPackageConfig } from \"@/commands/update-exports/config\";\nimport {\n backupPackageJson,\n fileExists,\n readPackageJson,\n saveExportsAnalysis,\n saveExportsPreview,\n savePackageJson,\n} from \"@/commands/update-exports/file-utils\";\nimport { generateExports } from \"@/commands/update-exports/generate-exports\";\n\nconst DEFAULT_IGNORE_PATTERN = [\"**/node_modules/**\"];\n\n/**\n * Finds all package.json files in the workspace\n * @param config - Optional ScriptConfig\n * @returns Array of package.json paths\n */\nexport async function findAllPackages(config?: ScriptConfig): Promise<string[]> {\n const configObj = config ?? getConfig();\n\n return await glob(configObj.packagesGlob, {\n ignore: DEFAULT_IGNORE_PATTERN,\n });\n}\n\n/**\n * Processes a single package\n * @param packageJsonPath - Path to package.json\n * @param options - Processing options\n * @returns True if processing was successful\n */\nexport function processPackage(packageJsonPath: string, options: ProcessOptions): boolean {\n const packageDir = path.dirname(packageJsonPath);\n const packageJson = readPackageJson(packageJsonPath);\n\n if (!packageJson) {\n console.error(`Failed to read ${packageJsonPath}`);\n\n return false;\n }\n\n const packageName = packageJson.name;\n\n // Skip if package doesn't match filter\n if (options.packageFilter && packageName !== options.packageFilter) {\n console.debug(`Skipping ${packageName} (does not match filter)`);\n\n return false;\n }\n\n console.info(`Processing package: ${packageName}`);\n\n const config = getConfig(options.configPath);\n const packageConfig = getPackageConfig(packageName, config);\n const srcIndexPath = path.join(packageDir, packageConfig.srcIndexPath);\n\n if (!fileExists(srcIndexPath)) {\n console.error(`Source file not found at ${srcIndexPath}`);\n\n return false;\n }\n\n // Analyze imports\n console.info(`Analyzing imports from ${srcIndexPath}...`);\n const { imports } = analyzeImports(srcIndexPath, packageConfig);\n\n if (imports.length === 0) {\n console.warn(`No imports found to analyze in ${packageName}`);\n\n return false;\n }\n\n console.log(`Analysis complete. Found ${imports.length} subpath exports.`);\n\n // Save analysis results\n saveExportsAnalysis(packageDir, { imports });\n\n // Generate new exports\n const newExports = generateExports(packageName, imports, packageJson.exports, config);\n\n // Compare export counts\n const currentExportsCount = packageJson.exports ? Object.keys(packageJson.exports).length : 0;\n const newExportsCount = Object.keys(newExports).length;\n\n console.info(`Exports: ${currentExportsCount} -> ${newExportsCount}`);\n\n if (options.dryRun) {\n saveExportsPreview(packageDir, newExports);\n console.warn(`Saved exports preview to .exports-analysis`);\n console.warn(`Dry run: no changes saved for ${packageName}`);\n\n return true;\n }\n\n // Backup package.json\n if (backupPackageJson(packageJsonPath)) {\n console.log(`Backed up ${packageJsonPath}`);\n }\n\n // Update package.json\n const updatedPackageJson = { ...packageJson, exports: newExports };\n\n if (savePackageJson(packageJsonPath, updatedPackageJson)) {\n console.log(`Updated exports for ${packageName}`);\n\n return true;\n }\n\n console.error(`Failed to update ${packageJsonPath}`);\n\n return false;\n}\n\n/**\n * Processes all packages in the workspace\n * @param options - Processing options\n */\nexport async function processAllPackages(options: ProcessOptions): Promise<void> {\n try {\n console.info(\"Searching for packages...\");\n const config = getConfig(options.configPath);\n const packageJsonPaths = await findAllPackages(config);\n\n if (packageJsonPaths.length === 0) {\n console.warn(\"No packages found.\");\n\n return;\n }\n\n console.log(`Found ${packageJsonPaths.length} packages.`);\n\n let successCount = 0;\n let skipCount = 0;\n let errorCount = 0;\n\n for (const packageJsonPath of packageJsonPaths) {\n const result = processPackage(packageJsonPath, options);\n\n if (result) {\n successCount++;\n } else if (options.packageFilter) {\n skipCount++;\n } else {\n errorCount++;\n }\n }\n\n console.log(\"Completed exports update.\");\n console.info(`Stats: ${successCount} succeeded, ${skipCount} skipped, ${errorCount} failed`);\n } catch (error) {\n console.error(\"Error processing packages:\", error);\n throw error;\n }\n}\n","import { Command } from \"commander\";\n\nimport type { ProcessOptions } from \"@/commands/update-exports/types\";\n\nimport { processAllPackages } from \"@/commands/update-exports/process-package\";\n\nexport const updateExportsCommand = new Command()\n .name(\"update-exports\")\n .description(\"Updates exports for all packages\")\n .option(\"-p, --package <package>\", \"Filter by package name\")\n .option(\"-d, --dry-run\", \"Run without making changes\")\n .option(\"-c, --config <path>\", \"Path to configuration file\")\n .action(async (options) => {\n const processorOptions: ProcessOptions = {\n packageFilter: options.package,\n dryRun: Boolean(options.dryRun),\n configPath: options.config,\n };\n\n try {\n await processAllPackages(processorOptions);\n } catch (error) {\n console.error(\"Error processing packages:\", error);\n process.exit(1);\n } finally {\n process.exit(0);\n }\n });\n","import { readFileSync } from \"node:fs\";\nimport { dirname, resolve } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\nexport interface PackageInfo {\n name: string;\n version: string;\n}\n\nexport function getPackageInfo(): PackageInfo {\n const __filename = fileURLToPath(import.meta.url);\n const __dirname = dirname(__filename);\n const packageJsonPath = resolve(__dirname, \"../package.json\");\n\n return JSON.parse(readFileSync(packageJsonPath, \"utf8\")) as PackageInfo;\n}\n\nexport function getPackageVersion(): string {\n return getPackageInfo().version;\n}\n","\n\nimport { Command } from \"commander\";\n\nimport { createProjectCommand } from \"@/commands/create-project/command\";\nimport { updateExportsCommand } from \"@/commands/update-exports/command\";\nimport { getPackageVersion } from \"@/lib/package-info\";\n\nfunction main(): void {\n const program = new Command();\n\n program\n .name(\"codefast\")\n .description(\"CodeFast CLI - A development toolkit for CodeFast.\")\n .version(getPackageVersion(), \"-v, --version\", \"display CLI version\")\n .addCommand(updateExportsCommand)\n .addCommand(createProjectCommand)\n .parse(process.argv);\n}\n\nmain();\n"],"names":["rl","readline","process","prompt","question","Promise","resolve","answer","runCommand","command","execSync","FileUtils","filePath","fs","error","Error","getErrorMessage","content","console","filename","validateProjectName","name","npmNameRegex","reservedNames","fullPath","path","getValidProjectName","initialName","attempts","maxAttempts","projectName","validation","undefined","checkExistingProject","projectNameArg","packageJsonPath","packageJsonExists","confirm","packageJson","JSON","MAIN_DEPENDENCIES","DEV_DEPENDENCIES","PACKAGES_TO_REMOVE","configGroups","updateFileIfNeeded","checkFn","updateFn","successMessage","alreadyUpdatedMessage","updatedContent","updatePostcssConfig","projectDir","postcssConfigPath","typeComment","updateLayoutFile","layoutPath","htmlTarget","newImports","result","updatePackageJson","updateNextConfig","nextConfigPath","optimizePackagesConfig","updatePageFile","pagePath","createConfigFiles","category","configs","Object","description","dir","installDependencies","allDevDependencies","cleanupPackages","dependencies","devDependencies","packagesToRemove","pkg","checkEnvironment","createNextProject","flags","createProjectCommand","Command","makeRegexPrefixesToRemove","prefixes","prefixPattern","RegExp","processExportPath","modulePath","regexPattern","processedPath","match","remainingPath","analyzeImports","indexFilePath","packageConfig","project","Project","sourceFile","imports","prefixesToRemove","exportDecl","moduleSpecifier","isExternal","parts","Boolean","directory","importPath","PackageConfigSchema","z","ScriptConfigSchema","cachedConfig","loadConfigFile","configPath","configContent","config","getConfig","userConfig","merge","defaultConfig","getPackageConfig","packageName","configObj","customConfig","EXPORTS_ANALYSIS_DIR","EXPORTS_PREVIEW_FILE","EXPORTS_ANALYSIS_FILE","ENCODING","JSON_INDENT","dirPath","packageDir","outputDir","baseFilename","timestamp","Date","fileExists","readPackageJson","backupPackageJson","backupDir","baseName","backupPath","savePackageJson","saveJsonToFile","fileName","saveExportsAnalysis","analysis","saveExportsPreview","exports","formatOutputPath","pattern","dirPart","generateExports","existingExports","exportPath","esmOutput","cjsOutput","typesOutput","typesCjsOutput","DEFAULT_IGNORE_PATTERN","findAllPackages","glob","processPackage","options","srcIndexPath","newExports","currentExportsCount","newExportsCount","updatedPackageJson","processAllPackages","packageJsonPaths","successCount","skipCount","errorCount","updateExportsCommand","processorOptions","getPackageInfo","__filename","fileURLToPath","__dirname","dirname","readFileSync","getPackageVersion","main","program"],"mappings":";;;;;;;;;;;AAUO,MAAMA,KAAKC,kDAAAA,CAAAA,UAAAA,CAAAA,eAAwB,CAAC;IACzC,OAAOC,QAAQ,KAAK;IACpB,QAAQA,QAAQ,MAAM;AACxB;AAQO,SAASC,aAAOC,QAAgB;IACrC,OAAO,IAAIC,QAAQ,CAACC;QAClBN,GAAG,QAAQ,CAACI,UAAU,CAACG;YACrBD,QAAQC,OAAO,IAAI;QACrB;IACF;AACF;AAQO,SAASC,WAAWC,OAAe;IACxCC,IAAAA,wDAAAA,QAAAA,EAASD,SAAS;QAAE,OAAO;IAAU;AACvC;AAKO,MAAME,YAAY;IAIvB,QAAOC,QAAgB;QACrB,OAAOC,4CAAAA,CAAAA,UAAAA,CAAAA,UAAa,CAACD;IACvB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f;AACF;AClBK,SAAS6K;IACd,MAAMC,aAAaC,IAAAA,8CAAAA,aAAAA,EAAc,YAAY,GAAG;IAChD,MAAMC,YAAYC,IAAAA,+CAAAA,OAAAA,EAAQH;IAC1B,MAAM7I,kBAAkB7B,IAAAA,+CAAAA,OAAAA,EAAQ4K,WAAW;IAE3C,OAAO3I,KAAK,KAAK,CAAC6I,IAAAA,6CAAAA,YAAAA,EAAajJ,iBAAiB;AAClD;AAEO,SAASkJ;IACd,OAAON,iBAAiB,OAAO;AACjC;ACXA,SAASO;IACP,MAAMC,UAAU,IAAIrG,sCAAAA,OAAOA;IAE3BqG,QACG,IAAI,CAAC,YACL,WAAW,CAAC,sDACZ,OAAO,CAACF,qBAAqB,iBAAiB,uBAC9C,UAAU,CAACR,sBACX,UAAU,CAAC5F,sBACX,KAAK,CAAC/E,QAAQ,IAAI;AACvB;AAEAoL"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codefast/cli",
|
|
3
|
-
"version": "0.3.1-canary.
|
|
3
|
+
"version": "0.3.1-canary.13",
|
|
4
4
|
"description": "CodeFast CLI - A development toolkit for CodeFast.",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/codefastlabs/codefast/issues"
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
"eslint": "^9.25.0",
|
|
39
39
|
"ts-node": "^10.9.2",
|
|
40
40
|
"typescript": "^5.8.3",
|
|
41
|
-
"@codefast/eslint-config": "0.3.1-canary.
|
|
42
|
-
"@codefast/typescript-config": "0.3.1-canary.
|
|
41
|
+
"@codefast/eslint-config": "0.3.1-canary.13",
|
|
42
|
+
"@codefast/typescript-config": "0.3.1-canary.13"
|
|
43
43
|
},
|
|
44
44
|
"publishConfig": {
|
|
45
45
|
"access": "public"
|