Skip to content

Commit

Permalink
update PR
Browse files Browse the repository at this point in the history
- delete unnecessary warning
- add more context to the changeset documentation.
- modify deprecate-cli.js-ag.md
- -o and -p instead of --output and --param
- delete enable watch mode part in the deprecation readMe
- delete replace cli.js in postinstall.js with ag
- add a link to the deprecation guide in the postinstall.js
- add an installation url in the postinstall.js
  • Loading branch information
lmgyuan committed Sep 16, 2024
1 parent 3a8f015 commit e063238
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 31 deletions.
4 changes: 3 additions & 1 deletion .changeset/start_clijs_deprecation.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@
"@asyncapi/generator": minor
---

Start deprecating `cli.js` in the generator repository.
Start deprecating `ag` in the generator repository. The purpose of deprecating the `ag` option for documentation generation is to move people's
attention to use the `AsyncAPI CLI` in order to maintain a single entry point for all the AsyncAPI tools.
Otherwise, the maintainers need to manually update the `ag` option in the generator repository every time a new version of the `AsyncAPI CLI` is released.
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@ This is a Monorepo managed using [Turborepo](https://turbo.build/) and contains

![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)

> warning: This package doesn't support AsyncAPI 1.x anymore. We recommend to upgrade to the latest AsyncAPI version using the [AsyncAPI converter](https://github.com/asyncapi/converter-js) (You can refer to [installation guide](/apps/generator//docs//installation-guide.md)). If you need to convert documents on the fly, you may use the [Node.js](https://github.com/asyncapi/converter-js) or [Go](https://github.com/asyncapi/converter-go) converters.
> **Deprecation Notice**: The use of `cli.js` for documentation generation is deprecated and will be removed in future releases. We strongly encourage migrating to the new AsyncAPI CLI. The migration process is straightforward, and you can find the necessary steps in our [migration guide](/apps/generator/docs/deprecate-cli.sj-ag.md). Please ensure that your projects are updated accordingly to avoid any disruptions.
[!IMPORTANT]
Deprecation Notice: The use of ag for documentation generation is deprecated and will be removed in future releases. We strongly encourage migrating to the new AsyncAPI CLI.

<!-- toc is generated with GitHub Actions do not remove toc markers -->

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
---
title: "Deprecate Cli.js"
title: "Deprecate ag"
weight: 170
---

# Migration Guide from “ag/asyncapi-generator” to AsyncAPI CLI

## Overview
With the introduction of the AsyncAPI CLI, the use of `Cli.js` for documentation generation in the AsyncAPI generator repository is being deprecated. This guide provides detailed instructions on how to transition from `ag` to the new AsyncAPI CLI.
With the introduction of the AsyncAPI CLI, the use of `ag` for documentation generation in the AsyncAPI generator repository is being deprecated. This guide provides detailed instructions on how to transition from `ag` to the new AsyncAPI CLI.

## Why Migrate?
- **Enhanced Features:** The AsyncAPI CLI offers advanced features and improvements.
Expand All @@ -17,31 +17,31 @@ With the introduction of the AsyncAPI CLI, the use of `Cli.js` for documentation
Here is a list of `ag/asyncapi-generator` options and their equivalents in the AsyncAPI CLI:

- **-d, --disable-hook [hooks...]**
- **AsyncAPI CLI Equivalent:** `asyncapi generate fromTemplate <ASYNCAPI> <TEMPLATE> --disable-hook <hookType>=<hookName>`
- **AsyncAPI CLI equivalent:** `asyncapi generate fromTemplate <ASYNCAPI> <TEMPLATE> --disable-hook <hookType>=<hookName>`

- **--debug**
- **AsyncAPI CLI Equivalent:** `asyncapi generate fromTemplate <ASYNCAPI> <TEMPLATE> --debug`
- **AsyncAPI CLI equivalent:** `asyncapi generate fromTemplate <ASYNCAPI> <TEMPLATE> --debug`

- **-i, --install**
- **AsyncAPI CLI Equivalent:** `asyncapi generate fromTemplate <ASYNCAPI> <TEMPLATE> --install`
- **AsyncAPI CLI equivalent:** `asyncapi generate fromTemplate <ASYNCAPI> <TEMPLATE> --install`

- **-n, --no-overwrite <glob>**
- **AsyncAPI CLI Equivalent:** `asyncapi generate fromTemplate <ASYNCAPI> <TEMPLATE> --no-overwrite <glob>`
- **AsyncAPI CLI equivalent:** `asyncapi generate fromTemplate <ASYNCAPI> <TEMPLATE> --no-overwrite <glob>`

- **-o, --output <outputDir>**
- **AsyncAPI CLI Equivalent:** `asyncapi generate fromTemplate <ASYNCAPI> <TEMPLATE> --output <outputDir>`
- **AsyncAPI CLI equivalent:** `asyncapi generate fromTemplate <ASYNCAPI> <TEMPLATE> --output <outputDir>`

- **-p, --param <name=value>**
- **AsyncAPI CLI Equivalent:** `asyncapi generate fromTemplate <ASYNCAPI> <TEMPLATE> --param <name=value>`
- **AsyncAPI CLI equivalent:** `asyncapi generate fromTemplate <ASYNCAPI> <TEMPLATE> --param <name=value>`

- **--force-write**
- **AsyncAPI CLI Equivalent:** `asyncapi generate fromTemplate <ASYNCAPI> <TEMPLATE> --force-write`
- **AsyncAPI CLI equivalent:** `asyncapi generate fromTemplate <ASYNCAPI> <TEMPLATE> --force-write`

- **--watch-template**
- **AsyncAPI CLI Equivalent:** `asyncapi generate fromTemplate <ASYNCAPI> <TEMPLATE> --watch`
- **AsyncAPI CLI equivalent:** `asyncapi generate fromTemplate <ASYNCAPI> <TEMPLATE> --watch`

- **--map-base-url <url:folder>**
- **AsyncAPI CLI Equivalent:** `asyncapi generate fromTemplate <ASYNCAPI> <TEMPLATE> --map-base-url <url:folder>`
- **AsyncAPI CLI equivalent:** `asyncapi generate fromTemplate <ASYNCAPI> <TEMPLATE> --map-base-url <url:folder>`

## Migration Steps

Expand All @@ -52,34 +52,28 @@ npm install -g @asyncapi/cli
```

### 2. Update Your Commands
Replace the deprecated Cli.js commands with their AsyncAPI CLI equivalents. Below are examples of how to update your commands:
Replace the deprecated ag commands with their AsyncAPI CLI equivalents. Below are examples of how to update your commands:
**Example Migration**:
**Before Migration (Using Cli.js)**:
**Before Migration (Using ag)**:
```
ag ./asyncapi.yaml ./template -o ./output -p param1=value1 --debug --install --disable-hook hookType=hookName
```

**After Migration (Using AsyncAPI CLI)**:
```
asyncapi generate fromTemplate ./asyncapi.yaml ./template --output ./output --param param1=value1 --debug --install --disable-hook hookType=hookName
asyncapi generate fromTemplate ./asyncapi.yaml ./template -o ./output -p param1=value1 --debug --install --disable-hook hookType=hookName
```

### 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.

### 4. Enable Watch Mode (Optional)
If you were using the `--watch-template` option, you can now use the watch mode in the AsyncAPI CLI:
```
asyncapi generate fromTemplate ./asyncapi.yaml ./template --output ./output --watch
```

## Additional Resources
**CLI Documentation**: [AsyncAPI CLI Documentation](https://www.asyncapi.com/docs/tools/cli)
**Installation**: [AsyncAPI CLI Installation](https://www.asyncapi.com/docs/tools/cli/installation)
**Usage**: [AsyncAPI CLI Usage](https://www.asyncapi.com/docs/tools/cli/usage)
**Support**: For any issues or questions, please create an issue in our [CLI repository](https://github.com/asyncapi/cli).

## Conclusion
By following this migration guide, you can smoothly transition from Cli.js to the AsyncAPI CLI, taking advantage of its enhanced features and improved performance. If you have any questions or need further assistance, feel free to contact us.
By following this migration guide, you can smoothly transition from ag to the AsyncAPI CLI, taking advantage of its enhanced features and improved performance. If you have any questions or need further assistance, feel free to contact us.

Happy coding!
14 changes: 9 additions & 5 deletions apps/generator/scripts/postinstall.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,33 @@
const migrationGuideUrl = '../docs/deprecate-cli.js-ag.md'

Check failure on line 1 in apps/generator/scripts/postinstall.js

View workflow job for this annotation

GitHub Actions / Test NodeJS PR - ubuntu-latest

Missing semicolon
const installationGuideUrl = 'https://github.com/asyncapi/website/blob/master/assets/docs/fragments/cli-installation.md'

Check failure on line 2 in apps/generator/scripts/postinstall.js

View workflow job for this annotation

GitHub Actions / Test NodeJS PR - ubuntu-latest

Missing semicolon

console.log(`
*************************************
* *
* DEPRECATION NOTICE *
* *
*************************************
The use of 'Cli.js' for documentation generation is deprecated and will be removed in future releases.
The use of 'ag' for documentation generation is deprecated and will be removed in future releases.
Please migrate to the new AsyncAPI CLI using the following guide:
1. Install AsyncAPI CLI:
$ npm install -g @asyncapi/cli
For other installation methods, visit ${installationGuideUrl}
2. Update your commands:
Replace the deprecated 'Cli.js' commands with their AsyncAPI CLI equivalents.
Replace the deprecated 'ag' commands with their AsyncAPI CLI equivalents.
Example Migration:
Before Migration (Using 'Cli.js'):
$ node Cli.js ./asyncapi.yaml ./template -o ./output -p param1=value1 --debug --install --disable-hook hookType=hookName
Before Migration (Using 'ag'):
$ ag ./asyncapi.yaml ./template -o ./output -p param1=value1 --debug --install --disable-hook hookType=hookName
After Migration (Using AsyncAPI CLI):
$ asyncapi generate fromTemplate ./asyncapi.yaml ./template --output ./output --param param1=value1 --debug --install --disable-hook hookType=hookName
For more details, please visit: [Migration Guide URL]
For more details, please visit: ${migrationGuideUrl}
Thank you for your understanding and cooperation.
`);

0 comments on commit e063238

Please sign in to comment.