-
Notifications
You must be signed in to change notification settings - Fork 774
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
fix: cleans up d1 list
output for json
#2622
Conversation
🦋 Changeset detectedLatest commit: 44e85d1 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
Codecov Report
@@ Coverage Diff @@
## main #2622 +/- ##
=======================================
Coverage 73.19% 73.20%
=======================================
Files 159 159
Lines 9847 9850 +3
Branches 2622 2624 +2
=======================================
+ Hits 7208 7211 +3
Misses 2639 2639
|
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 looking good, looks like moving some stuff around and JSON option feature too.
The blocking comment is in regards to the beta warning message.
if (json) { | ||
logger.log(JSON.stringify(dbs, null, 2)); | ||
} else { | ||
logger.log(d1BetaWarning); |
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 beta warning be moved above the if statement?
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.
The point of the pull is to have a json parseable output - by having the warning, you lose that ability
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.
My idea was to not print the warning since it might pollute stdout
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.
Ok I see the use case you may be referring to in regards of maybe piping the stdout to say a .json
file or something and this messaging would break that.
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/runs/4007970845/npm-package-wrangler-2622 You can reference the automatically updated head of this PR with: npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/prs/2622/npm-package-wrangler-2622 Or you can use npx https://prerelease-registry.devprod.cloudflare.dev/runs/4007970845/npm-package-wrangler-2622 dev path/to/script.js Additional artifacts:npm install https://prerelease-registry.devprod.cloudflare.dev/runs/4007970845/npm-package-cloudflare-pages-shared-2622 |
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.
Appreciate the clarification of the use case. We want to be considerate of the messaging as part of the Wrangler Public API, I think you make a good point that the messaging is strongly prominent in other parts of d1
usage
if (json) { | ||
logger.log(JSON.stringify(dbs, null, 2)); | ||
} else { | ||
logger.log(d1BetaWarning); |
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.
Ok I see the use case you may be referring to in regards of maybe piping the stdout to say a .json
file or something and this messaging would break that.
Apologies @JacobMGEvans, I should've linked the GitHub issue: #2323 |
Looks like you did in the PR description! That's a miss on my part 😅 |
Added it after your last comment lol |
This PR hides the warning messages, and just returns clean json when running
wrangler d1 list --json
Before:
After:
Closes #2323