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

feat: on asyncapi new give users the ability to select an example as a starting point #131

Merged

Conversation

boyney123
Copy link
Contributor

@boyney123 boyney123 commented Nov 5, 2021

Feature

asyncapi new at the moment creates a new asyncapi file only using the simple.yaml example.

This feature allows users to use an example (from here https://github.com/asyncapi/spec/tree/master/examples) as a starting point (which is an extra optional question).

Why

Just gives people more options and ways to start with AsyncAPI vs getting started with the default file.

For example if the user is interested in WebSockets they could select our web sockets example as a starting point.

How it works

image

  • new script has been added which will fetch a zip file from https://github.com/asyncapi/spec, idea from @derberg
  • new script will unzip the contents, find the examples and make this data accessible to the user on the CLI
  • the parser is also used to display user friendly info based on templates.

If you want to watch 📹 it in action: https://asyncapi.slack.com/files/U020GN9C6FM/F02L5152LTG/cli-with-examples.mp4

Notes

The whole feature is optional, the user can still continue without picking any examples, and if no examples have been fetched the CLI will continue to work and user will be not be asked the question.

@boyney123 boyney123 marked this pull request as draft November 5, 2021 15:01
@boyney123 boyney123 changed the title Select examples from GitHub spec feat: on asyncapi new give users the ability to select an example as a starting point Nov 5, 2021
@boyney123
Copy link
Contributor Author

Hey @derberg any thoughts on this pull model for the examples?

@boyney123
Copy link
Contributor Author

@boyney123 boyney123 marked this pull request as ready for review November 8, 2021 09:43
scripts/fetch-asyncapi-example.js Outdated Show resolved Hide resolved
src/commands/new.ts Outdated Show resolved Hide resolved
src/commands/new.ts Outdated Show resolved Hide resolved
@boyney123 boyney123 self-assigned this Nov 8, 2021
src/commands/new.ts Outdated Show resolved Hide resolved
Copy link
Member

@magicmatatjahu magicmatatjahu left a comment

Choose a reason for hiding this comment

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

Only one suggestion :)

scripts/fetch-asyncapi-example.js Outdated Show resolved Hide resolved
boyney123 and others added 2 commits November 8, 2021 16:56
Co-authored-by: Maciej Urbańczyk <urbanczyk.maciej.95@gmail.com>
Co-authored-by: Fran Méndez <fmvilas@gmail.com>
src/commands/new.ts Outdated Show resolved Hide resolved
scripts/fetch-asyncapi-example.js Outdated Show resolved Hide resolved
Copy link
Member

@Souvikns Souvikns left a comment

Choose a reason for hiding this comment

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

Should we add the asset folder to the files object in the package.json

@boyney123
Copy link
Contributor Author

Should we add the asset folder to the files object in the package.json

Thanks @Souvikns! Forgot about that, all done 🙇

Co-authored-by: Fran Méndez <fmvilas@gmail.com>
magicmatatjahu
magicmatatjahu previously approved these changes Nov 9, 2021
Souvikns
Souvikns previously approved these changes Nov 9, 2021
magicmatatjahu
magicmatatjahu previously approved these changes Nov 10, 2021
fmvilas
fmvilas previously approved these changes Nov 10, 2021
Copy link
Member

@magicmatatjahu magicmatatjahu left a comment

Choose a reason for hiding this comment

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

LGTM! 🚀

@sonarcloud
Copy link

sonarcloud bot commented Nov 18, 2021

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@magicmatatjahu magicmatatjahu merged commit dadfb8c into asyncapi:master Nov 18, 2021
@asyncapi-bot
Copy link
Contributor

🎉 This PR is included in version 0.9.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants