From 9d29c6977fd6576e75a28ffd78c708945a86f5fc Mon Sep 17 00:00:00 2001 From: nickshoe <32668766+nickshoe@users.noreply.github.com> Date: Tue, 27 Jun 2023 11:57:20 +0200 Subject: [PATCH 1/4] docs: update template-development.md (#933) Co-authored-by: Florence Njeri <40742916+Florence-Njeri@users.noreply.github.com>%0ACo-authored-by: Lukasz Gornicki --- docs/template-development.md | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/docs/template-development.md b/docs/template-development.md index 28d921526..35af42ce4 100644 --- a/docs/template-development.md +++ b/docs/template-development.md @@ -11,20 +11,24 @@ Let's break down the minimum template requirements: the `template` directory and ### `template` directory -The `template` directory stores generated outputs in files. In other words, the generator processes all the files stored in this directory. +The `template` directory holds all the files that will be used for generating the output. The generator will process all the files stored in this directory. +The following code is an example of an `index.js` file inside the `template` folder. ```js import { File, Text } from "@asyncapi/generator-react-sdk"; -export default function({ asyncapi, params, originalAsyncAPI }) { -return ( +export default function ({ asyncapi, params, originalAsyncAPI }) { + return ( - My application's markdown file. - App name: **{ asyncapi.info().title() }** + My application's markdown file. + App name: **{asyncapi.info().title()}** -); + ); } ``` + +The above example will produce an `asyncapi.md` file where usage of the AsyncAPI document information (i.e. the `title`) is demonstrated. + ### `package.json` file Before the generation process begins, the generator installs the template into its dependencies. A `package.json` file is necessary to identify the template name. @@ -43,8 +47,6 @@ The following block shows an example `package.json` file that points to the [Rea } ``` -The above example of a `template/index.js` file shows the generation process result. The user also receives an `asyncapi.md` file with hardcoded and dynamic (application title from the AsyncAPI document) information. - Every template must depend on the [`@asyncapi/generator-react-sdk` package](https://github.com/asyncapi/generator-react-sdk), which contains a template file's basic components. ## Additional configuration options @@ -73,14 +75,16 @@ The following examples show some advanced configurations that we can use in our "name": "myTemplate", "generator": { "renderer": "react", - "supportedProtocols": "mqtt" + "supportedProtocols": [ + "mqtt" + ] }, "dependencies": { "@asyncapi/generator-react-sdk": "^0.2.25" } } ``` -The above `package.json` file has a newly added configuration called `supportedProtocols` which is set to `mqtt`. This configuration displays all the protocols that this template supports. You can have multiple supported protocols in our template. +The above `package.json` file has a newly added configuration called `supportedProtocols` which is set to a list containing only `mqtt`. This configuration displays all the protocols that this template supports. You can have multiple supported protocols in our template. For example, if you want to generate an output using the above template, you need to have an AsyncAPI document with servers that use `mqtt` to generate your desired output. If your AsyncAPI document has server connections with `kafka`, the generation process will be terminated since the only supported protocol mentioned is `mqtt`. @@ -93,7 +97,9 @@ Additionally, we can also have a configuration called `parameters`, which is an "name": "myTemplate", "generator": { "renderer": "react", - "supportedProtocols": "mqtt", + "supportedProtocols": [ + "mqtt" + ], "parameters": { "version": { "description": "Overrides application version under `info.version` in the AsyncAPI document.", From e3b731b6176478f896c4116b815c83d349239e2d Mon Sep 17 00:00:00 2001 From: Try Ajitiono Date: Wed, 28 Jun 2023 19:52:26 +0700 Subject: [PATCH 2/4] docs: fix JSDoc field for object parameter templateParams in Generator constructor (#999) --- lib/generator.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/generator.js b/lib/generator.js index fd34100ea..21851cc94 100644 --- a/lib/generator.js +++ b/lib/generator.js @@ -77,7 +77,7 @@ class Generator { * @param {String} templateName Name of the template to generate. * @param {String} targetDir Path to the directory where the files will be generated. * @param {Object} options - * @param {String} [options.templateParams] Optional parameters to pass to the template. Each template define their own params. + * @param {Object} [options.templateParams] Optional parameters to pass to the template. Each template define their own params. * @param {String} [options.entrypoint] Name of the file to use as the entry point for the rendering process. Use in case you want to use only a specific template file. Note: this potentially avoids rendering every file in the template. * @param {String[]} [options.noOverwriteGlobs] List of globs to skip when regenerating the template. * @param {Object} [options.disabledHooks] Object with hooks to disable. The key is a hook type. If key has "true" value, then the generator skips all hooks from the given type. If the value associated with a key is a string with the name of a single hook, then the generator skips only this single hook name. If the value associated with a key is an array of strings, then the generator skips only hooks from the array. From c6ba8c57036915dbe08bc6043f662c4e6a87ab1a Mon Sep 17 00:00:00 2001 From: asyncapi-bot Date: Wed, 28 Jun 2023 14:55:40 +0200 Subject: [PATCH 3/4] chore: update generated docs (#1000) --- docs/api.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/api.md b/docs/api.md index b51bc16d2..41fb622f7 100644 --- a/docs/api.md +++ b/docs/api.md @@ -47,7 +47,7 @@ Instantiates a new Generator object. - templateName `String` - Name of the template to generate. - targetDir `String` - Path to the directory where the files will be generated. - options `Object` - - [.templateParams] `String` - Optional parameters to pass to the template. Each template define their own params. + - [.templateParams] `Object.` - Optional parameters to pass to the template. Each template define their own params. - [.entrypoint] `String` - Name of the file to use as the entry point for the rendering process. Use in case you want to use only a specific template file. Note: this potentially avoids rendering every file in the template. - [.noOverwriteGlobs] `Array.` - List of globs to skip when regenerating the template. - [.disabledHooks] `Object.)>` - Object with hooks to disable. The key is a hook type. If key has "true" value, then the generator skips all hooks from the given type. If the value associated with a key is a string with the name of a single hook, then the generator skips only this single hook name. If the value associated with a key is an array of strings, then the generator skips only hooks from the array. From 1f3254ca3bbf625df07c3af5ba628ab5c3fc9593 Mon Sep 17 00:00:00 2001 From: asyncapi-bot Date: Thu, 29 Jun 2023 15:15:37 +0200 Subject: [PATCH 4/4] ci: update of files from global .github repo (#1001) --- .github/workflows/help-command.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/help-command.yml b/.github/workflows/help-command.yml index f4955c221..d4ba4a44c 100644 --- a/.github/workflows/help-command.yml +++ b/.github/workflows/help-command.yml @@ -27,13 +27,13 @@ jobs: repo: context.repo.repo, body: `Hello, @${{ github.actor }}! 👋🏼 - I'm Genie from the magic lamp. Looks like somebody needs a hand! 🆘 + I'm 🧞🧞🧞 Genie 🧞🧞🧞 from the magic lamp. Looks like somebody needs a hand! At the moment the following comments are supported in pull requests: - - `/ready-to-merge` or `/rtm` - This comment will trigger automerge of PR in case all required checks are green, approvals in place and do-not-merge label is not added - - `/do-not-merge` or `/dnm` - This comment will block automerging even if all conditions are met and ready-to-merge label is added - - `/autoupdate` or `/au` - This comment will add `autoupdate` label to the PR and keeps your PR up-to-date to the target branch's future changes. Unless there is a merge conflict or it is a draft PR.` + - \`/ready-to-merge\` or \`/rtm\` - This comment will trigger automerge of PR in case all required checks are green, approvals in place and do-not-merge label is not added + - \`/do-not-merge\` or \`/dnm\` - This comment will block automerging even if all conditions are met and ready-to-merge label is added + - \`/autoupdate\` or \`/au\` - This comment will add \`autoupdate\` label to the PR and keeps your PR up-to-date to the target branch's future changes. Unless there is a merge conflict or it is a draft PR.` }) create_help_comment_issue: @@ -51,10 +51,10 @@ jobs: repo: context.repo.repo, body: `Hello, @${{ github.actor }}! 👋🏼 - I'm Genie from the magic lamp. Looks like somebody needs a hand! 🆘 + I'm 🧞🧞🧞 Genie 🧞🧞🧞 from the magic lamp. Looks like somebody needs a hand! At the moment the following comments are supported in issues: - - `/good-first-issue {js | ts | java | go | docs | design | ci-cd} ` or `/gfi {js | ts | java | go | docs | design | ci-cd} ` - label an issue as a `good first issue`. - example: `/gfi js` or `/good-first-issue ci-cd` - }) + - \`/good-first-issue {js | ts | java | go | docs | design | ci-cd}\` or \`/gfi {js | ts | java | go | docs | design | ci-cd}\` - label an issue as a \`good first issue\`. + example: \`/gfi js\` or \`/good-first-issue ci-cd\`` + }) \ No newline at end of file