cloudflare / workers-sdk

⛅️ Home to Wrangler, the CLI for Cloudflare Workers®
https://developers.cloudflare.com/workers/
Apache License 2.0
2.41k stars 592 forks source link

Add `demandCommand()` to R2 Commands #6105

Closed helloimalastair closed 1 week ago

helloimalastair commented 1 week ago

What this PR solves / how to test

Fixes #5928.

Author has addressed the following

changeset-bot[bot] commented 1 week ago

🦋 Changeset detected

Latest commit: 8edec80b8c3eee27a998171e992047b578dc6eb5

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages | Name | Type | | ------------------------------- | ----- | | wrangler | Patch | | @cloudflare/vitest-pool-workers | Patch |

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](https://github.com/helloimalastair/workers-sdk/new/r2-noinfo?filename=.changeset/khaki-poets-shop.md&value=---%0A%22wrangler%22%3A%20patch%0A---%0A%0AAdd%20%60demandCommand()%60%20to%20R2%20Commands%0A)

github-actions[bot] commented 1 week ago

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/9643110441/npm-package-wrangler-6105

You can reference the automatically updated head of this PR with:

npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/prs/6105/npm-package-wrangler-6105

Or you can use npx with this latest build directly:

npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/9643110441/npm-package-wrangler-6105 dev path/to/script.js
Additional artifacts: ```sh npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/9643110441/npm-package-create-cloudflare-6105 --no-auto-update ``` ```sh npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/9643110441/npm-package-cloudflare-kv-asset-handler-6105 ``` ```sh npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/9643110441/npm-package-miniflare-6105 ``` ```sh npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/9643110441/npm-package-cloudflare-pages-shared-6105 ``` ```sh npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/9643110441/npm-package-cloudflare-vitest-pool-workers-6105 ``` Note that these links will no longer work once [the GitHub Actions artifact expires](https://docs.github.com/en/organizations/managing-organization-settings/configuring-the-retention-period-for-github-actions-artifacts-and-logs-in-your-organization).

wrangler@3.61.0 includes the following runtime dependencies:

Package Constraint Resolved
miniflare workspace:* 3.20240610.1
workerd 1.20240610.1 1.20240610.1
workerd --version 1.20240610.1 2024-06-10

Please ensure constraints are pinned, and miniflare/workerd minor versions match.

helloimalastair commented 1 week ago

@CarmenPopoviciu just to clarify, should the test run across just the commands that have changed here, or every command with subcommands within wrangler? And should it just check if something is logged, or that an exact message is logged?

CarmenPopoviciu commented 1 week ago

basically we want to test that running wrangler r2 bucket prints

Screenshot 2024-06-20 at 15 47 06

and wrangler r2 object prints

Screenshot 2024-06-20 at 15 47 55

which is what this PR fixes. Currently they both print nothing

helloimalastair commented 1 week ago

@CarmenPopoviciu should be ready with tests now? Had to replace SubHelp with demandCommand() to get them all to pass though.

helloimalastair commented 1 week ago

Think I screwed something up here, let me see if I can fix it...

helloimalastair commented 1 week ago

Ok, should be good to go now, and all tests should be in a single file.