-
Notifications
You must be signed in to change notification settings - Fork 67
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
Conversation
|
||
trackCommandUsage('project-list-builds', { projectPath }, accountId); | ||
|
||
const cwd = projectPath ? path.resolve(getCwd(), projectPath) : getCwd(); |
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.
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.
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.
Handling this here https://github.com/HubSpot/hubspot-cli/pull/580/files#diff-fa4fa15b34bd2259fc2c24ec990fdbaa6492e6030d940700895318b399058174R64
(Different PR)
}; | ||
|
||
try { | ||
const project = await fetchProject(accountId, projectConfig.name); |
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.
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); |
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.
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.
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.
Ah, that's a good call and a good idea. Will do
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.
I forgot we have validateProjectConfig()
for this. Added here: https://github.com/HubSpot/hubspot-cli/pull/582/files#diff-36a35fb191a893b8f5de180e0cc2bd7656d4c00c972ef65a9687a6e3f8304817R67
}) | ||
); | ||
} | ||
if (paging && paging.next) { |
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.
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.
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! 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); |
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.
Just adding this while I'm here
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.
Tested locally and works great!
Description and Context
hs project list-builds
--limit
flagScreenshots
TODO
-Add links to project details UI
Who to Notify