#!/usr/bin/env node import inquirer from "inquirer"; import { createProject } from "../lib/createProject"; import askQuestions, { Answers } from "../lib/askQuestions"; import { generateComponent } from "../generators/generateComponent"; import { generatePage } from "../lib/generatePage"; import { installLibrary } from "../lib/installLibrary"; async function main() { const args = process.argv.slice(2); if (args[0] === "init") { // راه‌اندازی پروژه فول‌استک const answers: Answers = await askQuestions(); await createProject(answers); } else if (args[0] === "add") { // فرایند تعاملی برای add const { actionType } = await inquirer.prompt([ { type: "list", name: "actionType", message: "What do you want to add?", choices: ["Component", "Page", "Library"] } ]); if (actionType === "Component") { const { componentName } = await inquirer.prompt([ { type: "input", name: "componentName", message: "Enter the component name:" } ]); await generateComponent(componentName); } else if (actionType === "Page") { const { pageName } = await inquirer.prompt([ { type: "input", name: "pageName", message: "Enter the page name:" } ]); await generatePage(pageName); } else if (actionType === "Library") { const { libraryName } = await inquirer.prompt([ { type: "input", name: "libraryName", message: "Enter the npm library name to install:" } ]); await installLibrary(libraryName); } } else { console.log(` kpm CLI Usage: kpm init # Create a new project kpm add # Add a component, page or install a library `); } } main();