From 35165a26d9e1eda1f049d5a5b5a1cb2cd1e09c9f Mon Sep 17 00:00:00 2001 From: James Culveyhouse Date: Tue, 3 Oct 2023 12:06:16 -0500 Subject: [PATCH] C3: Fixing double prompt for ts during hello world worker creation (#4088) * C3: Fixing double prompt for ts during hello world worker creation * changeset --- .changeset/eighty-plums-ring.md | 5 +++++ packages/create-cloudflare/src/workers.ts | 14 +++++++------- 2 files changed, 12 insertions(+), 7 deletions(-) create mode 100644 .changeset/eighty-plums-ring.md diff --git a/.changeset/eighty-plums-ring.md b/.changeset/eighty-plums-ring.md new file mode 100644 index 000000000000..c8b82535026b --- /dev/null +++ b/.changeset/eighty-plums-ring.md @@ -0,0 +1,5 @@ +--- +"create-cloudflare": patch +--- + +Fixes an issue where users were prompted for TypeScript twice during worker creation diff --git a/packages/create-cloudflare/src/workers.ts b/packages/create-cloudflare/src/workers.ts index 381085fe8cf1..a7c7cc565a6f 100644 --- a/packages/create-cloudflare/src/workers.ts +++ b/packages/create-cloudflare/src/workers.ts @@ -42,6 +42,13 @@ export const runWorkersGenerator = async (args: C3Args) => { args, }; + ctx.args.ts = await processArgument(ctx.args, "ts", { + type: "confirm", + question: "Do you want to use TypeScript?", + label: "typescript", + defaultValue: C3_DEFAULTS.ts, + }); + await copyFiles(ctx); await copyExistingWorkerFiles(ctx); await updateFiles(ctx); @@ -61,13 +68,6 @@ export const runWorkersGenerator = async (args: C3Args) => { }; async function getTemplate(ctx: Context) { - ctx.args.ts = await processArgument(ctx.args, "ts", { - type: "confirm", - question: "Do you want to use TypeScript?", - label: "typescript", - defaultValue: C3_DEFAULTS.ts, - }); - const preexisting = ctx.args.type === "pre-existing"; const template = preexisting ? "hello-world" : ctx.args.type; const path = resolve(