Skip to content

chore: use wrangler typegen instead of types package - #528

Merged
flakey5 merged 2 commits into
mainfrom
flakey5/394
Sep 4, 2025
Merged

flakey5 merged 2 commits into
mainfrom
flakey5/394

Conversation

@flakey5

@flakey5 flakey5 commented Aug 7, 2025

Copy link
Copy Markdown
Member

Closes #394

@flakey5
flakey5 requested a review from a team as a code owner August 7, 2025 03:36
Comment thread worker-configuration.d.ts

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should this file be on gitignore maybe? Since it is automatically generated? cc @flakey5

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Standard practice is to have it be checked in, we can have it ignored but means that we'd need to run the generate command on each ci run + contributors run it on a fresh clone

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

But aren't these generated anyways automatically? It just doesn't make sense for us to host autogen code. It's like node_modules.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

But aren't these generated anyways automatically?

Not unless you're talking about the workers-types package that we're using already?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Im under the assumption the types get generated once the build command or something like that runs?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

That's not the case, we're currently getting our types from the @cloudflare/workers-types package

"@cloudflare/workers-types": "^4.20250722.0",

With this pr we'd be generating them similar to how we precompile the directory listing template where we have it checked in and update it only when it needs to be

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It's just that it is a massive type file and it clobs PR reviewing... How and when does this file get updated?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm just a bit confused of what's the process of updating this file and how it gets updated.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Updating the file is done manually via npm run build:wranger-types, this is only done when it needs to be (i.e. we change our compatability_date or a new api gets released that we wanna use). The npm command just runs wrangler types --include-env=false, which just makes wrangler write the latest workers types into the .d.ts file

Closes #394

Signed-off-by: flakey5 <73616808+flakey5@users.noreply.github.com>
@flakey5
flakey5 merged commit 17571e4 into main Sep 4, 2025
6 checks passed
@flakey5
flakey5 deleted the flakey5/394 branch September 4, 2025 20:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Wrangler Type Generation

2 participants