Skip to content
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

feat: implement a basic wrangler delete #2045

Merged
merged 1 commit into from
Oct 18, 2022

Conversation

threepointone
Copy link
Contributor

This PR adds a simple (but useful!) implementation for wrangler delete. Of note, it'll delete a given service, including all it's bindings. It uses the same api as the dashboard.

@changeset-bot
Copy link

changeset-bot bot commented Oct 18, 2022

🦋 Changeset detected

Latest commit: eedf371

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

This PR includes changesets to release 1 package
Name Type
wrangler 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

@github-actions
Copy link
Contributor

github-actions bot commented Oct 18, 2022

A wrangler prerelease is available for testing. You can install this latest build in your project with:

npm install --save-dev https://prerelease-registry.developers.workers.dev/runs/3275008068/npm-package-wrangler-2045

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

npm install --save-dev https://prerelease-registry.developers.workers.dev/prs/2045/npm-package-wrangler-2045

Or you can use npx with this latest build directly:

npx https://prerelease-registry.developers.workers.dev/runs/3275008068/npm-package-wrangler-2045 dev path/to/script.js
Additional artifacts:
npm install https://prerelease-registry.developers.workers.dev/runs/3275008068/npm-package-cloudflare-pages-shared-2045

@codecov
Copy link

codecov bot commented Oct 18, 2022

Codecov Report

Merging #2045 (eedf371) into main (ccfdd0b) will increase coverage by 0.11%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2045      +/-   ##
==========================================
+ Coverage   72.53%   72.64%   +0.11%     
==========================================
  Files         123      124       +1     
  Lines        8399     8430      +31     
  Branches     2202     2208       +6     
==========================================
+ Hits         6092     6124      +32     
+ Misses       2307     2306       -1     
Impacted Files Coverage Δ
packages/wrangler/src/metrics/send-event.ts 100.00% <ø> (ø)
packages/wrangler/src/delete.ts 100.00% <100.00%> (ø)
packages/wrangler/src/index.tsx 81.10% <100.00%> (+0.17%) ⬆️
...ackages/wrangler/src/__tests__/helpers/mock-bin.ts 100.00% <0.00%> (+5.26%) ⬆️

Copy link
Contributor

@rozenmd rozenmd left a comment

Choose a reason for hiding this comment

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

👀

packages/wrangler/src/delete.ts Outdated Show resolved Hide resolved
// delete
wrangler.command(
"delete [script]",
"🗑 Delete your Worker from Cloudflare.",
Copy link
Contributor

Choose a reason for hiding this comment

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

❤️

Copy link
Contributor Author

Choose a reason for hiding this comment

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

🧡

packages/wrangler/src/delete.ts Outdated Show resolved Hide resolved
packages/wrangler/src/delete.ts Outdated Show resolved Hide resolved
This PR adds a simple (but useful!) implementation for `wrangler delete`. Of note, it'll delete a given service, including all it's bindings. It uses the same api as the dashboard.
await fetchResult(
`/accounts/${accountId}/workers/services/${scriptName}`,
{ method: "DELETE" },
new URLSearchParams({ force: "true" })
Copy link
Contributor

Choose a reason for hiding this comment

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

Should the force be added as a CLI option?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I considered it, but honestly it's the only way that it's actually useful (which is why it's added by default on the dashboard too).

Copy link
Contributor

@rozenmd rozenmd left a comment

Choose a reason for hiding this comment

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

Looks good to me, welcome to the team

@threepointone
Copy link
Contributor Author

threepointone commented Oct 18, 2022

nominated

@rozenmd rozenmd merged commit c2d3286 into cloudflare:main Oct 18, 2022
@github-actions github-actions bot mentioned this pull request Oct 18, 2022
@threepointone threepointone deleted the wrangler-delete branch October 18, 2022 18:08
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.

3 participants