Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
I added a few suggestions thatwill make the docs more cohesive
  • Loading branch information
Florence-Njeri authored Jan 21, 2025
1 parent 2e79e6e commit 0a2e9d5
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
6 changes: 3 additions & 3 deletions .changeset/deprecation.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"@asyncapi/generator": minor
---

- Deprecation of `ag` CLI. It is deprecated in favour of the `AsyncAPI CLI` that a single entry point for all the AsyncAPI tools. No new features will be adde to `ag` and it will be completely removed. Official documentation of AsyncAPI Generator do not mention `ag` for over a year, and only `AsyncAPI CLI` and `asyncapi generate fromTemplate` are promoted. Read [migration guide](https://www.asyncapi.com/docs/tools/generator/migration-cli) that will help you understand how to migrate your `ag` commands to the new AsyncAPI CLI.
- **Deprecation of `ag` CLI**: The `ag` CLI is deprecated in favour of the `AsyncAPI CLI` that is a single entry point for all the AsyncAPI tools. No new features will be added to `ag` and it will be completely removed. The official documentation of AsyncAPI Generator has not mentioned `ag` for over a year, instead only using `AsyncAPI CLI` and `asyncapi generate fromTemplate` commands. Refer to the [migration guide](https://www.asyncapi.com/docs/tools/generator/migration-cli) that will help you understand how to migrate your `ag` commands to the new `AsyncAPI CLI` command.

- [Nunjucks render engine](https://www.asyncapi.com/docs/tools/generator/nunjucks-render-engine) is deprecated and will be removed in October 2025. Use [React render engine](https://www.asyncapi.com/docs/tools/generator/react-render-engine) instead. If you already use Nunjucks in production, read [migration guide](https://www.asyncapi.com/docs/tools/generator/migration-nunjucks-react) that will help you understand how to migrate to the new engine. Removal of Nunjucks render engine results also in removal of [Nunjucks-filters](apps/nunjucks-filters) library.
- **Deprecation of Nunjucks render engine:** The [Nunjucks render engine](https://www.asyncapi.com/docs/tools/generator/nunjucks-render-engine) is deprecated and will be removed in October 2025. It is recommended to switch to the [React render engine](https://www.asyncapi.com/docs/tools/generator/react-render-engine) instead. If you are using Nunjucks in production, read the [migration guide](https://www.asyncapi.com/docs/tools/generator/migration-nunjucks-react) that will help you understand how to migrate to the new engine. The removal of the Nunjucks render engine results also in removal of [Nunjucks-filters](apps/nunjucks-filters) library.

Removal of both deprecated parts of the generator are planned for October 2025, which gives you 9 months to migrate.
Removal of both deprecated parts of the generator is planned for October 2025, which gives you 9 months to migrate.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ This is a Monorepo managed using [Turborepo](https://turbo.build/) and contains
1. [Nunjucks-filters](apps/nunjucks-filters): This library contains generator filters that can be reused across multiple templates, helping to avoid redundant work. These filters are designed specifically for Nunjucks templates and are included by default with the generator, so there's no need to add them to dependencies separately.

[!IMPORTANT]
Deprecation Notice: The Nunjucks renderer engine is deprecated and will be removed in future releases. We strongly recommend using the React renderer engine instead, you can find how to migrate from Nunjucks to React in the [migration guide](apps/generator/docs/nunjucks-depreciate.md)
**Deprecation Notice:** The Nunjucks renderer engine is deprecated and will be removed in future releases. We strongly recommend using the React renderer engine instead. You can find how to migrate from Nunjucks to React in the [migration guide](apps/generator/docs/nunjucks-depreciate.md)

![npm](https://img.shields.io/npm/v/@asyncapi/generator?style=for-the-badge) ![npm](https://img.shields.io/npm/dt/@asyncapi/generator?style=for-the-badge)

Expand Down
8 changes: 4 additions & 4 deletions apps/generator/docs/migration-cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: "Migrating from `ag` CLI to AsyncAPI CLI"
weight: 260
---

This guide provides detailed instructions on how to transition from old `ag` Generator CLI to the new AsyncAPI CLI.
This guide provides detailed instructions on how to transition from the old `ag` Generator CLI to the new AsyncAPI CLI.

## Options Overview

Expand Down Expand Up @@ -40,11 +40,11 @@ Here is a list of `ag` options and their equivalents in the AsyncAPI CLI:

### 1. Install AsyncAPI CLI

There are multiple different artifacts that AsyncAPI CLI is provided as. Get familiar with [official CLI installation guide](https://www.asyncapi.com/docs/tools/cli/installation).
There are multiple different artifacts that AsyncAPI CLI is provided as. Get familiar with the [official CLI installation guide](https://www.asyncapi.com/docs/tools/cli/installation).

### 2. Update Your Commands

Replace the deprecated `ag` commands with their AsyncAPI CLI equivalents. Below are examples of how to update your commands:
Replace the deprecated `ag` commands with the AsyncAPI CLI equivalents. Below are examples of how to update your commands:

**Using `ag`**:
```
Expand All @@ -60,7 +60,7 @@ Notice that the change basically related to changing from `ag` to `asyncapi gene

### 3. Verify and Test

Run the updated commands to ensure they work as expected. Verify the output and ensure that all files are generated correctly.
Run the updated commands to ensure they work as expected and verify that the output files are generated correctly.

## Additional Resources

Expand Down
10 changes: 5 additions & 5 deletions apps/generator/docs/migration-nunjucks-react.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ npm install @asyncapi/generator-react-sdk

### 3. File naming

In Nunjucks, the template's filename directly corresponds to the output file. For example, a template named index.html will generate an index.html file.
In Nunjucks, the template's filename directly corresponds to the output file. For example, a template named **index.html** will generate an **index.html** file.

In React, the filename of the generated file is not controlled by the file itself, but rather by the File component. The React component itself can be named anything with a `.js` extension because the output filename is controlled by the `name` attribute of the `File` component used inside the template file. Below you can see some examples of filenames:
In React, the filename of the generated file is not controlled by the file itself, but rather by the `File` component. The React component itself can be named anything with a `.js` extension because the output filename is controlled by the `name` attribute of the `File` component used inside the template file. Below you can see some examples of filenames:

Nunjucks: `index.html`
React: `index.js` or `index.html.js` or `anything-you-want.js`
Expand Down Expand Up @@ -112,11 +112,11 @@ export default function({ asyncapi }) {

### 6. File template

Check [detailed guide on file templates](file-templates.md) to learn what is the difference between templating multiple file output in Nunjucks and React.
Check the [detailed guide on file templates](file-templates.md) to learn what is the difference between templating multiple file outputs in Nunjucks and React.

### 7. Models generation

If you have a template written with Nunjucks, it is almost certain that you have your own custom models/classes/types templates in place. Instead of migrating them to React render engine we strongly advise you to delegate models generation to AsyncAPI Modelina project. Learn more on [how to add models generation using Modelina](https://www.asyncapi.com/docs/tools/generator/model-generation).
If you have a template written with Nunjucks, it is almost certain that you have your own custom models, classes, or types templates in place. Instead of migrating them to React render engine we strongly advise you to delegate models generation to AsyncAPI Modelina project. Learn more about [how to add models generation using Modelina](https://www.asyncapi.com/docs/tools/generator/model-generation).

## Additional Resources and Information

Expand All @@ -137,7 +137,7 @@ After migrating, test your template thoroughly:
2. Compare the output with the previous Nunjucks template output
3. Check for any missing or incorrectly rendered content

You might want to consider implementing snapshot tests for your template before starting migration. This will ease the review of changes in content rendered after render engine changes. Snapshot tests allow you to have tests that will persist expected output from Nunjucks template, and compare it with output produced after you do the migration. Check the [example of such snapshot integration test for our internal react template we use for development and testing](https://github.com/asyncapi/generator/blob/master/apps/generator/test/integration.test.js#L66).
Consider implementing snapshot tests for your template before starting the migration. This will ease the review of changes in comparing the content rendered after render engine changes. Snapshot tests allow you to have tests that will persist expected output from Nunjucks template, and compare it with output generated after the migration. Check out an [example of such snapshot integration test for our internal react template we use for development and testing](https://github.com/asyncapi/generator/blob/master/apps/generator/test/integration.test.js#L66).

## Conclusion

Expand Down

0 comments on commit 0a2e9d5

Please sign in to comment.