-
-
Notifications
You must be signed in to change notification settings - Fork 12
chore: use wrangler typegen instead of types package #528
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
base: main
Are you sure you want to change the base?
Conversation
Closes #394 Signed-off-by: flakey5 <[email protected]>
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
release-cloudflare-worker/package.json
Line 17 in c568323
"@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
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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