Skip to content

Commit

Permalink
C3: Fixing double prompt for ts during hello world worker creation (#…
Browse files Browse the repository at this point in the history
…4088)

* C3: Fixing double prompt for ts during hello world worker creation

* changeset
  • Loading branch information
jculvey authored Oct 3, 2023
1 parent 3e9e2f5 commit 35165a2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
5 changes: 5 additions & 0 deletions .changeset/eighty-plums-ring.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"create-cloudflare": patch
---

Fixes an issue where users were prompted for TypeScript twice during worker creation
14 changes: 7 additions & 7 deletions packages/create-cloudflare/src/workers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@ export const runWorkersGenerator = async (args: C3Args) => {
args,
};

ctx.args.ts = await processArgument<boolean>(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);
Expand All @@ -61,13 +68,6 @@ export const runWorkersGenerator = async (args: C3Args) => {
};

async function getTemplate(ctx: Context) {
ctx.args.ts = await processArgument<boolean>(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(
Expand Down

0 comments on commit 35165a2

Please sign in to comment.