-
-
Notifications
You must be signed in to change notification settings - Fork 238
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: add support to pull templates from private npm repository #877
Conversation
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.
Welcome to AsyncAPI. Thanks a lot for creating your first pull request. Please check out our contributors guide useful for opening a pull request.
Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.
@derberg did you have a chance to review this one? |
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.
@alextrs nice! looks pretty clean, thanks for the contribution.
Some feedback for now:
- will you also contribute it to the CLI? https://github.com/asyncapi/cli
- please update docs as well in this PR. But maybe once we have the final implementation. @Florence-Njeri @pratik2315 What do you think, do we need separate markdown file or rather update one of the existing documents? and which one?
- did you already test it in your workflows? does it work as expected with arborist?
- I think it would be better to have all registry-related options in one option, just like with
templateParams
argument. So instead of passingoptions.registry
it would beoptions.registry.registryUrl
, sooptions.registry
would be an object of additional options. Wdyt?
Since @alextrs has added the functionality to pull templates from private github repositories, I feel it should go in one of the template docs. Here's what I think:
What do you think about it @derberg @Florence-Njeri @alextrs |
@derberg @Florence-Njeri @pratik2315 once we merge this PR I will add it to CLI with documentation (it is ready, just need new version of library). It will be something like this
I also tested it through locally built CLI and it works. |
@alextrs I think you missed some of my questions. @pratik2315 good cal with |
@derberg pushed few changes based on your feedback. Added notes to template.md, let me know if more needed. |
Kudos, SonarCloud Quality Gate passed! |
@@ -123,6 +134,8 @@ class Generator { | |||
this.hooks = {}; | |||
/** @type {Object} Maps schema URL to folder. */ | |||
this.mapBaseUrlToFolder = mapBaseUrlToFolder; | |||
/** @type {Object} Npm registry information. */ |
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.
for better jsdoc experience can you please:
- add above class type definition for the
registry
option like https://github.com/asyncapi/parser-js/blob/master/lib/parser.js#L46-L53 - If you call this type
RegistryOptions
then/** @type {Object} Npm registry information. */
will have to be/** @type {RegistryOptions} Npm registry information. */
. If I'm not mistaken as a result we will get a nice API docs generated - I think that once you add
typedef
as described above, then you can also reuse it in jsdoc for the constructor, so you do not have to repeat all these options and descriptions as they are there now
if (invalidOptions.length) throw new Error(`These options are not supported by the generator: ${invalidOptions.join(', ')}`); | ||
if (options && options.registry) { | ||
const invalidRegOptions = getInvalidOptions(REGISTRY_OPTIONS, options.registry || []); | ||
if (invalidRegOptions.length) throw new Error(`There invalid parameters were specified to configure private registry: ${invalidRegOptions.join(', ')}`); |
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.
if (invalidRegOptions.length) throw new Error(`There invalid parameters were specified to configure private registry: ${invalidRegOptions.join(', ')}`); | |
if (invalidRegOptions.length) throw new Error(`These options are not supported by the generator to configure private registry: ${invalidRegOptions.join(', ')}`); |
@alextrs do you need some help to complete this one? |
I'm currently blocked from using AsyncAPI Generator because I can't use my own template that is hosted in our private github package. I'm available to help or test this, let me know! @alextrs |
This pull request has been automatically marked as stale because it has not had recent activity 😴 It will be closed in 120 days if no further activity occurs. To unstale this pull request, add a comment with detailed explanation. There can be many reasons why some specific pull request has no activity. The most probable cause is lack of time, not lack of interest. AsyncAPI Initiative is a Linux Foundation project not owned by a single for-profit company. It is a community-driven initiative ruled under open governance model. Let us figure out together how to push this pull request forward. Connect with us through one of many communication channels we established here. Thank you for your patience ❤️ |
Hi @derberg , what exactly do you want me to do, I'm not sure to understand your previous comment :) Thanks! |
I'm asking if you can open a separate PR that is a copy of this + includes current feedback for the implementation |
@derberg Why do you want a copy of this PR when we can only reopen it and work directly on it? :) |
it is not yet closed. I just think it is easier to start fresh as the creator of PR is no longer responsive |
closing in favour of #1061 |
Description
Extend library to support private repository parameters based on @derberg suggestion
Once merged I will push another PR to CLI to support these new parameters
Related issue(s)
Resolves #538, closes PR #673