-
Notifications
You must be signed in to change notification settings - Fork 1k
wrangler types - Import correct types for bound services #8794
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
Conversation
🦋 Changeset detectedLatest commit: 554116d The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
@eastlondoner Thanks for this PR! I've modified it slightly to support Durable Objects, add tests, and to use the |
|
Also there are some lint checks failing |
|
Thanks so much @petebacondarwin and @penalosa, this is amazing! |
Thanks to you @eastlondoner for kicking this off. Given that @penalosa has added quite a lot, it would be good if you could try it out for yourself to check we have covered everything from your side. |
|
A Wrangler prerelease is available for testing. You can install this latest build in your project with: npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/14904858056/npm-package-wrangler-8794Prereleases for other packages:
wget https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/14904858056/npm-package-cloudflare-workers-bindings-extension-8794 -O ./cloudflare-workers-bindings-extension.0.0.0-va789e6b4d.vsix && code --install-extension ./cloudflare-workers-bindings-extension.0.0.0-va789e6b4d.vsix
npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/14904858056/npm-package-create-cloudflare-8794 --no-auto-update
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/14904858056/npm-package-cloudflare-kv-asset-handler-8794
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/14904858056/npm-package-miniflare-8794
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/14904858056/npm-package-cloudflare-pages-shared-8794
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/14904858056/npm-package-cloudflare-unenv-preset-8794
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/14904858056/npm-package-cloudflare-vite-plugin-8794
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/14904858056/npm-package-cloudflare-vitest-pool-workers-8794
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/14904858056/npm-package-cloudflare-workers-editor-shared-8794
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/14904858056/npm-package-cloudflare-workers-shared-8794
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/14904858056/npm-package-cloudflare-workflows-shared-8794Note that these links will no longer work once the GitHub Actions artifact expires. |
emily-shen
left a comment
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.
🎉
(and thank you @eastlondoner for getting this started, really appreciate it!)
|
Congratulations @eastlondoner, the maintainer of this repository has issued you a holobyte! Here it is: https://holopin.io/holobyte/cmaf9z4fq16900djyoz9tkga1 This badge can only be claimed by you, so make sure that your GitHub account is linked to your Holopin account. You can manage those preferences here: https://holopin.io/account. |
I created this based on some DMs with Cloudflare Team members. Apologies for not creating an issue or discussion.
what this does
If extra wrangler configs are provided to
wrangler typesas:This will use those to find the type definitions for the bound service, matching on the service name where it exists.
I took inspiration from the wrangler dev command which already allows passing in multiple wrangler files to then determine the locations of the implementations of each of the bound services on Env.
and I took inspiration from the DurableObject binding code already in the type generation
Now my generated types have all the correct methods attached.