Skip to content

Commit

Permalink
Merge branch 'master' into integrate-new-parser-api
Browse files Browse the repository at this point in the history
  • Loading branch information
jonaslagoni authored Mar 20, 2023
2 parents 67588b4 + 03d83e8 commit 1c79050
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/add-good-first-issue-labels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
repo: context.repo.repo,
})).data.map(label => label.name);
const shouldBeRemoved = currentLabels.filter(label => (label.startsWith('area/') && !label.endsWith(area));
const shouldBeRemoved = currentLabels.filter(label => (label.startsWith('area/') && !label.endsWith(area)));
shouldBeRemoved.forEach(label => {
github.rest.issues.deleteLabel({
owner: context.repo.owner,
Expand Down
19 changes: 18 additions & 1 deletion .github/workflows/if-nodejs-pr-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,24 @@ jobs:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- if: "github.event.pull_request.draft == false &&!((github.actor == 'asyncapi-bot' && startsWith(github.event.pull_request.title, 'ci: update global workflows')) || (github.actor == 'asyncapi-bot' && startsWith(github.event.pull_request.title, 'chore(release):')) || (github.actor == 'allcontributors' && startsWith(github.event.pull_request.title, 'docs: add')))"
- if: >
!github.event.pull_request.draft && !(
(github.actor == 'asyncapi-bot' && (
startsWith(github.event.pull_request.title, 'ci: update global workflows') ||
startsWith(github.event.pull_request.title, 'chore: update code of conduct') ||
startsWith(github.event.pull_request.title, 'ci: update global contribution guide') ||
startsWith(github.event.pull_request.title, 'ci: update workflows for go projects') ||
startsWith(github.event.pull_request.title, 'ci: update workflows for nodejs projects') ||
startsWith(github.event.pull_request.title, 'ci: update release-related workflows for nodejs projects') ||
startsWith(github.event.pull_request.title, 'ci: update semantic release config file') ||
startsWith(github.event.pull_request.title, 'ci: update generic workflows') ||
startsWith(github.event.pull_request.title, 'ci: update workflows for docker-based projects') ||
startsWith(github.event.pull_request.title, 'chore(release):')
)) ||
(github.actor == 'allcontributors' &&
startsWith(github.event.pull_request.title, 'docs: add')
)
)
id: should_run
name: Should Run
run: echo "::set-output name=shouldrun::true"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/welcome-first-time-contrib.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const issueMessage = `Welcome to AsyncAPI. Thanks a lot for reporting your first issue. Please check out our [contributors guide](https://github.com/asyncapi/community/blob/master/CONTRIBUTING.md) and the instructions about a [basic recommended setup](https://github.com/asyncapi/.github/blob/master/git-workflow.md) useful for opening a pull request.<br />Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out [this issue](https://github.com/asyncapi/asyncapi/issues/115).`;
const issueMessage = `Welcome to AsyncAPI. Thanks a lot for reporting your first issue. Please check out our [contributors guide](https://github.com/asyncapi/community/blob/master/CONTRIBUTING.md) and the instructions about a [basic recommended setup](https://github.com/asyncapi/community/blob/master/git-workflow.md) useful for opening a pull request.<br />Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out [this issue](https://github.com/asyncapi/asyncapi/issues/115).`;
const prMessage = `Welcome to AsyncAPI. Thanks a lot for creating your first pull request. Please check out our [contributors guide](https://github.com/asyncapi/community/blob/master/CONTRIBUTING.md) useful for opening a pull request.<br />Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out [this issue](https://github.com/asyncapi/asyncapi/issues/115).`;
if (!issueMessage && !prMessage) {
throw new Error('Action must have at least one of issue-message or pr-message set');
Expand Down
14 changes: 7 additions & 7 deletions docs/react-render-engine.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ weight: 110
When writing React templates you decide whether to use CommonJS, ES5, or ES6 modules since everything is bundled together before the rendering process takes over. We use our own React renderer which can be found in the [Generator React SDK](https://github.com/asyncapi/generator-react-sdk).
There you can find information about how the renderer works or how we transpile your template files.

Your React template always require `@asyncapi/generator-react-sdk` as a dependency. `@asyncapi/generator-react-sdk` is required to access the `File` component which is required as a root component for a file to be rendered. Furthermore it provides some common components to make your development easier, like `Text` or `Indent`.
Your React template always requires `@asyncapi/generator-react-sdk` as a dependency. `@asyncapi/generator-react-sdk` is required to access the `File` component which is required as a root component for a file to be rendered. Furthermore, it provides some common components to make your development easier, like `Text` or `Indent`.

Let's consider a basic React template as the one below called `MyTemplate.js`:

Expand All @@ -33,23 +33,23 @@ export default function({ asyncapi, params, originalAsyncAPI }) {

The exported default function returns a `File` component as a root component which the generator uses to determine what file should be generated. In our case, we overwrite the default functionality of saving the file as `MyTemplate.js` but instead use the filename `asyncapi.md`. It is then specified that we should render `Some text that should render as is\n` within that file. Notice the `\n` character at the end, which is automatically added after the `Text` component.

For further information about components, props etc. see the [Generator React SDK](https://github.com/asyncapi/generator-react-sdk)
For further information about components, props, etc, see the [Generator React SDK](https://github.com/asyncapi/generator-react-sdk)

### Common assumptions

1. Generator renders all files located in the `template` directory if they meet the following conditions:
- `File` is the root component
- The file is not in the list of `nonRenderableFiles` in the template configuration
1. New lines are automatically added after each `Text` component.
1. The props you have access to in rendering function is:
- `asyncapi` that is a parsed spec file object. Read the [API](https://github.com/asyncapi/parser-js/blob/master/API.md#AsyncAPIDocument) of the Parser to understand what structure you have access to in this parameter.
- `originalAsyncAPI` that is an original spec file before it is parsed.
1. The props you have access to in the rendering function are:
- `asyncapi` which is a parsed spec file object. Read the [API](https://github.com/asyncapi/parser-js/blob/master/API.md#AsyncAPIDocument) of the Parser to understand what structure you have access to in this parameter.
- `originalAsyncAPI` which is an original spec file before it is parsed.
- `params` that contain the parameters provided when generating.
1. All the file templates are supported where the variables are provided after the default props as listed above.

### Debugging React template in VSCode

With React, it enables you to debug your templates. For Visual Studio Code, we have created a boilerplate [launch configuration](https://code.visualstudio.com/docs/editor/debugging#_launch-configurations) to enable debug in your template. Add the following launch configuration:
With React, it enables you to debug your templates. For Visual Studio Code, we have created a boilerplate [launch configuration](https://code.visualstudio.com/docs/editor/debugging#_launch-configurations) to enable debugging in your template. Add the following launch configuration:

```json
{
Expand All @@ -75,6 +75,6 @@ With React, it enables you to debug your templates. For Visual Studio Code, we h
}
```

Now replace `./asyncapi.yml` with your document of choice. Replace `./template` with the path to your React template. You can now debug your template by adding any breakpoints you want and inspect your code.
Now replace `./asyncapi.yml` with your document of choice. Replace `./template` with the path to your React template. You can now debug your template by adding any breakpoints you want and inspecting your code.


2 changes: 1 addition & 1 deletion docs/template.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ AsyncAPI has a list of available templates to enhance your generation process. T

Template Name | Description | Source code
---|---|---
`@asyncapi/nodejs-template` | Generates Node.js service that uses Hermes package | [Nodej.s template](https://github.com/asyncapi/nodejs-template)
`@asyncapi/nodejs-template` | Generates Node.js service that uses Hermes package | [Node.js template](https://github.com/asyncapi/nodejs-template)
`@asyncapi/nodejs-ws-template` | Generates Node.js service that supports WebSocket protocol only | [Node.js WebSocket template](https://github.com/asyncapi/nodejs-ws-template)
`@asyncapi/java-template` | Generates Java JMS application | [Java template](https://github.com/asyncapi/java-template)
`@asyncapi/java-spring-template` | Generates Java Spring service | [Java spring template](https://github.com/asyncapi/java-spring-template)
Expand Down
16 changes: 8 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@asyncapi/generator",
"version": "1.9.15",
"version": "1.9.17",
"description": "The AsyncAPI generator. It can generate documentation, code, anything!",
"main": "./lib/generator.js",
"bin": {
Expand Down

0 comments on commit 1c79050

Please sign in to comment.