import "@johnlindquist/kit";const framework = await arg("Choose a framework:", [
"React",
"Vue",
"Svelte",
"Next.js",
"Nuxt.js",
]);
const projectName = await arg("Project name:");
const projectDir = path.join(home(), "projects", projectName);
await ensureDir(projectDir);
cd(projectDir);
const createCommand = `npx create-${
framework.toLowerCase() === "next.js"
? "next-app"
: framework.toLowerCase() === "nuxt.js"
? "nuxt"
: framework.toLowerCase()
}@latest ${projectName}`;
await term({ command: createCommand });
if (framework !== "next.js" && framework !== "nuxt.js") {
await term({ command: "npm i" });
}
const gitInit = await arg({
placeholder: "Initialize git?",
type: "confirm",
});
if (gitInit) {
await term({ command: "git init" });
await term({ command: "git add ." });
await term({ command: 'git commit -m "Initial commit"' });
}
await div(`Project created in ${projectDir}`);
revealFile(projectDir);