Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(create-turbo): prompt fix #4586

Merged
merged 2 commits into from
Apr 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions packages/create-turbo/src/commands/create/prompts.ts
Original file line number Diff line number Diff line change
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