-
Notifications
You must be signed in to change notification settings - Fork 219
Introduce --output-file flag, write bulk operation results to STDOUT or a file
#6656
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
This stack of pull requests is managed by Graphite. Learn more about stacking. |
--output-file flag--output-file flag
--output-file flag--output-file flag, write bulk operation results to STDOUT or a file
Coverage report
Show new covered files 🐣
Show files with reduced coverage 🔻
Test suite run success3406 tests passing in 1386 suites. Report generated by 🧪jest coverage report action from 4b2da57 |
cb7b47a to
91d94fd
Compare
91d94fd to
9ae6397
Compare
c9b42e0 to
5270287
Compare
9ae6397 to
535eb18
Compare
packages/app/src/cli/services/bulk-operations/download-bulk-operation-results.test.ts
Show resolved
Hide resolved
5270287 to
d3ffc48
Compare
535eb18 to
de334e2
Compare
| export async function downloadBulkOperationResults(url: string): Promise<string> { | ||
| const response = await fetch(url) | ||
|
|
||
| if (!response.ok) { | ||
| throw new AbortError(`Failed to download bulk operation results: ${response.statusText}`) | ||
| } | ||
|
|
||
| return response.text() | ||
| } |
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 have this function in a different file? is just wrapping a call to fetch and a error? And is only used in a single place... best to put the call to fetch directly where it is needed. I'd say the tests don't add much value either (you are just testing an if)
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.
Yeah good question! It's really small and like you said, doesnt have any complexity to test. I waffled on whether it should be in its own file, and ultimately decided to, because we're going to want the same behaviour in the bulk status command (more info here) so may as well have it available to reuse.
I'm happy to just duplicate the function in both execute and status if you would prefer, since it's so simple, just a couple lines.
|
/snapit |
|
🫰✨ Thanks @gonzaloriestra! Your snapshot has been published to npm. Test the snapshot by installing your package globally: npm i -g --@shopify:registry=https://registry.npmjs.org @shopify/[email protected]Caution After installing, validate the version by running just |
| }), | ||
| 'output-file': Flags.string({ | ||
| description: 'The file path where results should be written. If not specified, results will be written to STDOUT.', | ||
| env: 'SHOPIFY_FLAG_OUTPUT_FILE', |
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.
In theory, if you add this it will throw an error when used without watch
| env: 'SHOPIFY_FLAG_OUTPUT_FILE', | |
| env: 'SHOPIFY_FLAG_OUTPUT_FILE', | |
| compatible: ['watch'], |
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.
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.
Let me know and I'm happy to add this in a followup though :)
packages/app/src/cli/services/bulk-operations/execute-bulk-operation.ts
Outdated
Show resolved
Hide resolved
packages/app/src/cli/services/bulk-operations/execute-bulk-operation.test.ts
Outdated
Show resolved
Hide resolved
d3ffc48 to
c8e62d6
Compare
de334e2 to
57c73ad
Compare
57c73ad to
989db7c
Compare
c8e62d6 to
4c19852
Compare
|
We detected some changes at Caution DO NOT create changesets for features which you do not wish to be included in the public changelog of the next CLI release. |
989db7c to
4b2da57
Compare


WHY are these changes introduced?
https://github.com/shop/issues-api-foundations/issues/1096
WHAT is this pull request doing?
Adds behaviour to
shopify app executeto match the designs:--watchand--output-fileare both provided, write results to that file after completion--watchis provided but--output-fileis not, write results to STDOUT after completion--watchis not provided, no change to behaviourHow to test your changes?
Try running
shopify app executewith--watchand--output-fileand verify it writes to the correct file:Then try doing the same thing without
--output-file, and verify it prints to STDOUT: