Skip to content

Commit

Permalink
fix(gatsby-cli): Fix recipes cli invocation (#24201)
Browse files Browse the repository at this point in the history
  • Loading branch information
blainekasten committed May 18, 2020
1 parent d19567d commit e6e7463
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
12 changes: 4 additions & 8 deletions packages/gatsby-cli/src/create-cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -342,15 +342,11 @@ function buildLocalCommands(cli: yargs.Argv, isLocalSite: boolean): void {
cli.command({
command: `recipes [recipe]`,
describe: `[EXPERIMENTAL] Run a recipe`,
handler: handlerP(({ recipe }: yargs.Arguments) => {
if (typeof recipe !== `string`) {
throw new Error(
`Error: gatsby recipes needs to be called with a specific recipe`
)
handler: handlerP(
async ({ recipe }: yargs.Arguments<{ recipe: string | undefined }>) => {
await recipesHandler(recipe)
}

recipesHandler(recipe)
}),
),
})
}

Expand Down
4 changes: 3 additions & 1 deletion packages/gatsby-cli/src/recipes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ import * as path from "path"
import * as fs from "fs"
import detectPort from "detect-port"

export async function recipesHandler(recipe: string): Promise<void> {
export async function recipesHandler(
recipe: string | undefined
): Promise<void> {
// We don't really care what port is used for GraphQL as it's
// generally only for code to code communication or debugging.
const graphqlPort = await detectPort(4000)
Expand Down

0 comments on commit e6e7463

Please sign in to comment.