-
-
Notifications
You must be signed in to change notification settings - Fork 298
docs: add documents and postinstallation scripts for ag deprecation #1251
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 4 commits
3b2002a
d5402c8
ef5e6b4
709b694
3a8f015
e063238
6ab60db
9e7f010
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@asyncapi/generator": minor | ||
--- | ||
|
||
Start deprecating `cli.js` in the generator repository. | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,9 @@ This is a Monorepo managed using [Turborepo](https://turbo.build/) and contains | |
|
||
> 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. | ||
lmgyuan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
> **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. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remember that users do not understand waht also please use one of GH supported markdown alerts -> https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#alerts. Probably and last but no least:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
||
|
||
<!-- toc is generated with GitHub Actions do not remove toc markers --> | ||
|
||
<!-- toc --> | ||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,85 @@ | ||||||
--- | ||||||
title: "Deprecate Cli.js" | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. as in my other comment, it is not a source file that we deprecate but the AsyncAPI Generator CLI that has different technical name. See how others still promote it in template readme files -> https://github.com/asyncapi/java-spring-cloud-stream-template?tab=readme-ov-file#how-to-use-this-template as |
||||||
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. | ||||||
|
||||||
## Why Migrate? | ||||||
- **Enhanced Features:** The AsyncAPI CLI offers advanced features and improvements. | ||||||
- **Consistency:** Ensures consistent command usage across different environments. | ||||||
- **Support and Maintenance:** Future updates and support will focus on the AsyncAPI CLI. | ||||||
|
||||||
## Deprecated `ag/asyncapi-generator` Options and Their AsyncAPI CLI Equivalents | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. great work of preparing these equivalents!!! |
||||||
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>` | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
I guess here and in others, word |
||||||
|
||||||
- **--debug** | ||||||
- **AsyncAPI CLI Equivalent:** `asyncapi generate fromTemplate <ASYNCAPI> <TEMPLATE> --debug` | ||||||
|
||||||
- **-i, --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>` | ||||||
|
||||||
- **-o, --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>` | ||||||
|
||||||
- **--force-write** | ||||||
- **AsyncAPI CLI Equivalent:** `asyncapi generate fromTemplate <ASYNCAPI> <TEMPLATE> --force-write` | ||||||
|
||||||
- **--watch-template** | ||||||
- **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>` | ||||||
|
||||||
## Migration Steps | ||||||
|
||||||
### 1. Install AsyncAPI CLI | ||||||
First, ensure you have the AsyncAPI CLI installed: | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please add note that there are different methods that do not require setup of node environment -> https://www.asyncapi.com/docs/tools/cli/installation the best probably would be to use https://github.com/asyncapi/website/blob/master/assets/docs/fragments/cli-installation.md fragment - this is how to use it -> https://github.com/asyncapi/website/blob/master/markdown/docs/tutorials/generate-code.md?plain=1#L32 |
||||||
``` | ||||||
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: | ||||||
**Example Migration**: | ||||||
**Before Migration (Using Cli.js)**: | ||||||
``` | ||||||
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 | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if above |
||||||
``` | ||||||
|
||||||
### 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) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure we really need this one, even if 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. | ||||||
|
||||||
Happy coding! |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,7 +25,8 @@ | |
"lint:tpl:validator": "eslint --fix --config ../../.eslintrc ../../.github/templates-list-validator", | ||
"generate:readme:toc": "markdown-toc -i README.md", | ||
"generate:assets": "npm run docs && npm run generate:readme:toc", | ||
"bump:version": "npm --no-git-tag-version --allow-same-version version $VERSION" | ||
"bump:version": "npm --no-git-tag-version --allow-same-version version $VERSION", | ||
"postinstall": "node ./scripts/postinstall.js" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I know we talked about postinstallation as best option, but to be honest, I'm still in doubts. This notice will show up every-time someone installs generator, even if it is a dependency to AsyncAPI CLI - so during AsyncAPI CLI installation - at least I think so - something you would have to verify this means we will spam all generator users, even the ones not using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hmmmm my concern with having a warning only for invoking cli.js is that it would not be obvious? Since a lot of users probably already have cli.js as part of their code's workflow and don't really look at it anymore? But I can see this is also a problem for having a message during installation. If spamming users is a problem, I can shorten the message a bit so it would be as annoying. What do you think? |
||
}, | ||
"preferGlobal": true, | ||
"bugs": { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
console.log(` | ||
************************************* | ||
* * | ||
* DEPRECATION NOTICE * | ||
* * | ||
************************************* | ||
|
||
The use of 'Cli.js' 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 | ||
|
||
2. Update your commands: | ||
Replace the deprecated 'Cli.js' commands with their AsyncAPI CLI equivalents. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. better just link to the deprecation guide |
||
|
||
Example Migration: | ||
|
||
Before Migration (Using 'Cli.js'): | ||
$ node Cli.js ./asyncapi.yaml ./template -o ./output -p param1=value1 --debug --install --disable-hook hookType=hookName | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not |
||
|
||
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] | ||
|
||
Thank you for your understanding and cooperation. | ||
`); |
Uh oh!
There was an error while loading. Please reload this page.