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

Theme Push: Change progress bar writestream to stderr #3765

Merged
merged 2 commits into from
Apr 30, 2024

Conversation

jamesmengo
Copy link
Contributor

@jamesmengo jamesmengo commented Apr 20, 2024

WHY are these changes introduced?

Addresses some of the issues raised in

I think the DX for CI users could use some attention when resourcing allows (output logging, troubleshooting tips when flags are missing, etc)


For future contributors: I'm following Command Line Interface Guidelines here

WHAT is this pull request doing?

  • Sends theme-uploader progress bar output to stderr

The Ink library used by CLI-kit writes this to stdout by default - this is causing the stream to get polluted, breaking operations such as shopify theme push --json | jq .

Risk: If someone is reading the values of stderr we may have just introduced a problem there instead. An alternative would be to write to a silent writestream instead - Example Here

How to test your changes?

Try running
pnpm shopify theme push --path <theme_path> --json | jq .
pnpm shopify theme push --path <theme_path> --json 1> stdout.txt 2> stderr.rtxt

Note: Don't test with the --verbose flag - outputDebug writes everything stdout (for now). This will have to be addressed separately if it gets changed

Measuring impact

How do we know this change was effective? Please choose one:

  • [ x] n/a - this doesn't need measurement, e.g. a linting rule or a bug-fix
  • Existing analytics will cater for this addition
  • PR includes analytics changes to measure impact

Checklist

  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've considered possible documentation changes
  • I've made sure that any changes to dev or deploy have been reflected in the internal flowchart.

Copy link
Contributor

Thanks for your contribution!

Depending on what you are working on, you may want to request a review from a Shopify team:

  • Themes: @shopify/advanced-edits
  • UI extensions: @shopify/ui-extensions-cli
    • Checkout UI extensions: @shopify/checkout-ui-extensions-api-stewardship
  • Hydrogen: @shopify/hydrogen
  • Other: @shopify/app-management

Copy link
Contributor

github-actions bot commented Apr 20, 2024

Coverage report

St.
Category Percentage Covered / Total
🟡 Statements
72.03% (+0.19% 🔼)
6998/9715
🟡 Branches
68.97% (+0.25% 🔼)
3450/5002
🟡 Functions
71.29% (+0.03% 🔼)
1862/2612
🟡 Lines
73.36% (+0.21% 🔼)
6602/9000
Show new covered files 🐣
St.
File Statements Branches Functions Lines
🟢
... / find-app-info.ts
100% 100% 100% 100%
Show files with reduced coverage 🔻
St.
File Statements Branches Functions Lines
🟢
... / app.ts
86.18% (+0.07% 🔼)
74.63% (+1.79% 🔼)
87.8% (-1.33% 🔻)
87.62% (+0.32% 🔼)
🟢
... / extension-instance.ts
85.71% (-0.12% 🔻)
80.41%
90.48% (-0.22% 🔻)
87.39% (-0.11% 🔻)
🔴
... / trigger.ts
38.46% (-0.67% 🔻)
0%
58.33% (-1.67% 🔻)
36% (-0.36% 🔻)
🟢
... / context.ts
92.25% (-0.06% 🔻)
86.5% (-0.77% 🔻)
87.88%
92.95% (-0.03% 🔻)
🟢
... / link.ts
95.89% (-0.06% 🔻)
71.88% 100%
95.71% (-0.06% 🔻)
🟢
... / trigger.ts
97.62% (-2.38% 🔻)
77.78% (-5.56% 🔻)
100%
97.62% (-2.38% 🔻)

Test suite run success

1659 tests passing in 769 suites.

Report generated by 🧪jest coverage report action from ea177a1

@jamesmengo jamesmengo changed the title Theme Push: render progress bar to stderr Theme Push: render progress bar to stderr instead of stdout Apr 22, 2024
@jamesmengo jamesmengo changed the title Theme Push: render progress bar to stderr instead of stdout Theme Push: Change progress bar writestream to stderr Apr 22, 2024
@jamesmengo jamesmengo self-assigned this Apr 22, 2024
@jamesmengo jamesmengo requested a review from karreiro April 22, 2024 16:46
@jamesmengo jamesmengo added the Area: @shopify/theme @shopify/theme package issues label Apr 22, 2024
@jamesmengo jamesmengo requested a review from a team April 22, 2024 16:49
@jamesmengo jamesmengo marked this pull request as ready for review April 22, 2024 16:49

This comment has been minimized.

@jamesmengo jamesmengo force-pushed the jmeng/renderTaskstoStdErr branch from db6e33c to b9090a9 Compare April 22, 2024 16:53
@jamesmengo jamesmengo force-pushed the jmeng/renderTaskstoStdErr branch from b9090a9 to ea177a1 Compare April 24, 2024 16:13
if (tasks.length > 0) {
await renderTasks(tasks, {renderOptions: {stdout: process.stderr}})
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure where the best place to put this is - since many of our commands in the themes space are used in CI, we should probably use this by default rather than renderTasks

Copy link
Contributor

@karreiro karreiro Apr 30, 2024

Choose a reason for hiding this comment

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

I personally believe this should be the default options on CLI kit, but it's ok to restrict the scope of the change for now :)

Copy link
Contributor

@karreiro karreiro left a comment

Choose a reason for hiding this comment

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

Thank you, @jamesmengo! LGTM 🚀

@jamesmengo jamesmengo added this pull request to the merge queue Apr 30, 2024
Merged via the queue into main with commit ab5ebec Apr 30, 2024
1 check passed
@jamesmengo jamesmengo deleted the jmeng/renderTaskstoStdErr branch April 30, 2024 16:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: @shopify/theme @shopify/theme package issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants