-
Notifications
You must be signed in to change notification settings - Fork 126
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
New feature proposal - Add link to opportunities #113
New feature proposal - Add link to opportunities #113
Conversation
…re-optimizing-test
- Removed call to api. - Added test to options handler instead
- Merge branch 'feature-optimizing-test' of https://github.com/JuanMaRuiz/psi into feature-optimizing-test - Removed api-response-test
…iz/psi into feature-optimizing-test
Co-Authored-By: Shane Exterkamp <[email protected]>
Co-Authored-By: Shane Exterkamp <[email protected]>
* Update index file to use new api * Update googleapis dependency
* Add new option to show links to information about opportunities * Add test to cover new util that check the existence of url in a string
Hi @exterkamp any advance on it? |
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.
Review a long time coming, but overall this looks good! Just some small changes to make it air-tight!
@@ -0,0 +1,10 @@ | |||
const getLink = str => { | |||
const containsLink = str.match(/\(https?:(.*)\)/); |
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.
This seems like it would be more readable with a named group...something like
\((?<url>https?:.*)\)
and then it could be return containsLink.groups.url
So that there doesn't need to be any replacing of the "( )"s.
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.
Much better. Many thanks. Done
Unfortunately named groups seem to be not supported in node 8 https://travis-ci.com/github/GoogleChromeLabs/psi/jobs/378505545.
Should I keep the original implementation due the support of this library for node 8? Any other option?
* Negative assertion on string-utils.test. * More readable regexp with named groups. * Fix typo in cli.js help
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.
These changes look good to me. But I think node 8
is still failing, or is stuck on a stale build. So once that is cleared up this is good to go!
lib/string-utils.js
Outdated
@@ -0,0 +1,9 @@ | |||
const getLink = str => { | |||
const containsLink = str.match(/\((?<url>https?:.*)\)/); |
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.
Argh. Node 8 doesn't support named capture groups
We should go back to numbered groups then I suppose.
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.
Yep 😢 it's not supported in node v8.
I have reverted the changes. Let me know if you prefer another approach.
Hi @exterkamp! I was wondering if psi tool should show (on demand) some extra info as Page Speed Insights do.
Sometimes the information (or title) showed in the opportunities section is not enough. See issue #41.
So, here is my proposal. We could add the link to the opportunity so the user could navigate to the page from the terminal. If the user provides the option
--links
(no value needed) the link will be shown.Here a few examples:
Default behaviour No
--links
options provideWith
--links
optionsHere the display of the info looks different depending on the terminal. I have used terminal-link package. Here is the info about the support of this feature
Maybe the link could be shown in a different section an not as link of the opportunity field.
What do you think? Make sense for you this feature?
Best regards.