Lint
c347b73b
2 file(s) · +36 −1
| 1 | - | import { displayBanner } from "@/lib/display-banner";import { createProject } from "../lib/create-project";import pc from "picocolors";export const create = async (projectDirectory: string, options: any) => { try { displayBanner(); const result = await createProject(projectDirectory, options); if (result) { console.log(pc.green(pc.bold("🎉 Project created successfully!"))); console.log("\nNext steps:"); if (!result.dependenciesInstalled) { console.log(pc.cyan(` cd ${result.projectName}`)); console.log(pc.cyan(" bun install")); } else { console.log(pc.cyan(` cd ${result.projectName}`)); } console.log(pc.cyan(" bun run dev:client # Start the client")); console.log( pc.cyan( " bun run dev:server # Start the server in another terminal", ), ); console.log(pc.cyan(" bun run dev # Start all")); process.exit(0); } } catch (err) { console.error(pc.red("Error creating project:"), err); process.exit(1); }}; |
|
| 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 | + | }; |
| 27 | 27 | projectOptions.projectName ?? projectDirectory, |
|
| 28 | 28 | projectOptions.yes, |
|
| 29 | 29 | ); |
|
| 30 | + | ||
| 30 | 31 | const dependenciesInstalled = await installDependencies( |
|
| 31 | 32 | projectOptions.projectName ?? projectDirectory, |
|
| 32 | 33 | projectOptions.yes, |