Skip to content

Add list builds command #582

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

Merged
merged 13 commits into from
Nov 8, 2021
Merged

Add list builds command #582

merged 13 commits into from
Nov 8, 2021

Conversation

anthmatic
Copy link
Contributor

@anthmatic anthmatic commented Oct 28, 2021

Description and Context

  • Adds hs project list-builds
  • Displays a table view of builds to provide an overview of each build
  • Marks the currently deployed build
  • Shows 10 builds by default, supports the --limit flag
  • Has simple paging (hoping to get feedback on this)

Screenshots

image

TODO

-Add links to project details UI

Who to Notify


trackCommandUsage('project-list-builds', { projectPath }, accountId);

const cwd = projectPath ? path.resolve(getCwd(), projectPath) : getCwd();
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe out of scope for this PR, but it looks like we could put this const cwd = projectPath ? path.resolve(getCwd(), projectPath) : getCwd();' into the getProjectConfig` util because we do it almost every time we call it.

Copy link
Contributor Author

@anthmatic anthmatic Nov 8, 2021

Choose a reason for hiding this comment

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

};

try {
const project = await fetchProject(accountId, projectConfig.name);
Copy link
Contributor

@brandenrodgers brandenrodgers Nov 4, 2021

Choose a reason for hiding this comment

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

Is it possible that this request fails? Are we handling that anywhere?

Edit: 🤦 all I had to do was read three lines down lol.. Ignore this

trackCommandUsage('project-list-builds', { projectPath }, accountId);

const cwd = projectPath ? path.resolve(getCwd(), projectPath) : getCwd();
const projectConfig = await getProjectConfig(cwd);
Copy link
Contributor

Choose a reason for hiding this comment

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

We should do a check for projectConfig here. I ran hs project list-builds some/bad/path and I get an error that says Cannot read property 'name' of null coming from this line here.

Maybe we could wrap up the error handling for missing project config into the getProjectConfig util? So all the commands that use it will get the error handling for free.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, that's a good call and a good idea. Will do

Copy link
Contributor Author

Choose a reason for hiding this comment

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

})
);
}
if (paging && paging.next) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry if this is already a known issue, but it looks like paging.next exists even if I only have one build. So this prompt is showing when it shouldn't.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep! This endpoint always returns an empty "last page" and I flagged with the BE folks and they have a fix in progress

const { projectConfig } = await getProjectConfig(projectPath);
const { projectConfig, projectDir } = await getProjectConfig(projectPath);

validateProjectConfig(projectConfig, projectDir);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just adding this while I'm here

Copy link
Contributor

@brandenrodgers brandenrodgers left a comment

Choose a reason for hiding this comment

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

Tested locally and works great!

@anthmatic anthmatic merged commit db78ff3 into master Nov 8, 2021
@anthmatic anthmatic deleted the add/project-list-builds branch November 8, 2021 21:14
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.

2 participants