UNPKG

create-react-husky

Version:

A custom React project setup with Husky and ESLint for pre-commit hooks and code quality

47 lines (38 loc) 1.2 kB
#!/usr/bin/env node import { execSync } from "child_process"; import { select } from "@inquirer/prompts"; async function setupReactProject() { const answers = await select({ message: "Select a package manager", choices: [ { name: "JavaScript", value: "javascript", description: "Set up the project using JavaScript", }, { name: "TypeScript", value: "typescript", description: "Set up the project using TypeScript", }, ], }); const language = answers.toLowerCase(); const repoUrls = { javascript: "https://github.com/akashpradhan-dev/react-husky-js.git", // JavaScript template typescript: "https://github.com/akashpradhan-dev/react-husky-ts.git", // TypeScript template }; const repoUrl = repoUrls[language]; if (!repoUrl) { console.error("Invalid template selected"); return; } console.log(`Cloning ${language} React project from ${repoUrl}...`); try { // Clone the selected template repository execSync(`git clone ${repoUrl}`, { stdio: "inherit" }); } catch (error) { console.error("Error while setting up React project:", error); } } setupReactProject();