Skip to content

Commit

Permalink
docs(generator): update latest generator documentation (#2903)
Browse files Browse the repository at this point in the history
  • Loading branch information
asyncapi-bot authored Apr 24, 2024
1 parent b4c4988 commit 6ef4894
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
4 changes: 2 additions & 2 deletions pages/docs/tools/generator/installation-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ You can use the generator library to generate whatever you want in your event-dr

## Prerequisites
Before you install and use the AsyncAPI CLI and the generator library, ensure you meet the prerequisites below, then [install the CLI](#installation).
1. Node.js v12.16 and higher
2. Npm v6.13.7 and higher
1. Node.js v18.12.0 and higher
2. Npm v8.19.0 and higher

To verify the versions of Node and Npm you have, run the following command on your terminal:
```
Expand Down
20 changes: 16 additions & 4 deletions pages/docs/tools/generator/using-private-template.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,26 @@
title: "Using private templates"
weight: 180
---
Generator allows fetching the template from private repositories like Verdaccio, Nexus, npm, etc.
Generator allows fetching the template from private repositories like Verdaccio, Nexus, npm, etc.
By default, the generator fetches the template from the public npm registry configured in the npm configuration.
To fetch the template from a private registry, you need to provide the registry URL and authentication details in the .npmrc. For more information [read the docs](https://docs.npmjs.com/cli/v9/configuring-npm/npmrc).
However, you can override the default behavior by providing the registry URL and authentication details as arguments of the commandline.


## Private registry options:
## Private registry using .npmrc:
```bash
npm config set registry http://verdaccio:4873
npm config set //verdaccio:4873/:_auth=$(echo -n 'username:password' | base64)
```
* **npm config set registry** : Provide the registry URL that points to the registry URL.
* **npm config set _auth** : Provide the base64 encoded value that represents the username and password for basic auth.
* **npm config set _authToken** : Provide the access token generated by the registry.

## Private registry overriding arguments:

* **registry.url**: The URL of the registry where the private template is located. Defaults to `registry.npmjs.org`.
* **registry.auth**: An optional parameter to pass the npm registry username and password encoded with base64, formatted as `username:password`. For example, if the username and password are `admin` and `nimda`, you need to encode them with the base64 value like `admin:nimda` which results in `YWRtaW46bmltZGE=`.
**registry.token**: An optional parameter to pass to the npm registry authentication token. To get the token, you can first authenticate with the registry using `npm login` and then grab the generated token from the `.npmrc` file.
* **registry.token**: An optional parameter to pass to the npm registry authentication token. To get the token, you can first authenticate with the registry using `npm login` and then grab the generated token from the `.npmrc` file.

## Pulling private template using library:

Expand All @@ -26,4 +38,4 @@ const generator = new Generator('@asyncapi/html-template', 'output',
}
});
```
Assuming you host `@asyncapi/html-template` in a private package registry like Verdaccio. To pull this template, you need to provide `registry.url` option that points to the registry URL and `registry.auth` as a base64 encoded value that represents the username and password. Instead of username and password, you can also pass `registry.token`.
Assuming you host `@asyncapi/html-template` in a private package registry like Verdaccio. To pull this template, you need to provide `registry.url` option that points to the registry URL and `registry.auth` as a base64 encoded value that represents the username and password. Instead of username and password, you can also pass `registry.token`.

0 comments on commit 6ef4894

Please sign in to comment.