Skip to content

Commit

Permalink
fix(create-turbo): prompt fix (#4586)
Browse files Browse the repository at this point in the history
  • Loading branch information
tknickman committed Apr 14, 2023
1 parent 496eca2 commit e4225c0
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions packages/create-turbo/src/commands/create/prompts.ts
Expand Up @@ -2,7 +2,7 @@ import path from "path";
import fs from "fs-extra";
import chalk from "chalk";
import type { PackageManager } from "@turbo/workspaces";
import type { CreateCommandArgument, CreateCommandOptions } from "./types";
import type { CreateCommandArgument } from "./types";
import { getAvailablePackageManagers } from "@turbo/utils";
import { isFolderEmpty } from "../../utils/isFolderEmpty";
import inquirer from "inquirer";
Expand Down Expand Up @@ -95,14 +95,17 @@ export async function packageManager({
type: "list",
message: "Which package manager do you want to use?",
when:
// prompt for package manager if it wasn't provided as an argument, or if it was
// provided, but isn't available (always allow npm)
!packageManager ||
(packageManager as PackageManager) !== "npm" ||
!Object.keys(availablePackageManagers).includes(packageManager),
choices: ["npm", "pnpm", "yarn"].map((p) => ({
name: p,
value: p,
// npm should always be available
disabled:
p !== "npm" ||
// npm should always be available
p === "npm" ||
availablePackageManagers?.[p as PackageManager]?.available
? false
: `not installed`,
Expand Down

1 comment on commit e4225c0

@vercel
Copy link

@vercel vercel bot commented on e4225c0 Apr 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.