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

PDE-3732 feat(cli): Implement individual field flags for register command #618

Merged
merged 21 commits into from
Feb 16, 2023

Conversation

gregilo
Copy link
Contributor

@gregilo gregilo commented Feb 6, 2023

This PR adds prompts for required information when running zapier register. It also allows users to pass these values in via flags.

packages/cli/src/oclif/commands/register.js Outdated Show resolved Hide resolved
packages/cli/src/oclif/commands/register.js Outdated Show resolved Hide resolved
packages/cli/src/oclif/commands/register.js Show resolved Hide resolved
packages/cli/src/oclif/commands/register.js Outdated Show resolved Hide resolved
packages/cli/src/oclif/commands/register.js Outdated Show resolved Hide resolved
allowNo: true,
}),
},
});
RegisterCommand.examples = [
'zapier register',
'zapier register "My Cool Integration"',
Copy link
Member

Choose a reason for hiding this comment

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

Can we add some more examples here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@eliangcs I added more here - 286afb7. Do you think these are thorough enough?

gregilo and others added 11 commits February 10, 2023 14:58
Remove non-functional "Learn more" text from homepage URL flag description

Co-authored-by: Kola Erinoso <kola-er@users.noreply.github.com>
…egister.js

Co-authored-by: Chang-Hung Liang <chang-hung.liang@zapier.com>
…ds/register.js

Co-authored-by: Chang-Hung Liang <chang-hung.liang@zapier.com>
…f/hooks/getAppRegistrationFieldChoices.js

Co-authored-by: Chang-Hung Liang <chang-hung.liang@zapier.com>
This enables us to see all available options when running `zapier register --help`
Copy link
Member

@eliangcs eliangcs left a comment

Choose a reason for hiding this comment

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

I added a few more suggestions in the review. To summarize what we've discussed, I think this is ready to merge once these are also addressed:

  • write unit tests for the register command
    • use nock to mock fields-choices endpoint
    • remove test-related code from register.js
    • remove smoke tests
  • add the 140-char limit check for the --description flag
  • add some valid examples for the register command
  • add ?formId=create in the API call so subscription gets saved (related Slack conversation)

packages/cli/src/oclif/ZapierBaseCommand.js Outdated Show resolved Hide resolved
packages/cli/src/oclif/commands/register.js Outdated Show resolved Hide resolved
packages/cli/src/oclif/commands/register.js Outdated Show resolved Hide resolved
tests

* Move nock from devDependencies to dependencies in CLI package.json
* Add chai to devDependencies (requirement of @oclif/test)
* Remove mock/testing code from getAppRegistrationFieldChoices hook
* This commit refactors the prompt validation to allow for multiple custom
validators
* This commit refactors the RegisterCommand tests to be more uniform
  with the BaseCommand test
@gregilo gregilo requested a review from kola-er February 14, 2023 01:05
gregilo and others added 3 commits February 14, 2023 17:36
* This commit also utilizes nock for API requests in "zapier register should enforce character limits on flags" test cases
Copy link
Member

@eliangcs eliangcs left a comment

Choose a reason for hiding this comment

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

I made two additional changes in the test code:

  • hide stdout/stderr
  • replace fs.existsSync with fs.statSync

Now this looks really good. Nice work, thanks!

@gregilo
Copy link
Contributor Author

gregilo commented Feb 16, 2023

@eliangcs Nice! I was struggling to hide stdout/stderr for some reason on my local, so I'm glad you updated that. I'm going to merge this PR now.

@gregilo gregilo merged commit 493df57 into main Feb 16, 2023
@gregilo gregilo deleted the PDE-3732 branch February 16, 2023 21:47
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.

None yet

3 participants