From 462d64b061c213d9aedfd3280ba4ff2c141bd831 Mon Sep 17 00:00:00 2001 From: Ludovic Dussart Date: Wed, 17 Feb 2021 12:06:29 +0100 Subject: [PATCH] feat: add version parameter to allow version override (#67) see asyncapi/html-template#107 --- README.md | 8 +++++--- components/Info.js | 4 ++-- package.json | 4 ++++ template/asyncapi.js | 2 +- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 2fd8a026a..fb2f61be5 100644 --- a/README.md +++ b/README.md @@ -17,9 +17,11 @@ npm install -g @asyncapi/generator ## Supported parameters -|Name|Description|Required|Default|Example| -|---|---|---|---|---| -|outFilename|The filename of the output file.|No|`asyncapi.md`|`index.md`| +|Name|Description|Required|Default|Allowed values|Example| +|---|---|---|---|---|---| +|outFilename|The filename of the output file.|No|`asyncapi.md`|*Any* with `.md` extension|`index.md`| +|version|Override the version of your application provided under `info.version` location in the specification file.|No|Version is taken from the specification file.|Version is taken from the spec file. |`1.0.0`| + ## Development diff --git a/components/Info.js b/components/Info.js index df005667a..52746bdb5 100644 --- a/components/Info.js +++ b/components/Info.js @@ -2,12 +2,12 @@ import { Text } from "@asyncapi/generator-react-sdk"; import { Header, Link, Image } from "./common"; -export function Info({ asyncapi }) { +export function Info({ asyncapi, params }) { const info = asyncapi.info(); return ( <>
- {info.title()} {info.version()} documentation + {info.title()} {params.version || info.version()} documentation
{info.description() && ( diff --git a/package.json b/package.json index 921797506..c5c5797b8 100644 --- a/package.json +++ b/package.json @@ -70,6 +70,10 @@ "description": "The name of the output markdown file", "default": "asyncapi.md", "required": false + }, + "version": { + "description": "Override the version of your application provided under `info.version` location in the specification file.", + "required": false } } } diff --git a/template/asyncapi.js b/template/asyncapi.js index 548bafa15..89801680b 100644 --- a/template/asyncapi.js +++ b/template/asyncapi.js @@ -8,7 +8,7 @@ import { Channels } from "../components/Channels"; export default function({ asyncapi, params }) { return ( - +