| 1 | import pc from "picocolors"; |
| 2 | import { displayBanner } from "@/lib/display-banner"; |
| 3 | import type { ProjectOptions } from "@/types"; |
| 4 | import { createProject } from "../lib/create-project"; |
| 5 | |
| 6 | export const create = async ( |
| 7 | projectDirectory: string, |
| 8 | options: ProjectOptions, |
| 9 | ) => { |
| 10 | try { |
| 11 | displayBanner(); |
| 12 | const result = await createProject(projectDirectory, options); |
| 13 | if (result) { |
| 14 | console.log(pc.green(pc.bold("🎉 Project created successfully!"))); |
| 15 | console.log("\nNext steps:"); |
| 16 | if (!result.dependenciesInstalled) { |
| 17 | console.log(pc.cyan(` cd ${result.projectName}`)); |
| 18 | console.log(pc.cyan(" bun install")); |
| 19 | } else { |
| 20 | console.log(pc.cyan(` cd ${result.projectName}`)); |
| 21 | } |
| 22 | console.log(pc.cyan(" bun run dev:client # Start the client")); |
| 23 | console.log( |
| 24 | pc.cyan( |
| 25 | " bun run dev:server # Start the server in another terminal", |
| 26 | ), |
| 27 | ); |
| 28 | console.log(pc.cyan(" bun run dev # Start all")); |
| 29 | process.exit(0); |
| 30 | } |
| 31 | } catch (err) { |
| 32 | console.error(pc.red("Error creating project:"), err); |
| 33 | process.exit(1); |
| 34 | } |
| 35 | }; |