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

[cli] vc project ls visual updates #8157

Merged
merged 36 commits into from Aug 11, 2022
Merged

Conversation

MatthewStanciu
Copy link
Contributor

@MatthewStanciu MatthewStanciu commented Jul 14, 2022

Related to #8102 & #8151. This PR updates the look of vc project ls:

  • Header names are cyan
  • A new "Latest Production URL" section

Before

Screen Shot 2022-08-11 at 10 46 03 AM

After

Screen Shot 2022-08-11 at 10 45 54 AM

📋 Checklist

Tests

  • The code changed/added as part of this PR has been covered with tests
  • All tests pass locally with yarn test-unit

Code Review

  • This PR has a concise title and thorough description useful to a reviewer
  • Issue from task tracker has a link to this PR

@MatthewStanciu MatthewStanciu changed the title vc project ls visual updates [cli] vc project ls visual updates Jul 14, 2022
@TooTallNate
Copy link
Member

Would be great IMO if we could use a clickable link to the project page under the project name section, instead of having an entire column for that. I'd prefer to print something like the production domain URL in that new column instead (also clickable 😄).

It's also not super clear to me what "Status" section is referring to, I'm not entirely convinced we need that column (the project card on the Vercel dashboard doesn't have the status dot, for comparison).

Copy link
Contributor

@Ethan-Arrowood Ethan-Arrowood left a comment

Choose a reason for hiding this comment

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

really like these visual improvement prs. take a look at my comments then I believe it is good to go

Comment on lines 70 to 80
.map(project => [
[
project.name,
chalk.bold(getInspectUrl(contextName, project.name)),
stateString(project.latestDeployments[0]?.readyState),
chalk.gray(ms(Date.now() - project.updatedAt)),
],
])
// flatten since the previous step returns a nested
// array of the deployment and (optionally) its instances
.flat(),
Copy link
Contributor

Choose a reason for hiding this comment

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

could you just remove the nested array now? It looks like its unnecessary

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The nested array is necessary—it's creating an array containing the pieces of data to appear under the header for each project, generating:

['project name', 'manage', 'updated'],
['name 1', 'vercel.com/user/name-1', '35s'],
['name 2', 'vercel.com/user/name-2', '1m']
// ...etc


export function stateString(s: string) {
const CIRCLE = '● ';
const sTitle = s && title(s);
Copy link
Contributor

Choose a reason for hiding this comment

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

s can't be undefined or null here (by type declaration) so remove the s && part.

Also, fwiw this kinda thing is a code smell IMO. && should really only be used for conditional expressions. I'd rather see an explicit s ? title(s) : 's is null/undefined case' expression instead

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍 Decided to remove the state string altogether after seeing Nate's comment

@MatthewStanciu
Copy link
Contributor Author

MatthewStanciu commented Jul 21, 2022

@TooTallNate @Ethan-Arrowood curious to hear your thoughts on this new behavior with terminal-link (screenshots in the original message have been updated).

terminal-link's default fallback does not look very good—here's what the "with terminal-link" case would look like on terminals that don't support it:

Screen Shot 2022-07-21 at 4 32 51 PM

My concern is that I'm not sure if it's bad to have the command behave differently based on whether the user's terminal supports hyperlinks. But also I think the command needs to look good on terminals that don't support hyperlinks.

Copy link
Contributor

@EndangeredMassa EndangeredMassa left a comment

Choose a reason for hiding this comment

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

I think the tests changed here may be broken, but maybe something else is going on. Let's check before merging.

packages/cli/src/commands/project/list.ts Show resolved Hide resolved
packages/cli/test/unit/commands/project.test.ts Outdated Show resolved Hide resolved
packages/cli/src/commands/project/index.ts Outdated Show resolved Hide resolved
[
chalk.bold(project.name),
getLatestProdUrl(project),
chalk.gray(ms(Date.now() - project.updatedAt)),
Copy link
Member

Choose a reason for hiding this comment

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

Was it intentional to drop the "ago" part?

@kodiakhq kodiakhq bot merged commit 0fcf172 into main Aug 11, 2022
@kodiakhq kodiakhq bot deleted the update/project-ls-visual-updates branch August 11, 2022 22:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: cli semver: minor PR contains new features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants