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

Fix broken terminal links with zero width spaces #995

Merged
merged 5 commits into from Jan 3, 2023

Conversation

isaacroldan
Copy link
Contributor

@isaacroldan isaacroldan commented Jan 3, 2023

WHY are these changes introduced?

The terminal-link dependency adds a zero width space character to links.

Why?
Because if you show something like (https://shopify.com), the terminal will interpret that the last parenthesis is part of the URL like https://shopify.com) and that will break it. So you need to add a space before the parenthesis for it to work, like: ( https://shopify.com ) if you make that space then a zero-width space, it will look like there is nothing :)

BUT
The terminal will assume the space is part of the URL and although most webs will ignore it, some won't (the link to the chrome store for the post purchase extension is broken because of this)

This is a known issue of terminal-link that was reported a year ago but hasn't been fixed yet (not sure there is a fix possible...)

Fixes #991

WHAT is this pull request doing?

Add a normal space in the URLs instead of a zero-width one

BEFORE:
Captura de pantalla 2023-01-03 a las 15 17 07

AFTER:
Captura de pantalla 2023-01-03 a las 15 15 33

How to test your changes?

dev and links to the post-purchase chrome extension should work

Measuring impact

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

  • 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.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 3, 2023

Thanks for your contribution!

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

  • Themes: @shopify/theme-developer-tools
  • UI extensions: @shopify/ui-extensions-cli
    • Checkout UI extensions: @shopify/checkout-ui-extensions-api-stewardship
  • Hydrogen: @shopify/hydrogen
  • Other: @shopify/cli-foundations

@github-actions
Copy link
Contributor

github-actions bot commented Jan 3, 2023

Coverage report

St.
Category Percentage Covered / Total
🟡 Statements
67.76% (+0.02% 🔼)
3512/5183
🟡 Branches 62.3% 1137/1825
🟡 Functions
66.25% (+0.03% 🔼)
893/1348
🟡 Lines
67.99% (+0.01% 🔼)
3347/4923

Test suite run success

881 tests passing in 455 suites.

Report generated by 🧪jest coverage report action from bb4f83d

@isaacroldan isaacroldan marked this pull request as ready for review January 3, 2023 14:48
@github-actions

This comment has been minimized.

@isaacroldan isaacroldan requested review from a team, matteodepalo and pepicrft and removed request for a team January 3, 2023 14:48
return terminalLink(colors.green(stringifyMessage(this.value)), this.link ?? '')
const text = colors.green(stringifyMessage(this.value))
const url = this.link ?? ''
return terminalLink(text, url, {fallback: () => `${text} ( ${url} )`})
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd add a test that captures why the parenthesis is needed:

test("the link includes spaces between the URL and the parenthesis for command/control click to work", () => {
  // ...
})

Copy link
Contributor Author

Choose a reason for hiding this comment

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

you're right, added

@github-actions
Copy link
Contributor

github-actions bot commented Jan 3, 2023

Benchmark report

The following table contains a summary of the startup time for all commands.

Status Command Baseline Current Diff
🟢 app build 1245 ms 1245 ms 0 %
🟢 app deploy 1305 ms 1305 ms 0 %
🟢 app dev 1317 ms 1317 ms 0 %
🟢 app env pull 1267 ms 1267 ms 0 %
🟢 app env show 1301 ms 1301 ms 0 %
🟢 app generate extension 1309 ms 1309 ms 0 %
🟢 app generate schema 1289 ms 1289 ms 0 %
🟢 app info 1245 ms 1245 ms 0 %
🟢 app scaffold extension 1269 ms 1269 ms 0 %
🟢 theme check 1225 ms 1225 ms 0 %
🟢 theme delete 1234 ms 1234 ms 0 %
🟢 theme dev 1248 ms 1248 ms 0 %
🟢 theme help-old 1235 ms 1235 ms 0 %
🟢 theme info 1245 ms 1245 ms 0 %
🟢 theme init 1234 ms 1234 ms 0 %
🟢 theme language-server 1237 ms 1237 ms 0 %
🟢 theme list 1248 ms 1248 ms 0 %
🟢 theme open 1232 ms 1232 ms 0 %
🟢 theme package 1235 ms 1235 ms 0 %
🟢 theme publish 1237 ms 1237 ms 0 %
🟢 theme pull 1249 ms 1249 ms 0 %
🟢 theme push 1245 ms 1245 ms 0 %
🟢 theme share 1236 ms 1236 ms 0 %
🟢 webhook trigger 1227 ms 1227 ms 0 %

@isaacroldan isaacroldan merged commit dabb179 into main Jan 3, 2023
@isaacroldan isaacroldan deleted the fix-broken-terminal-links branch January 3, 2023 15:25
@shopify-shipit shopify-shipit bot temporarily deployed to production January 3, 2023 18:45 Inactive
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.

[Bug]: CLI issues 404 extension addresses
3 participants