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
Implement --json
in versions list commands
#5412
Conversation
🦋 Changeset detectedLatest commit: 3f7f8a1 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 |
--json
in {versions|deployments} list
--json
in versions list commands
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/8467123919/npm-package-wrangler-5412 You can reference the automatically updated head of this PR with: npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/prs/5412/npm-package-wrangler-5412 Or you can use npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/8467123919/npm-package-wrangler-5412 dev path/to/script.js Additional artifacts:npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/8467123919/npm-package-create-cloudflare-5412 --no-auto-update npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/8467123919/npm-package-cloudflare-kv-asset-handler-5412 npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/8467123919/npm-package-miniflare-5412 npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/8467123919/npm-package-cloudflare-pages-shared-5412 npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/8467123919/npm-package-cloudflare-vitest-pool-workers-5412 Note that these links will no longer work once the GitHub Actions artifact expires.
Please ensure constraints are pinned, and |
5d8ec7a
to
c3b5fb7
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #5412 +/- ##
==========================================
+ Coverage 72.18% 72.31% +0.12%
==========================================
Files 322 322
Lines 16663 16685 +22
Branches 4260 4266 +6
==========================================
+ Hits 12029 12065 +36
+ Misses 4634 4620 -14
|
be5a154
to
ce543e6
Compare
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.
Some nits, but mostly LGTM
@@ -55,6 +62,11 @@ export async function versionsViewHandler(args: VersionsViewArgs) { | |||
|
|||
const version = await fetchVersion(accountId, workerName, args.versionId); | |||
|
|||
if (args.json) { | |||
logRaw(JSON.stringify(version, null, 2)); |
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.
Why the null, 2
? In general, I don't think we should be outputting prettified JSON
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.
Curious why you think we shouldn't output prettified JSON?
Seems to me like there's no benefit in not prettifying it but if a user needed to debug their usage it would be helpful for it to be slightly more readable
@@ -52,6 +60,12 @@ export async function versionsDeploymentsListHandler( | |||
} | |||
|
|||
const deployments = await fetchLatestDeployments(accountId, workerName); | |||
|
|||
if (args.json) { | |||
logRaw(JSON.stringify(deployments, null, 2)); |
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.
Same comment as above
What this PR solves / how to test
Fixes #5408.
This PR adds the
--json
flag towrangler deployments list --experimental-versions
andwrangler versions list --experimental-versions
which will format the output as clean JSON.This only affects the
--experimental-versions
flagged implementation of these commands, not the unflagged implementation.CR: https://jira.cfdata.org/browse/CR-850334
Author has addressed the following