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

Roll hs init step into hs project upload #564

Merged
merged 6 commits into from
Sep 29, 2021
Merged

Conversation

anthmatic
Copy link
Contributor

@anthmatic anthmatic commented Sep 23, 2021

Description and Context

Now as part of the hs project upload command, we:

  • make sure that a config exists, and if not- prompt the user to run hs project init
  • check to see if the project exists in the account and if not, prompt the user to create it

When no config is found:

[ERROR] Project config not found. Try running 'hs project init' first.

When config is found but project doesn't exist in account:

? The project test12 does not exist in 123. Would you like to create it? (Y/n)

Screenshots

TODO

The next step here is to rename and update the existing hs project init function to hs project create and build out that command

Who to Notify

try {
await fetchProject(accountId, projectName);
} catch (err) {
if (err.statusCode === 404) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This may not be worth supporting, but what if we get a 500 or some other internal error code?

Copy link
Contributor Author

Choose a reason for hiding this comment

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


validateProjectConfig(projectConfig);
await ensureProjectExists(accountId, projectConfig.name);
Copy link
Contributor

Choose a reason for hiding this comment

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

Are we sure that accountId exists here? I was seeing an issue when testing this (sometime last week) where it was logging The project <Project name> does not exist in undefined. Would you like to create it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hmm.. it's possible that was before 370500c but I will double check this

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So yeah, I believe accountId should always exist here. If it doesn't https://github.com/HubSpot/hubspot-cli/pull/564/files#diff-1989a521c805539a7ae5e60fa3f7b0f79d83106bbb225045cf33f831abf97757R98 should be ending the process

@brandenrodgers
Copy link
Contributor

I had two questions, but otherwise this looks good to me 👌

@anthmatic anthmatic merged commit 04215c1 into master Sep 29, 2021
@anthmatic anthmatic deleted the improve-hs-upload branch September 29, 2021 15: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