Remove other package managers, and add helpful bun install message
17d881aa
2 file(s) · +8 −26
| 13 | 13 | ||
| 14 | 14 | ```bash |
|
| 15 | 15 | # Using Bun |
|
| 16 | - | bun create bhvr my-bhvr-app |
|
| 17 | - | ``` |
|
| 18 | - | ||
| 19 | - | You can use `create-bhvr` with other package managers, but we highly recommend you stick with Bun. |
|
| 20 | - | ||
| 21 | - | ```bash |
|
| 22 | - | # Using PNPM |
|
| 23 | - | pnpm create bhvr my-bhvr-app |
|
| 24 | - | ``` |
|
| 25 | - | ||
| 26 | - | ```bash |
|
| 27 | - | # Using NPX |
|
| 28 | - | npx create-bhvr my-bhvr-app |
|
| 16 | + | bun create bhvr@latest my-bhvr-app |
|
| 29 | 17 | ``` |
|
| 30 | 18 | ||
| 31 | 19 | This will create a new directory called `my-bhvr-app` inside the current folder. |
| 4 | 4 | import pc from "picocolors"; |
|
| 5 | 5 | import { tryCatch } from "@/utils/try-catch"; |
|
| 6 | 6 | ||
| 7 | - | async function getPackageManager(): Promise<"bun" | "pnpm" | "npm"> { |
|
| 8 | - | try { |
|
| 9 | - | await execa("bun", ["--version"]); |
|
| 10 | - | return "bun"; |
|
| 11 | - | } catch (_e) { |
|
| 12 | - | // bun is not installed |
|
| 13 | - | } |
|
| 7 | + | async function getPackageManager(): Promise<"bun"> { |
|
| 8 | + | const { error } = await tryCatch(execa("bun", ["--version"])); |
|
| 14 | 9 | ||
| 15 | - | try { |
|
| 16 | - | await execa("pnpm", ["--version"]); |
|
| 17 | - | return "pnpm"; |
|
| 18 | - | } catch (_e) { |
|
| 19 | - | // pnpm is not installed |
|
| 10 | + | if (!error) { |
|
| 11 | + | consola.error(new Error("Bun is not installed.")); |
|
| 12 | + | consola.warn("Please install bun from https://bun.sh/"); |
|
| 13 | + | process.exit(1); |
|
| 20 | 14 | } |
|
| 21 | 15 | ||
| 22 | - | return "npm"; |
|
| 16 | + | return "bun"; |
|
| 23 | 17 | } |
|
| 24 | 18 | ||
| 25 | 19 | export async function installDependencies( |