genreactai
Version:
A lightweight and customizable CLI tool to generate React components, tailored to your project's structure and style preferences.
14 lines (11 loc) • 382 B
JavaScript
import path from 'path';
import fs from 'fs-extra';
export function resolveFilePath(structure, examplePath) {
const fileName = path.basename(examplePath);
const fullPath = path.join(structure, fileName);
return fullPath;
}
export async function writeComponentFile(content, fullPath) {
await fs.ensureDir(path.dirname(fullPath));
await fs.writeFile(fullPath, content);
}