@prmvx/frontend-forge 0.1.0 → 0.1.1
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/README.md +2 -2
- package/dist/cli.js +2 -2
- package/dist/cli.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -38,13 +38,13 @@ Instead of creating another starter project, Frontend Forge upgrades your existi
|
|
|
38
38
|
### Run directly
|
|
39
39
|
|
|
40
40
|
```bash
|
|
41
|
-
npx @
|
|
41
|
+
npx @prmvx/frontend-forge init
|
|
42
42
|
```
|
|
43
43
|
|
|
44
44
|
or install globally
|
|
45
45
|
|
|
46
46
|
```bash
|
|
47
|
-
npm install -g @
|
|
47
|
+
npm install -g @prmvx/frontend-forge
|
|
48
48
|
```
|
|
49
49
|
|
|
50
50
|
then
|
package/dist/cli.js
CHANGED
|
@@ -134,7 +134,7 @@ async function getAllFiles(dir) {
|
|
|
134
134
|
return files;
|
|
135
135
|
}
|
|
136
136
|
async function copyTemplateDir(relativePath, options) {
|
|
137
|
-
const templatePath = path3.resolve(__dirname, "
|
|
137
|
+
const templatePath = path3.resolve(__dirname, "templates", relativePath);
|
|
138
138
|
const targetPath = process.cwd();
|
|
139
139
|
const files = await getAllFiles(templatePath);
|
|
140
140
|
const createdDirs = /* @__PURE__ */ new Set();
|
|
@@ -292,7 +292,7 @@ var __dirname2 = path7.dirname(__filename2);
|
|
|
292
292
|
async function readModule(moduleName) {
|
|
293
293
|
const modulePath = path7.resolve(
|
|
294
294
|
__dirname2,
|
|
295
|
-
"
|
|
295
|
+
"templates/modules",
|
|
296
296
|
moduleName,
|
|
297
297
|
"module.ts"
|
|
298
298
|
);
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/cli.ts","../src/commands/init.ts","../src/utils/detectProject.ts","../src/utils/detectProjectStructure.ts","../src/utils/copyArchitecture.ts","../src/utils/copyTemplate.ts","../src/utils/resolveTemplatePath.ts","../src/utils/copyModules.ts","../src/utils/extendProjectFiles.ts","../src/utils/readModule.ts","../src/utils/installDependencies.ts","../src/utils/detectPackageManager.ts","../src/utils/logger.ts","../src/prompts/architecture.ts","../src/config/architectures.ts","../src/prompts/modules.ts","../src/config/modules.ts","../src/prompts/packageManager.ts"],"sourcesContent":["#!/usr/bin/env node\r\n\r\nimport { Command } from \"commander\";\r\nimport { initCommand } from \"./commands/init.js\";\r\n\r\nconst program = new Command();\r\n\r\nprogram\r\n .name(\"frontend-init\")\r\n .description(\"Initialize frontend architecture\")\r\n .version(\"1.0.0\");\r\n\r\nprogram.command(\"init\").action(initCommand);\r\n\r\nprogram.parse();","import fs from \"fs\";\r\nimport path from \"path\";\r\nimport { fileURLToPath } from \"url\";\r\nimport { intro, isCancel, cancel, spinner } from \"@clack/prompts\";\r\nimport { validateProject } from \"../utils/detectProject.js\";\r\nimport { detectProjectStructure } from \"../utils/detectProjectStructure.js\";\r\nimport { copyArchitecture } from \"../utils/copyArchitecture.js\";\r\nimport { copyModules } from \"../utils/copyModules.js\";\r\nimport { extendProjectFiles } from \"../utils/extendProjectFiles.js\";\r\nimport { readModule } from \"../utils/readModule.js\";\r\nimport { installDependencies } from \"../utils/installDependencies.js\";\r\nimport {\r\n detectPackageManager,\r\n validatePackageManager,\r\n} from \"../utils/detectPackageManager.js\";\r\nimport { logger } from \"../utils/logger.js\";\r\nimport { selectArchitecture } from \"../prompts/architecture.js\";\r\nimport { selectModules } from \"../prompts/modules.js\";\r\nimport { selectPackageManager } from \"../prompts/packageManager.js\";\r\nimport { architectures } from \"../config/architectures.js\";\r\nimport { modules } from \"../config/modules.js\";\r\nimport type { PackageManager } from \"../types/package-manager.js\";\r\n\r\nfunction getVersion(): string {\r\n const dir = path.dirname(fileURLToPath(import.meta.url));\r\n const pkg = JSON.parse(\r\n fs.readFileSync(path.join(dir, \"../package.json\"), \"utf-8\")\r\n );\r\n return pkg.version;\r\n}\r\n\r\nfunction getArchitectureLabel(value: string): string {\r\n return architectures.find((item) => item.value === value)?.label ?? value;\r\n}\r\n\r\nfunction getModuleLabel(value: string): string {\r\n return modules.find((item) => item.value === value)?.label ?? value;\r\n}\r\n\r\nfunction printSummary(options: {\r\n architecture: string;\r\n selectedModules: string[];\r\n packageManager: PackageManager;\r\n dependenciesInstalled: number;\r\n filesCreated: number;\r\n filesSkipped: number;\r\n}) {\r\n console.log(\"\");\r\n logger.success(\"Project initialized successfully.\");\r\n console.log(\"\");\r\n console.log(\"Framework:\");\r\n console.log(\"Next.js\");\r\n console.log(\"\");\r\n console.log(\"Architecture:\");\r\n console.log(getArchitectureLabel(options.architecture));\r\n console.log(\"\");\r\n console.log(\"Modules:\");\r\n for (const module of options.selectedModules) {\r\n console.log(getModuleLabel(module));\r\n }\r\n console.log(\"\");\r\n console.log(\"Package Manager:\");\r\n console.log(options.packageManager);\r\n console.log(\"\");\r\n console.log(\"Dependencies Installed:\");\r\n console.log(options.dependenciesInstalled);\r\n console.log(\"\");\r\n console.log(\"Files Created:\");\r\n console.log(options.filesCreated);\r\n console.log(\"\");\r\n console.log(\"Files Skipped:\");\r\n console.log(options.filesSkipped);\r\n console.log(\"\");\r\n console.log(\"Done.\");\r\n console.log(\"\");\r\n logger.success(\"Happy Coding!\");\r\n}\r\n\r\nexport async function initCommand() {\r\n intro(\"Frontend Init\");\r\n logger.info(\"Production Ready Frontend Starter\");\r\n logger.info(`Version ${getVersion()}`);\r\n\r\n const detectSpinner = spinner();\r\n detectSpinner.start(\"Detecting project...\");\r\n\r\n try {\r\n validateProject();\r\n detectSpinner.stop(\"Success\");\r\n } catch (error) {\r\n detectSpinner.stop(\"Failed\");\r\n logger.error(\r\n error instanceof Error ? error.message : \"Project validation failed.\"\r\n );\r\n return;\r\n }\r\n\r\n const architectureSpinner = spinner();\r\n architectureSpinner.start(\"Selecting architecture...\");\r\n\r\n const architecture = await selectArchitecture();\r\n\r\n if (isCancel(architecture) || !architecture) {\r\n architectureSpinner.stop(\"Failed\");\r\n cancel(\"Operation cancelled.\");\r\n return;\r\n }\r\n\r\n architectureSpinner.stop(\"Success\");\r\n\r\n const modulesSpinner = spinner();\r\n modulesSpinner.start(\"Selecting modules...\");\r\n\r\n const selectedModules = await selectModules();\r\n\r\n if (isCancel(selectedModules) || selectedModules.length === 0) {\r\n modulesSpinner.stop(\"Failed\");\r\n cancel(\"Operation cancelled.\");\r\n return;\r\n }\r\n\r\n modulesSpinner.stop(\"Success\");\r\n\r\n const structure = detectProjectStructure();\r\n\r\n const moduleDefinitions = await Promise.all(\r\n selectedModules.map((module) => readModule(module))\r\n );\r\n\r\n const detected = detectPackageManager();\r\n let packageManager: PackageManager;\r\n\r\n if (detected) {\r\n packageManager = detected;\r\n logger.info(`Detected: ${packageManager}`);\r\n } else {\r\n const selected = await selectPackageManager();\r\n\r\n if (isCancel(selected) || !selected) {\r\n cancel(\"Operation cancelled.\");\r\n return;\r\n }\r\n\r\n packageManager = selected;\r\n logger.info(`Using ${packageManager}`);\r\n }\r\n\r\n try {\r\n await validatePackageManager(packageManager);\r\n } catch (error) {\r\n logger.error(\r\n error instanceof Error ? error.message : \"Package manager not available.\"\r\n );\r\n return;\r\n }\r\n\r\n let dependenciesInstalled = 0;\r\n const installSpinner = spinner();\r\n installSpinner.start(\"Installing dependencies...\");\r\n\r\n try {\r\n dependenciesInstalled = await installDependencies(\r\n moduleDefinitions,\r\n packageManager\r\n );\r\n installSpinner.stop(\"Success\");\r\n } catch (error) {\r\n installSpinner.stop(\"Failed\");\r\n logger.error(\r\n error instanceof Error\r\n ? error.message\r\n : \"Failed to install dependencies.\\nPlease resolve the issue and run the command again.\"\r\n );\r\n return;\r\n }\r\n\r\n const architectureCopySpinner = spinner();\r\n architectureCopySpinner.start(\"Copying architecture...\");\r\n\r\n let architectureStats;\r\n\r\n try {\r\n architectureStats = await copyArchitecture(\r\n \"next\",\r\n architecture as string,\r\n structure\r\n );\r\n architectureCopySpinner.stop(\"Success\");\r\n } catch (error) {\r\n architectureCopySpinner.stop(\"Failed\");\r\n logger.error(\r\n error instanceof Error ? error.message : \"Failed to copy architecture.\"\r\n );\r\n return;\r\n }\r\n\r\n const modulesCopySpinner = spinner();\r\n modulesCopySpinner.start(\"Copying modules...\");\r\n\r\n let moduleStats;\r\n\r\n try {\r\n moduleStats = await copyModules(\r\n selectedModules as string[],\r\n structure,\r\n architecture as string\r\n );\r\n modulesCopySpinner.stop(\"Success\");\r\n } catch (error) {\r\n modulesCopySpinner.stop(\"Failed\");\r\n logger.error(\r\n error instanceof Error ? error.message : \"Failed to copy modules.\"\r\n );\r\n return;\r\n }\r\n\r\n try {\r\n await extendProjectFiles(architecture as string, structure);\r\n } catch (error) {\r\n logger.error(\r\n error instanceof Error ? error.message : \"Failed to extend project files.\"\r\n );\r\n return;\r\n }\r\n\r\n const finishingSpinner = spinner();\r\n finishingSpinner.start(\"Finishing...\");\r\n\r\n printSummary({\r\n architecture: architecture as string,\r\n selectedModules: selectedModules as string[],\r\n packageManager,\r\n dependenciesInstalled,\r\n filesCreated: architectureStats.created + moduleStats.created,\r\n filesSkipped: architectureStats.skipped + moduleStats.skipped,\r\n });\r\n\r\n finishingSpinner.stop(\"Success\");\r\n}\r\n","import fs from \"fs\";\r\n\r\nexport function validateProject() {\r\n if (!fs.existsSync(\"package.json\")) {\r\n throw new Error(\r\n \"Could not find package.json.\\nPlease run this command inside an existing Next.js project.\"\r\n );\r\n }\r\n\r\n const pkg = JSON.parse(\r\n fs.readFileSync(\"package.json\", \"utf-8\")\r\n );\r\n\r\n if (!pkg.dependencies?.next) {\r\n throw new Error(\r\n \"Next.js project not detected.\\nCurrent version only supports Next.js.\"\r\n );\r\n }\r\n}\r\n","import fs from \"fs\";\r\nimport path from \"path\";\r\n\r\nexport type ProjectStructure = {\r\n useSrc: boolean;\r\n root: string;\r\n appDir: string;\r\n};\r\n\r\nexport function detectProjectStructure(): ProjectStructure {\r\n const cwd = process.cwd();\r\n\r\n if (fs.existsSync(path.join(cwd, \"app\"))) {\r\n return {\r\n useSrc: false,\r\n root: \"\",\r\n appDir: \"app\",\r\n };\r\n }\r\n\r\n if (fs.existsSync(path.join(cwd, \"src\", \"app\"))) {\r\n return {\r\n useSrc: true,\r\n root: \"src\",\r\n appDir: \"src/app\",\r\n };\r\n }\r\n\r\n if (fs.existsSync(path.join(cwd, \"src\"))) {\r\n return {\r\n useSrc: true,\r\n root: \"src\",\r\n appDir: \"src/app\",\r\n };\r\n }\r\n\r\n return {\r\n useSrc: false,\r\n root: \"\",\r\n appDir: \"app\",\r\n };\r\n}\r\n","import path from \"path\";\r\nimport { copyTemplateDir, type CopyStats } from \"./copyTemplate.js\";\r\nimport type { ProjectStructure } from \"./detectProjectStructure.js\";\r\n\r\nexport async function copyArchitecture(\r\n framework: string,\r\n architecture: string,\r\n structure: ProjectStructure\r\n): Promise<CopyStats> {\r\n return copyTemplateDir(\r\n path.join(\"architectures\", framework, architecture),\r\n { structure, architecture }\r\n );\r\n}\r\n","import fs from \"fs-extra\";\r\nimport path from \"path\";\r\nimport { fileURLToPath } from \"url\";\r\nimport type { ProjectStructure } from \"./detectProjectStructure.js\";\r\nimport { resolveTemplatePath, shouldSkipTemplatePath } from \"./resolveTemplatePath.js\";\r\n\r\nconst __filename = fileURLToPath(import.meta.url);\r\nconst __dirname = path.dirname(__filename);\r\n\r\nexport type CopyStats = {\r\n created: number;\r\n skipped: number;\r\n failed: number;\r\n};\r\n\r\ntype CopyOptions = {\r\n exclude?: (filePath: string) => boolean;\r\n structure: ProjectStructure;\r\n architecture?: string;\r\n remapCore?: boolean;\r\n};\r\n\r\nasync function getAllFiles(dir: string): Promise<string[]> {\r\n const entries = await fs.readdir(dir, { withFileTypes: true });\r\n const files: string[] = [];\r\n\r\n for (const entry of entries) {\r\n const fullPath = path.join(dir, entry.name);\r\n\r\n if (entry.isDirectory()) {\r\n files.push(...(await getAllFiles(fullPath)));\r\n } else if (entry.isFile()) {\r\n files.push(fullPath);\r\n }\r\n }\r\n\r\n return files;\r\n}\r\n\r\nexport async function copyTemplateDir(\r\n relativePath: string,\r\n options: CopyOptions\r\n): Promise<CopyStats> {\r\n const templatePath = path.resolve(__dirname, \"../templates\", relativePath);\r\n const targetPath = process.cwd();\r\n const files = await getAllFiles(templatePath);\r\n const createdDirs = new Set<string>();\r\n\r\n let created = 0;\r\n let skipped = 0;\r\n let failed = 0;\r\n\r\n for (const file of files) {\r\n if (options.exclude?.(file)) {\r\n continue;\r\n }\r\n\r\n const relativeFile = path.relative(templatePath, file);\r\n\r\n if (shouldSkipTemplatePath(relativeFile)) {\r\n continue;\r\n }\r\n\r\n const destRelative = resolveTemplatePath(relativeFile, {\r\n structure: options.structure,\r\n architecture: options.architecture,\r\n remapCore: options.remapCore,\r\n });\r\n\r\n if (!destRelative) {\r\n continue;\r\n }\r\n\r\n const dest = path.join(targetPath, destRelative);\r\n const destDir = path.dirname(dest);\r\n\r\n try {\r\n if (await fs.pathExists(dest)) {\r\n skipped++;\r\n continue;\r\n }\r\n\r\n if (!createdDirs.has(destDir)) {\r\n await fs.ensureDir(destDir);\r\n createdDirs.add(destDir);\r\n }\r\n\r\n await fs.copy(file, dest);\r\n created++;\r\n } catch {\r\n failed++;\r\n }\r\n }\r\n\r\n return { created, skipped, failed };\r\n}\r\n","import path from \"path\";\r\nimport type { ProjectStructure } from \"./detectProjectStructure.js\";\r\n\r\nfunction normalizePath(relativePath: string): string {\r\n return relativePath.split(path.sep).join(\"/\");\r\n}\r\n\r\nfunction remapCoreModulePath(\r\n normalizedPath: string,\r\n architecture: string\r\n): string {\r\n if (architecture === \"feature\") {\r\n if (normalizedPath.startsWith(\"src/components/\")) {\r\n return normalizedPath.replace(\r\n \"src/components/\",\r\n \"src/shared/components/\"\r\n );\r\n }\r\n\r\n if (normalizedPath.startsWith(\"src/hooks/\")) {\r\n return normalizedPath.replace(\"src/hooks/\", \"src/shared/hooks/\");\r\n }\r\n\r\n if (normalizedPath.startsWith(\"src/utils/\")) {\r\n return normalizedPath.replace(\"src/utils/\", \"src/shared/utils/\");\r\n }\r\n\r\n if (normalizedPath.startsWith(\"src/providers/\")) {\r\n return normalizedPath.replace(\"src/providers/\", \"src/shared/providers/\");\r\n }\r\n\r\n if (normalizedPath.startsWith(\"src/services/\")) {\r\n return normalizedPath.replace(\"src/services/\", \"src/features/home/services/\");\r\n }\r\n\r\n if (normalizedPath.startsWith(\"src/constants/\")) {\r\n return normalizedPath.replace(\"src/constants/\", \"src/features/home/constants/\");\r\n }\r\n }\r\n\r\n return normalizedPath;\r\n}\r\n\r\ntype ResolveOptions = {\r\n structure: ProjectStructure;\r\n architecture?: string;\r\n remapCore?: boolean;\r\n};\r\n\r\nexport function resolveTemplatePath(\r\n relativePath: string,\r\n options: ResolveOptions\r\n): string | null {\r\n let normalized = normalizePath(relativePath);\r\n\r\n if (normalized === \"src/app\" || normalized.startsWith(\"src/app/\")) {\r\n return null;\r\n }\r\n\r\n if (options.remapCore && options.architecture) {\r\n normalized = remapCoreModulePath(normalized, options.architecture);\r\n }\r\n\r\n if (!options.structure.useSrc && normalized.startsWith(\"src/\")) {\r\n normalized = normalized.slice(4);\r\n }\r\n\r\n return normalized.split(\"/\").join(path.sep);\r\n}\r\n\r\nexport function shouldSkipTemplatePath(relativePath: string): boolean {\r\n const normalized = normalizePath(relativePath);\r\n\r\n return normalized === \"src/app\" || normalized.startsWith(\"src/app/\");\r\n}\r\n","import path from \"path\";\r\nimport { copyTemplateDir, type CopyStats } from \"./copyTemplate.js\";\r\nimport type { ProjectStructure } from \"./detectProjectStructure.js\";\r\n\r\nexport async function copyModules(\r\n modules: string[],\r\n structure: ProjectStructure,\r\n architecture: string\r\n): Promise<CopyStats> {\r\n const stats: CopyStats = { created: 0, skipped: 0, failed: 0 };\r\n\r\n for (const module of modules) {\r\n const result = await copyTemplateDir(path.join(\"modules\", module), {\r\n structure,\r\n architecture,\r\n remapCore: module === \"core\",\r\n exclude: (filePath) => filePath.endsWith(\"module.ts\"),\r\n });\r\n\r\n stats.created += result.created;\r\n stats.skipped += result.skipped;\r\n stats.failed += result.failed;\r\n }\r\n\r\n return stats;\r\n}\r\n","import fs from \"fs-extra\";\r\nimport path from \"path\";\r\nimport type { ProjectStructure } from \"./detectProjectStructure.js\";\r\n\r\nfunction getAppFilePath(\r\n structure: ProjectStructure,\r\n fileName: string\r\n): string {\r\n return path.join(process.cwd(), structure.appDir, fileName);\r\n}\r\n\r\nfunction getProvidersImport(architecture: string): string {\r\n if (architecture === \"feature\") {\r\n return \"@/shared/providers\";\r\n }\r\n\r\n return \"@/providers\";\r\n}\r\n\r\nfunction getPageImport(architecture: string): string {\r\n if (architecture === \"feature\") {\r\n return \"@/features/home/components/HomePage\";\r\n }\r\n\r\n return \"@/components/home/HomeView\";\r\n}\r\n\r\nfunction getPageComponent(architecture: string): string {\r\n if (architecture === \"feature\") {\r\n return \"HomePage\";\r\n }\r\n\r\n return \"HomeView\";\r\n}\r\n\r\nexport async function extendProjectFiles(\r\n architecture: string,\r\n structure: ProjectStructure\r\n) {\r\n await extendLayout(structure, architecture);\r\n await extendPage(structure, architecture);\r\n}\r\n\r\nasync function extendLayout(\r\n structure: ProjectStructure,\r\n architecture: string\r\n) {\r\n const layoutPath = getAppFilePath(structure, \"layout.tsx\");\r\n\r\n if (!(await fs.pathExists(layoutPath))) {\r\n return;\r\n }\r\n\r\n const content = await fs.readFile(layoutPath, \"utf-8\");\r\n const providersImport = getProvidersImport(architecture);\r\n\r\n if (content.includes(\"<Providers>\")) {\r\n return;\r\n }\r\n\r\n let updated = content;\r\n\r\n if (\r\n !content.includes(providersImport) &&\r\n !content.includes('from \"@/providers\"') &&\r\n !content.includes(\"from '@/providers'\")\r\n ) {\r\n const importLine = `import { Providers } from \"${providersImport}\";\\n`;\r\n const lastImportIndex = updated.lastIndexOf(\"import \");\r\n\r\n if (lastImportIndex !== -1) {\r\n const insertAt = updated.indexOf(\"\\n\", lastImportIndex) + 1;\r\n updated = updated.slice(0, insertAt) + importLine + updated.slice(insertAt);\r\n } else {\r\n updated = importLine + updated;\r\n }\r\n }\r\n\r\n updated = updated.replace(/(<body[^>]*>)/, \"$1\\n <Providers>\");\r\n updated = updated.replace(\"</body>\", \" </Providers>\\n </body>\");\r\n\r\n if (updated !== content) {\r\n await fs.writeFile(layoutPath, updated);\r\n }\r\n}\r\n\r\nasync function extendPage(\r\n structure: ProjectStructure,\r\n architecture: string\r\n) {\r\n const pagePath = getAppFilePath(structure, \"page.tsx\");\r\n\r\n if (!(await fs.pathExists(pagePath))) {\r\n return;\r\n }\r\n\r\n const content = await fs.readFile(pagePath, \"utf-8\");\r\n const pageImport = getPageImport(architecture);\r\n const pageComponent = getPageComponent(architecture);\r\n\r\n if (content.includes(pageComponent)) {\r\n return;\r\n }\r\n\r\n const isDefaultTemplate =\r\n content.includes(\"Get started by editing\") ||\r\n content.includes(\"next.svg\") ||\r\n content.includes(\"vercel.svg\");\r\n\r\n if (!isDefaultTemplate) {\r\n return;\r\n }\r\n\r\n const updated = `import { ${pageComponent} } from \"${pageImport}\";\r\n\r\nexport default function Home() {\r\n return <${pageComponent} />;\r\n}\r\n`;\r\n\r\n await fs.writeFile(pagePath, updated);\r\n}\r\n","import fs from \"fs-extra\";\r\nimport path from \"path\";\r\nimport { fileURLToPath } from \"url\";\r\nimport type { ModuleDefinition } from \"../types/module.js\";\r\n\r\nconst __filename = fileURLToPath(import.meta.url);\r\nconst __dirname = path.dirname(__filename);\r\n\r\nexport async function readModule(moduleName: string): Promise<ModuleDefinition> {\r\n const modulePath = path.resolve(\r\n __dirname,\r\n \"../templates/modules\",\r\n moduleName,\r\n \"module.ts\"\r\n );\r\n\r\n const content = await fs.readFile(modulePath, \"utf-8\");\r\n const dataUrl = `data:text/javascript;charset=utf-8,${encodeURIComponent(content)}`;\r\n const { default: moduleDef } = await import(dataUrl);\r\n\r\n return moduleDef as ModuleDefinition;\r\n}\r\n","import { execa } from \"execa\";\r\nimport type { ModuleDefinition } from \"../types/module.js\";\r\nimport type { PackageManager } from \"../types/package-manager.js\";\r\n\r\nconst installCommands: Record<\r\n PackageManager,\r\n { command: string; dependencies: string[]; devDependencies: string[] }\r\n> = {\r\n npm: { command: \"npm\", dependencies: [\"install\"], devDependencies: [\"install\", \"-D\"] },\r\n pnpm: { command: \"pnpm\", dependencies: [\"add\"], devDependencies: [\"add\", \"-D\"] },\r\n yarn: { command: \"yarn\", dependencies: [\"add\"], devDependencies: [\"add\", \"-D\"] },\r\n bun: { command: \"bun\", dependencies: [\"add\"], devDependencies: [\"add\", \"-d\"] },\r\n};\r\n\r\nexport async function installDependencies(\r\n modules: ModuleDefinition[],\r\n packageManager: PackageManager\r\n): Promise<number> {\r\n const dependencies = [\r\n ...new Set(modules.flatMap((module) => module.dependencies)),\r\n ];\r\n const devDependencies = [\r\n ...new Set(modules.flatMap((module) => module.devDependencies)),\r\n ];\r\n\r\n const totalCount = dependencies.length + devDependencies.length;\r\n\r\n if (totalCount === 0) {\r\n return 0;\r\n }\r\n\r\n const { command, dependencies: depsArgs, devDependencies: devArgs } =\r\n installCommands[packageManager];\r\n\r\n try {\r\n if (dependencies.length > 0) {\r\n await execa(command, [...depsArgs, ...dependencies], {\r\n stdio: \"inherit\",\r\n cwd: process.cwd(),\r\n });\r\n }\r\n\r\n if (devDependencies.length > 0) {\r\n await execa(command, [...devArgs, ...devDependencies], {\r\n stdio: \"inherit\",\r\n cwd: process.cwd(),\r\n });\r\n }\r\n\r\n return totalCount;\r\n } catch {\r\n throw new Error(\r\n \"Failed to install dependencies.\\nPlease resolve the issue and run the command again.\"\r\n );\r\n }\r\n}\r\n","import fs from \"fs\";\r\nimport path from \"path\";\r\nimport { execa } from \"execa\";\r\nimport type { PackageManager } from \"../types/package-manager.js\";\r\n\r\nexport function detectPackageManager(): PackageManager | null {\r\n const root = process.cwd();\r\n\r\n if (fs.existsSync(path.join(root, \"pnpm-lock.yaml\"))) {\r\n return \"pnpm\";\r\n }\r\n\r\n if (fs.existsSync(path.join(root, \"yarn.lock\"))) {\r\n return \"yarn\";\r\n }\r\n\r\n if (\r\n fs.existsSync(path.join(root, \"bun.lockb\")) ||\r\n fs.existsSync(path.join(root, \"bun.lock\"))\r\n ) {\r\n return \"bun\";\r\n }\r\n\r\n if (fs.existsSync(path.join(root, \"package-lock.json\"))) {\r\n return \"npm\";\r\n }\r\n\r\n return null;\r\n}\r\n\r\nexport async function validatePackageManager(packageManager: PackageManager) {\r\n const result = await execa(packageManager, [\"--version\"], {\r\n reject: false,\r\n });\r\n\r\n if (result.exitCode !== 0) {\r\n throw new Error(\r\n `${packageManager} is not available.\\nPlease install ${packageManager} and try again.`\r\n );\r\n }\r\n}\r\n","import pc from \"picocolors\";\r\n\r\nexport const logger = {\r\n success(message: string) {\r\n console.log(`${pc.green(\"✓\")} ${message}`);\r\n },\r\n\r\n info(message: string) {\r\n console.log(`${pc.cyan(\"ℹ\")} ${message}`);\r\n },\r\n\r\n warning(message: string) {\r\n console.log(`${pc.yellow(\"⚠\")} ${message}`);\r\n },\r\n\r\n error(message: string) {\r\n for (const line of message.split(\"\\n\")) {\r\n console.log(`${pc.red(\"✖\")} ${line}`);\r\n }\r\n },\r\n};\r\n","import { select } from \"@clack/prompts\";\r\nimport { architectures } from \"../config/architectures.js\";\r\n\r\nexport async function selectArchitecture() {\r\n return await select({\r\n message: \"Choose project architecture\",\r\n options: architectures.map((item) => ({\r\n value: item.value,\r\n label: item.label,\r\n hint: item.hint,\r\n })),\r\n });\r\n}","export const architectures = [\r\n {\r\n value: \"standard\",\r\n label: \"Standard\",\r\n hint: \"Simple folder structure\",\r\n },\r\n {\r\n value: \"enterprise\",\r\n label: \"Enterprise\",\r\n hint: \"Scalable enterprise architecture\",\r\n },\r\n {\r\n value: \"feature\",\r\n label: \"Feature Based\",\r\n hint: \"Organize code by feature\",\r\n },\r\n] as const;","import { multiselect } from \"@clack/prompts\";\r\nimport { modules } from \"../config/modules.js\";\r\n\r\nexport async function selectModules() {\r\n return await multiselect({\r\n message: \"Select modules\",\r\n options: modules.map((item) => ({\r\n value: item.value,\r\n label: item.label,\r\n hint: item.hint,\r\n })),\r\n required: true,\r\n });\r\n}\r\n","export const modules = [\r\n {\r\n value: \"core\",\r\n label: \"Core\",\r\n hint: \"Basic starter files\",\r\n },\r\n {\r\n value: \"axios\",\r\n label: \"Axios\",\r\n hint: \"API Client\",\r\n },\r\n {\r\n value: \"zustand\",\r\n label: \"Zustand\",\r\n hint: \"State Management\",\r\n },\r\n];\r\n","import { select } from \"@clack/prompts\";\r\nimport type { PackageManager } from \"../types/package-manager.js\";\r\n\r\nexport async function selectPackageManager() {\r\n return await select<PackageManager>({\r\n message: \"Choose package manager\",\r\n options: [\r\n { value: \"npm\", label: \"npm\" },\r\n { value: \"pnpm\", label: \"pnpm\" },\r\n { value: \"yarn\", label: \"yarn\" },\r\n { value: \"bun\", label: \"bun\" },\r\n ],\r\n initialValue: \"npm\",\r\n });\r\n}\r\n"],"mappings":";;;AAEA,SAAS,eAAe;;;ACFxB,OAAOA,SAAQ;AACf,OAAOC,WAAU;AACjB,SAAS,iBAAAC,sBAAqB;AAC9B,SAAS,OAAO,UAAU,QAAQ,eAAe;;;ACHjD,OAAO,QAAQ;AAER,SAAS,kBAAkB;AAChC,MAAI,CAAC,GAAG,WAAW,cAAc,GAAG;AAClC,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEA,QAAM,MAAM,KAAK;AAAA,IACf,GAAG,aAAa,gBAAgB,OAAO;AAAA,EACzC;AAEA,MAAI,CAAC,IAAI,cAAc,MAAM;AAC3B,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AACF;;;AClBA,OAAOC,SAAQ;AACf,OAAO,UAAU;AAQV,SAAS,yBAA2C;AACzD,QAAM,MAAM,QAAQ,IAAI;AAExB,MAAIA,IAAG,WAAW,KAAK,KAAK,KAAK,KAAK,CAAC,GAAG;AACxC,WAAO;AAAA,MACL,QAAQ;AAAA,MACR,MAAM;AAAA,MACN,QAAQ;AAAA,IACV;AAAA,EACF;AAEA,MAAIA,IAAG,WAAW,KAAK,K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,MACL,iBAAiB,QAAQ,MAAM,UAAU;AAAA,IAC3C;AACA;AAAA,EACF;AAEA,QAAM,mBAAmB,QAAQ;AACjC,mBAAiB,MAAM,cAAc;AAErC,eAAa;AAAA,IACX;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,cAAc,kBAAkB,UAAU,YAAY;AAAA,IACtD,cAAc,kBAAkB,UAAU,YAAY;AAAA,EACxD,CAAC;AAED,mBAAiB,KAAK,SAAS;AACjC;;;ADzOA,IAAM,UAAU,IAAI,QAAQ;AAE5B,QACG,KAAK,eAAe,EACpB,YAAY,kCAAkC,EAC9C,QAAQ,OAAO;AAElB,QAAQ,QAAQ,MAAM,EAAE,OAAO,WAAW;AAE1C,QAAQ,MAAM;","names":["fs","path","fileURLToPath","fs","path","fs","path","path","path","fs","path","path","modules","path","fs","path","fs","path","fileURLToPath","__filename","__dirname","modules","fs","path","execa","select","path","fileURLToPath","fs"]}
|
|
1
|
+
{"version":3,"sources":["../src/cli.ts","../src/commands/init.ts","../src/utils/detectProject.ts","../src/utils/detectProjectStructure.ts","../src/utils/copyArchitecture.ts","../src/utils/copyTemplate.ts","../src/utils/resolveTemplatePath.ts","../src/utils/copyModules.ts","../src/utils/extendProjectFiles.ts","../src/utils/readModule.ts","../src/utils/installDependencies.ts","../src/utils/detectPackageManager.ts","../src/utils/logger.ts","../src/prompts/architecture.ts","../src/config/architectures.ts","../src/prompts/modules.ts","../src/config/modules.ts","../src/prompts/packageManager.ts"],"sourcesContent":["#!/usr/bin/env node\r\n\r\nimport { Command } from \"commander\";\r\nimport { initCommand } from \"./commands/init.js\";\r\n\r\nconst program = new Command();\r\n\r\nprogram\r\n .name(\"frontend-init\")\r\n .description(\"Initialize frontend architecture\")\r\n .version(\"1.0.0\");\r\n\r\nprogram.command(\"init\").action(initCommand);\r\n\r\nprogram.parse();","import fs from \"fs\";\r\nimport path from \"path\";\r\nimport { fileURLToPath } from \"url\";\r\nimport { intro, isCancel, cancel, spinner } from \"@clack/prompts\";\r\nimport { validateProject } from \"../utils/detectProject.js\";\r\nimport { detectProjectStructure } from \"../utils/detectProjectStructure.js\";\r\nimport { copyArchitecture } from \"../utils/copyArchitecture.js\";\r\nimport { copyModules } from \"../utils/copyModules.js\";\r\nimport { extendProjectFiles } from \"../utils/extendProjectFiles.js\";\r\nimport { readModule } from \"../utils/readModule.js\";\r\nimport { installDependencies } from \"../utils/installDependencies.js\";\r\nimport {\r\n detectPackageManager,\r\n validatePackageManager,\r\n} from \"../utils/detectPackageManager.js\";\r\nimport { logger } from \"../utils/logger.js\";\r\nimport { selectArchitecture } from \"../prompts/architecture.js\";\r\nimport { selectModules } from \"../prompts/modules.js\";\r\nimport { selectPackageManager } from \"../prompts/packageManager.js\";\r\nimport { architectures } from \"../config/architectures.js\";\r\nimport { modules } from \"../config/modules.js\";\r\nimport type { PackageManager } from \"../types/package-manager.js\";\r\n\r\nfunction getVersion(): string {\r\n const dir = path.dirname(fileURLToPath(import.meta.url));\r\n const pkg = JSON.parse(\r\n fs.readFileSync(path.join(dir, \"../package.json\"), \"utf-8\")\r\n );\r\n return pkg.version;\r\n}\r\n\r\nfunction getArchitectureLabel(value: string): string {\r\n return architectures.find((item) => item.value === value)?.label ?? value;\r\n}\r\n\r\nfunction getModuleLabel(value: string): string {\r\n return modules.find((item) => item.value === value)?.label ?? value;\r\n}\r\n\r\nfunction printSummary(options: {\r\n architecture: string;\r\n selectedModules: string[];\r\n packageManager: PackageManager;\r\n dependenciesInstalled: number;\r\n filesCreated: number;\r\n filesSkipped: number;\r\n}) {\r\n console.log(\"\");\r\n logger.success(\"Project initialized successfully.\");\r\n console.log(\"\");\r\n console.log(\"Framework:\");\r\n console.log(\"Next.js\");\r\n console.log(\"\");\r\n console.log(\"Architecture:\");\r\n console.log(getArchitectureLabel(options.architecture));\r\n console.log(\"\");\r\n console.log(\"Modules:\");\r\n for (const module of options.selectedModules) {\r\n console.log(getModuleLabel(module));\r\n }\r\n console.log(\"\");\r\n console.log(\"Package Manager:\");\r\n console.log(options.packageManager);\r\n console.log(\"\");\r\n console.log(\"Dependencies Installed:\");\r\n console.log(options.dependenciesInstalled);\r\n console.log(\"\");\r\n console.log(\"Files Created:\");\r\n console.log(options.filesCreated);\r\n console.log(\"\");\r\n console.log(\"Files Skipped:\");\r\n console.log(options.filesSkipped);\r\n console.log(\"\");\r\n console.log(\"Done.\");\r\n console.log(\"\");\r\n logger.success(\"Happy Coding!\");\r\n}\r\n\r\nexport async function initCommand() {\r\n intro(\"Frontend Init\");\r\n logger.info(\"Production Ready Frontend Starter\");\r\n logger.info(`Version ${getVersion()}`);\r\n\r\n const detectSpinner = spinner();\r\n detectSpinner.start(\"Detecting project...\");\r\n\r\n try {\r\n validateProject();\r\n detectSpinner.stop(\"Success\");\r\n } catch (error) {\r\n detectSpinner.stop(\"Failed\");\r\n logger.error(\r\n error instanceof Error ? error.message : \"Project validation failed.\"\r\n );\r\n return;\r\n }\r\n\r\n const architectureSpinner = spinner();\r\n architectureSpinner.start(\"Selecting architecture...\");\r\n\r\n const architecture = await selectArchitecture();\r\n\r\n if (isCancel(architecture) || !architecture) {\r\n architectureSpinner.stop(\"Failed\");\r\n cancel(\"Operation cancelled.\");\r\n return;\r\n }\r\n\r\n architectureSpinner.stop(\"Success\");\r\n\r\n const modulesSpinner = spinner();\r\n modulesSpinner.start(\"Selecting modules...\");\r\n\r\n const selectedModules = await selectModules();\r\n\r\n if (isCancel(selectedModules) || selectedModules.length === 0) {\r\n modulesSpinner.stop(\"Failed\");\r\n cancel(\"Operation cancelled.\");\r\n return;\r\n }\r\n\r\n modulesSpinner.stop(\"Success\");\r\n\r\n const structure = detectProjectStructure();\r\n\r\n const moduleDefinitions = await Promise.all(\r\n selectedModules.map((module) => readModule(module))\r\n );\r\n\r\n const detected = detectPackageManager();\r\n let packageManager: PackageManager;\r\n\r\n if (detected) {\r\n packageManager = detected;\r\n logger.info(`Detected: ${packageManager}`);\r\n } else {\r\n const selected = await selectPackageManager();\r\n\r\n if (isCancel(selected) || !selected) {\r\n cancel(\"Operation cancelled.\");\r\n return;\r\n }\r\n\r\n packageManager = selected;\r\n logger.info(`Using ${packageManager}`);\r\n }\r\n\r\n try {\r\n await validatePackageManager(packageManager);\r\n } catch (error) {\r\n logger.error(\r\n error instanceof Error ? error.message : \"Package manager not available.\"\r\n );\r\n return;\r\n }\r\n\r\n let dependenciesInstalled = 0;\r\n const installSpinner = spinner();\r\n installSpinner.start(\"Installing dependencies...\");\r\n\r\n try {\r\n dependenciesInstalled = await installDependencies(\r\n moduleDefinitions,\r\n packageManager\r\n );\r\n installSpinner.stop(\"Success\");\r\n } catch (error) {\r\n installSpinner.stop(\"Failed\");\r\n logger.error(\r\n error instanceof Error\r\n ? error.message\r\n : \"Failed to install dependencies.\\nPlease resolve the issue and run the command again.\"\r\n );\r\n return;\r\n }\r\n\r\n const architectureCopySpinner = spinner();\r\n architectureCopySpinner.start(\"Copying architecture...\");\r\n\r\n let architectureStats;\r\n\r\n try {\r\n architectureStats = await copyArchitecture(\r\n \"next\",\r\n architecture as string,\r\n structure\r\n );\r\n architectureCopySpinner.stop(\"Success\");\r\n } catch (error) {\r\n architectureCopySpinner.stop(\"Failed\");\r\n logger.error(\r\n error instanceof Error ? error.message : \"Failed to copy architecture.\"\r\n );\r\n return;\r\n }\r\n\r\n const modulesCopySpinner = spinner();\r\n modulesCopySpinner.start(\"Copying modules...\");\r\n\r\n let moduleStats;\r\n\r\n try {\r\n moduleStats = await copyModules(\r\n selectedModules as string[],\r\n structure,\r\n architecture as string\r\n );\r\n modulesCopySpinner.stop(\"Success\");\r\n } catch (error) {\r\n modulesCopySpinner.stop(\"Failed\");\r\n logger.error(\r\n error instanceof Error ? error.message : \"Failed to copy modules.\"\r\n );\r\n return;\r\n }\r\n\r\n try {\r\n await extendProjectFiles(architecture as string, structure);\r\n } catch (error) {\r\n logger.error(\r\n error instanceof Error ? error.message : \"Failed to extend project files.\"\r\n );\r\n return;\r\n }\r\n\r\n const finishingSpinner = spinner();\r\n finishingSpinner.start(\"Finishing...\");\r\n\r\n printSummary({\r\n architecture: architecture as string,\r\n selectedModules: selectedModules as string[],\r\n packageManager,\r\n dependenciesInstalled,\r\n filesCreated: architectureStats.created + moduleStats.created,\r\n filesSkipped: architectureStats.skipped + moduleStats.skipped,\r\n });\r\n\r\n finishingSpinner.stop(\"Success\");\r\n}\r\n","import fs from \"fs\";\r\n\r\nexport function validateProject() {\r\n if (!fs.existsSync(\"package.json\")) {\r\n throw new Error(\r\n \"Could not find package.json.\\nPlease run this command inside an existing Next.js project.\"\r\n );\r\n }\r\n\r\n const pkg = JSON.parse(\r\n fs.readFileSync(\"package.json\", \"utf-8\")\r\n );\r\n\r\n if (!pkg.dependencies?.next) {\r\n throw new Error(\r\n \"Next.js project not detected.\\nCurrent version only supports Next.js.\"\r\n );\r\n }\r\n}\r\n","import fs from \"fs\";\r\nimport path from \"path\";\r\n\r\nexport type ProjectStructure = {\r\n useSrc: boolean;\r\n root: string;\r\n appDir: string;\r\n};\r\n\r\nexport function detectProjectStructure(): ProjectStructure {\r\n const cwd = process.cwd();\r\n\r\n if (fs.existsSync(path.join(cwd, \"app\"))) {\r\n return {\r\n useSrc: false,\r\n root: \"\",\r\n appDir: \"app\",\r\n };\r\n }\r\n\r\n if (fs.existsSync(path.join(cwd, \"src\", \"app\"))) {\r\n return {\r\n useSrc: true,\r\n root: \"src\",\r\n appDir: \"src/app\",\r\n };\r\n }\r\n\r\n if (fs.existsSync(path.join(cwd, \"src\"))) {\r\n return {\r\n useSrc: true,\r\n root: \"src\",\r\n appDir: \"src/app\",\r\n };\r\n }\r\n\r\n return {\r\n useSrc: false,\r\n root: \"\",\r\n appDir: \"app\",\r\n };\r\n}\r\n","import path from \"path\";\r\nimport { copyTemplateDir, type CopyStats } from \"./copyTemplate.js\";\r\nimport type { ProjectStructure } from \"./detectProjectStructure.js\";\r\n\r\nexport async function copyArchitecture(\r\n framework: string,\r\n architecture: string,\r\n structure: ProjectStructure\r\n): Promise<CopyStats> {\r\n return copyTemplateDir(\r\n path.join(\"architectures\", framework, architecture),\r\n { structure, architecture }\r\n );\r\n}\r\n","import fs from \"fs-extra\";\r\nimport path from \"path\";\r\nimport { fileURLToPath } from \"url\";\r\nimport type { ProjectStructure } from \"./detectProjectStructure.js\";\r\nimport { resolveTemplatePath, shouldSkipTemplatePath } from \"./resolveTemplatePath.js\";\r\n\r\nconst __filename = fileURLToPath(import.meta.url);\r\nconst __dirname = path.dirname(__filename);\r\n\r\nexport type CopyStats = {\r\n created: number;\r\n skipped: number;\r\n failed: number;\r\n};\r\n\r\ntype CopyOptions = {\r\n exclude?: (filePath: string) => boolean;\r\n structure: ProjectStructure;\r\n architecture?: string;\r\n remapCore?: boolean;\r\n};\r\n\r\nasync function getAllFiles(dir: string): Promise<string[]> {\r\n const entries = await fs.readdir(dir, { withFileTypes: true });\r\n const files: string[] = [];\r\n\r\n for (const entry of entries) {\r\n const fullPath = path.join(dir, entry.name);\r\n\r\n if (entry.isDirectory()) {\r\n files.push(...(await getAllFiles(fullPath)));\r\n } else if (entry.isFile()) {\r\n files.push(fullPath);\r\n }\r\n }\r\n\r\n return files;\r\n}\r\n\r\nexport async function copyTemplateDir(\r\n relativePath: string,\r\n options: CopyOptions\r\n): Promise<CopyStats> {\r\n const templatePath = path.resolve(__dirname, \"templates\", relativePath);\r\n const targetPath = process.cwd();\r\n const files = await getAllFiles(templatePath);\r\n const createdDirs = new Set<string>();\r\n\r\n let created = 0;\r\n let skipped = 0;\r\n let failed = 0;\r\n\r\n for (const file of files) {\r\n if (options.exclude?.(file)) {\r\n continue;\r\n }\r\n\r\n const relativeFile = path.relative(templatePath, file);\r\n\r\n if (shouldSkipTemplatePath(relativeFile)) {\r\n continue;\r\n }\r\n\r\n const destRelative = resolveTemplatePath(relativeFile, {\r\n structure: options.structure,\r\n architecture: options.architecture,\r\n remapCore: options.remapCore,\r\n });\r\n\r\n if (!destRelative) {\r\n continue;\r\n }\r\n\r\n const dest = path.join(targetPath, destRelative);\r\n const destDir = path.dirname(dest);\r\n\r\n try {\r\n if (await fs.pathExists(dest)) {\r\n skipped++;\r\n continue;\r\n }\r\n\r\n if (!createdDirs.has(destDir)) {\r\n await fs.ensureDir(destDir);\r\n createdDirs.add(destDir);\r\n }\r\n\r\n await fs.copy(file, dest);\r\n created++;\r\n } catch {\r\n failed++;\r\n }\r\n }\r\n\r\n return { created, skipped, failed };\r\n}\r\n","import path from \"path\";\r\nimport type { ProjectStructure } from \"./detectProjectStructure.js\";\r\n\r\nfunction normalizePath(relativePath: string): string {\r\n return relativePath.split(path.sep).join(\"/\");\r\n}\r\n\r\nfunction remapCoreModulePath(\r\n normalizedPath: string,\r\n architecture: string\r\n): string {\r\n if (architecture === \"feature\") {\r\n if (normalizedPath.startsWith(\"src/components/\")) {\r\n return normalizedPath.replace(\r\n \"src/components/\",\r\n \"src/shared/components/\"\r\n );\r\n }\r\n\r\n if (normalizedPath.startsWith(\"src/hooks/\")) {\r\n return normalizedPath.replace(\"src/hooks/\", \"src/shared/hooks/\");\r\n }\r\n\r\n if (normalizedPath.startsWith(\"src/utils/\")) {\r\n return normalizedPath.replace(\"src/utils/\", \"src/shared/utils/\");\r\n }\r\n\r\n if (normalizedPath.startsWith(\"src/providers/\")) {\r\n return normalizedPath.replace(\"src/providers/\", \"src/shared/providers/\");\r\n }\r\n\r\n if (normalizedPath.startsWith(\"src/services/\")) {\r\n return normalizedPath.replace(\"src/services/\", \"src/features/home/services/\");\r\n }\r\n\r\n if (normalizedPath.startsWith(\"src/constants/\")) {\r\n return normalizedPath.replace(\"src/constants/\", \"src/features/home/constants/\");\r\n }\r\n }\r\n\r\n return normalizedPath;\r\n}\r\n\r\ntype ResolveOptions = {\r\n structure: ProjectStructure;\r\n architecture?: string;\r\n remapCore?: boolean;\r\n};\r\n\r\nexport function resolveTemplatePath(\r\n relativePath: string,\r\n options: ResolveOptions\r\n): string | null {\r\n let normalized = normalizePath(relativePath);\r\n\r\n if (normalized === \"src/app\" || normalized.startsWith(\"src/app/\")) {\r\n return null;\r\n }\r\n\r\n if (options.remapCore && options.architecture) {\r\n normalized = remapCoreModulePath(normalized, options.architecture);\r\n }\r\n\r\n if (!options.structure.useSrc && normalized.startsWith(\"src/\")) {\r\n normalized = normalized.slice(4);\r\n }\r\n\r\n return normalized.split(\"/\").join(path.sep);\r\n}\r\n\r\nexport function shouldSkipTemplatePath(relativePath: string): boolean {\r\n const normalized = normalizePath(relativePath);\r\n\r\n return normalized === \"src/app\" || normalized.startsWith(\"src/app/\");\r\n}\r\n","import path from \"path\";\r\nimport { copyTemplateDir, type CopyStats } from \"./copyTemplate.js\";\r\nimport type { ProjectStructure } from \"./detectProjectStructure.js\";\r\n\r\nexport async function copyModules(\r\n modules: string[],\r\n structure: ProjectStructure,\r\n architecture: string\r\n): Promise<CopyStats> {\r\n const stats: CopyStats = { created: 0, skipped: 0, failed: 0 };\r\n\r\n for (const module of modules) {\r\n const result = await copyTemplateDir(path.join(\"modules\", module), {\r\n structure,\r\n architecture,\r\n remapCore: module === \"core\",\r\n exclude: (filePath) => filePath.endsWith(\"module.ts\"),\r\n });\r\n\r\n stats.created += result.created;\r\n stats.skipped += result.skipped;\r\n stats.failed += result.failed;\r\n }\r\n\r\n return stats;\r\n}\r\n","import fs from \"fs-extra\";\r\nimport path from \"path\";\r\nimport type { ProjectStructure } from \"./detectProjectStructure.js\";\r\n\r\nfunction getAppFilePath(\r\n structure: ProjectStructure,\r\n fileName: string\r\n): string {\r\n return path.join(process.cwd(), structure.appDir, fileName);\r\n}\r\n\r\nfunction getProvidersImport(architecture: string): string {\r\n if (architecture === \"feature\") {\r\n return \"@/shared/providers\";\r\n }\r\n\r\n return \"@/providers\";\r\n}\r\n\r\nfunction getPageImport(architecture: string): string {\r\n if (architecture === \"feature\") {\r\n return \"@/features/home/components/HomePage\";\r\n }\r\n\r\n return \"@/components/home/HomeView\";\r\n}\r\n\r\nfunction getPageComponent(architecture: string): string {\r\n if (architecture === \"feature\") {\r\n return \"HomePage\";\r\n }\r\n\r\n return \"HomeView\";\r\n}\r\n\r\nexport async function extendProjectFiles(\r\n architecture: string,\r\n structure: ProjectStructure\r\n) {\r\n await extendLayout(structure, architecture);\r\n await extendPage(structure, architecture);\r\n}\r\n\r\nasync function extendLayout(\r\n structure: ProjectStructure,\r\n architecture: string\r\n) {\r\n const layoutPath = getAppFilePath(structure, \"layout.tsx\");\r\n\r\n if (!(await fs.pathExists(layoutPath))) {\r\n return;\r\n }\r\n\r\n const content = await fs.readFile(layoutPath, \"utf-8\");\r\n const providersImport = getProvidersImport(architecture);\r\n\r\n if (content.includes(\"<Providers>\")) {\r\n return;\r\n }\r\n\r\n let updated = content;\r\n\r\n if (\r\n !content.includes(providersImport) &&\r\n !content.includes('from \"@/providers\"') &&\r\n !content.includes(\"from '@/providers'\")\r\n ) {\r\n const importLine = `import { Providers } from \"${providersImport}\";\\n`;\r\n const lastImportIndex = updated.lastIndexOf(\"import \");\r\n\r\n if (lastImportIndex !== -1) {\r\n const insertAt = updated.indexOf(\"\\n\", lastImportIndex) + 1;\r\n updated = updated.slice(0, insertAt) + importLine + updated.slice(insertAt);\r\n } else {\r\n updated = importLine + updated;\r\n }\r\n }\r\n\r\n updated = updated.replace(/(<body[^>]*>)/, \"$1\\n <Providers>\");\r\n updated = updated.replace(\"</body>\", \" </Providers>\\n </body>\");\r\n\r\n if (updated !== content) {\r\n await fs.writeFile(layoutPath, updated);\r\n }\r\n}\r\n\r\nasync function extendPage(\r\n structure: ProjectStructure,\r\n architecture: string\r\n) {\r\n const pagePath = getAppFilePath(structure, \"page.tsx\");\r\n\r\n if (!(await fs.pathExists(pagePath))) {\r\n return;\r\n }\r\n\r\n const content = await fs.readFile(pagePath, \"utf-8\");\r\n const pageImport = getPageImport(architecture);\r\n const pageComponent = getPageComponent(architecture);\r\n\r\n if (content.includes(pageComponent)) {\r\n return;\r\n }\r\n\r\n const isDefaultTemplate =\r\n content.includes(\"Get started by editing\") ||\r\n content.includes(\"next.svg\") ||\r\n content.includes(\"vercel.svg\");\r\n\r\n if (!isDefaultTemplate) {\r\n return;\r\n }\r\n\r\n const updated = `import { ${pageComponent} } from \"${pageImport}\";\r\n\r\nexport default function Home() {\r\n return <${pageComponent} />;\r\n}\r\n`;\r\n\r\n await fs.writeFile(pagePath, updated);\r\n}\r\n","import fs from \"fs-extra\";\r\nimport path from \"path\";\r\nimport { fileURLToPath } from \"url\";\r\nimport type { ModuleDefinition } from \"../types/module.js\";\r\n\r\nconst __filename = fileURLToPath(import.meta.url);\r\nconst __dirname = path.dirname(__filename);\r\n\r\nexport async function readModule(moduleName: string): Promise<ModuleDefinition> {\r\n const modulePath = path.resolve(\r\n __dirname,\r\n \"templates/modules\",\r\n moduleName,\r\n \"module.ts\"\r\n );\r\n\r\n const content = await fs.readFile(modulePath, \"utf-8\");\r\n const dataUrl = `data:text/javascript;charset=utf-8,${encodeURIComponent(content)}`;\r\n const { default: moduleDef } = await import(dataUrl);\r\n\r\n return moduleDef as ModuleDefinition;\r\n}\r\n","import { execa } from \"execa\";\r\nimport type { ModuleDefinition } from \"../types/module.js\";\r\nimport type { PackageManager } from \"../types/package-manager.js\";\r\n\r\nconst installCommands: Record<\r\n PackageManager,\r\n { command: string; dependencies: string[]; devDependencies: string[] }\r\n> = {\r\n npm: { command: \"npm\", dependencies: [\"install\"], devDependencies: [\"install\", \"-D\"] },\r\n pnpm: { command: \"pnpm\", dependencies: [\"add\"], devDependencies: [\"add\", \"-D\"] },\r\n yarn: { command: \"yarn\", dependencies: [\"add\"], devDependencies: [\"add\", \"-D\"] },\r\n bun: { command: \"bun\", dependencies: [\"add\"], devDependencies: [\"add\", \"-d\"] },\r\n};\r\n\r\nexport async function installDependencies(\r\n modules: ModuleDefinition[],\r\n packageManager: PackageManager\r\n): Promise<number> {\r\n const dependencies = [\r\n ...new Set(modules.flatMap((module) => module.dependencies)),\r\n ];\r\n const devDependencies = [\r\n ...new Set(modules.flatMap((module) => module.devDependencies)),\r\n ];\r\n\r\n const totalCount = dependencies.length + devDependencies.length;\r\n\r\n if (totalCount === 0) {\r\n return 0;\r\n }\r\n\r\n const { command, dependencies: depsArgs, devDependencies: devArgs } =\r\n installCommands[packageManager];\r\n\r\n try {\r\n if (dependencies.length > 0) {\r\n await execa(command, [...depsArgs, ...dependencies], {\r\n stdio: \"inherit\",\r\n cwd: process.cwd(),\r\n });\r\n }\r\n\r\n if (devDependencies.length > 0) {\r\n await execa(command, [...devArgs, ...devDependencies], {\r\n stdio: \"inherit\",\r\n cwd: process.cwd(),\r\n });\r\n }\r\n\r\n return totalCount;\r\n } catch {\r\n throw new Error(\r\n \"Failed to install dependencies.\\nPlease resolve the issue and run the command again.\"\r\n );\r\n }\r\n}\r\n","import fs from \"fs\";\r\nimport path from \"path\";\r\nimport { execa } from \"execa\";\r\nimport type { PackageManager } from \"../types/package-manager.js\";\r\n\r\nexport function detectPackageManager(): PackageManager | null {\r\n const root = process.cwd();\r\n\r\n if (fs.existsSync(path.join(root, \"pnpm-lock.yaml\"))) {\r\n return \"pnpm\";\r\n }\r\n\r\n if (fs.existsSync(path.join(root, \"yarn.lock\"))) {\r\n return \"yarn\";\r\n }\r\n\r\n if (\r\n fs.existsSync(path.join(root, \"bun.lockb\")) ||\r\n fs.existsSync(path.join(root, \"bun.lock\"))\r\n ) {\r\n return \"bun\";\r\n }\r\n\r\n if (fs.existsSync(path.join(root, \"package-lock.json\"))) {\r\n return \"npm\";\r\n }\r\n\r\n return null;\r\n}\r\n\r\nexport async function validatePackageManager(packageManager: PackageManager) {\r\n const result = await execa(packageManager, [\"--version\"], {\r\n reject: false,\r\n });\r\n\r\n if (result.exitCode !== 0) {\r\n throw new Error(\r\n `${packageManager} is not available.\\nPlease install ${packageManager} and try again.`\r\n );\r\n }\r\n}\r\n","import pc from \"picocolors\";\r\n\r\nexport const logger = {\r\n success(message: string) {\r\n console.log(`${pc.green(\"✓\")} ${message}`);\r\n },\r\n\r\n info(message: string) {\r\n console.log(`${pc.cyan(\"ℹ\")} ${message}`);\r\n },\r\n\r\n warning(message: string) {\r\n console.log(`${pc.yellow(\"⚠\")} ${message}`);\r\n },\r\n\r\n error(message: string) {\r\n for (const line of message.split(\"\\n\")) {\r\n console.log(`${pc.red(\"✖\")} ${line}`);\r\n }\r\n },\r\n};\r\n","import { select } from \"@clack/prompts\";\r\nimport { architectures } from \"../config/architectures.js\";\r\n\r\nexport async function selectArchitecture() {\r\n return await select({\r\n message: \"Choose project architecture\",\r\n options: architectures.map((item) => ({\r\n value: item.value,\r\n label: item.label,\r\n hint: item.hint,\r\n })),\r\n });\r\n}","export const architectures = [\r\n {\r\n value: \"standard\",\r\n label: \"Standard\",\r\n hint: \"Simple folder structure\",\r\n },\r\n {\r\n value: \"enterprise\",\r\n label: \"Enterprise\",\r\n hint: \"Scalable enterprise architecture\",\r\n },\r\n {\r\n value: \"feature\",\r\n label: \"Feature Based\",\r\n hint: \"Organize code by feature\",\r\n },\r\n] as const;","import { multiselect } from \"@clack/prompts\";\r\nimport { modules } from \"../config/modules.js\";\r\n\r\nexport async function selectModules() {\r\n return await multiselect({\r\n message: \"Select modules\",\r\n options: modules.map((item) => ({\r\n value: item.value,\r\n label: item.label,\r\n hint: item.hint,\r\n })),\r\n required: true,\r\n });\r\n}\r\n","export const modules = [\r\n {\r\n value: \"core\",\r\n label: \"Core\",\r\n hint: \"Basic starter files\",\r\n },\r\n {\r\n value: \"axios\",\r\n label: \"Axios\",\r\n hint: \"API Client\",\r\n },\r\n {\r\n value: \"zustand\",\r\n label: \"Zustand\",\r\n hint: \"State Management\",\r\n },\r\n];\r\n","import { select } from \"@clack/prompts\";\r\nimport type { PackageManager } from \"../types/package-manager.js\";\r\n\r\nexport async function selectPackageManager() {\r\n return await select<PackageManager>({\r\n message: \"Choose package manager\",\r\n options: [\r\n { value: \"npm\", label: \"npm\" },\r\n { value: \"pnpm\", label: \"pnpm\" },\r\n { value: \"yarn\", label: \"yarn\" },\r\n { value: \"bun\", label: \"bun\" },\r\n ],\r\n initialValue: \"npm\",\r\n });\r\n}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AAAA,IACN;AACA;AAAA,EACF;AAEA,QAAM,0BAA0B,QAAQ;AACxC,0BAAwB,MAAM,yBAAyB;AAEvD,MAAI;AAEJ,MAAI;AACF,wBAAoB,MAAM;AAAA,MACxB;AAAA,MACA;AAAA,MACA;AAAA,IACF;AACA,4BAAwB,KAAK,SAAS;AAAA,EACxC,SAAS,OAAO;AACd,4BAAwB,KAAK,QAAQ;AACrC,WAAO;AAAA,MACL,iBAAiB,QAAQ,MAAM,UAAU;AAAA,IAC3C;AACA;AAAA,EACF;AAEA,QAAM,qBAAqB,QAAQ;AACnC,qBAAmB,MAAM,oBAAoB;AAE7C,MAAI;AAEJ,MAAI;AACF,kBAAc,MAAM;AAAA,MAClB;AAAA,MACA;AAAA,MACA;AAAA,IACF;AACA,uBAAmB,KAAK,SAAS;AAAA,EACnC,SAAS,OAAO;AACd,uBAAmB,KAAK,QAAQ;AAChC,WAAO;AAAA,MACL,iBAAiB,QAAQ,MAAM,UAAU;AAAA,IAC3C;AACA;AAAA,EACF;AAEA,MAAI;AACF,UAAM,mBAAmB,cAAwB,SAAS;AAAA,EAC5D,SAAS,OAAO;AACd,WAAO;AAAA,MACL,iBAAiB,QAAQ,MAAM,UAAU;AAAA,IAC3C;AACA;AAAA,EACF;AAEA,QAAM,mBAAmB,QAAQ;AACjC,mBAAiB,MAAM,cAAc;AAErC,eAAa;AAAA,IACX;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,cAAc,kBAAkB,UAAU,YAAY;AAAA,IACtD,cAAc,kBAAkB,UAAU,YAAY;AAAA,EACxD,CAAC;AAED,mBAAiB,KAAK,SAAS;AACjC;;;ADzOA,IAAM,UAAU,IAAI,QAAQ;AAE5B,QACG,KAAK,eAAe,EACpB,YAAY,kCAAkC,EAC9C,QAAQ,OAAO;AAElB,QAAQ,QAAQ,MAAM,EAAE,OAAO,WAAW;AAE1C,QAAQ,MAAM;","names":["fs","path","fileURLToPath","fs","path","fs","path","path","path","fs","path","path","modules","path","fs","path","fs","path","fileURLToPath","__filename","__dirname","modules","fs","path","execa","select","path","fileURLToPath","fs"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prmvx/frontend-forge",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "A modern CLI to scaffold production-ready frontend architectures and starter modules for existing Next.js projects.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cli",
|
|
@@ -67,4 +67,4 @@
|
|
|
67
67
|
"publishConfig": {
|
|
68
68
|
"access": "public"
|
|
69
69
|
}
|
|
70
|
-
}
|
|
70
|
+
}
|