diff --git a/packages/core/utils/src/dml/entity-builder.ts b/packages/core/utils/src/dml/entity-builder.ts index 6b449dab9e4a6..77d7578684314 100644 --- a/packages/core/utils/src/dml/entity-builder.ts +++ b/packages/core/utils/src/dml/entity-builder.ts @@ -254,11 +254,7 @@ export class EntityBuilder { * This method defines a float property that allows for * values with decimal places * - * :::note - * - * This property is only available after Medusa v2.1.2. - * - * ::: + * @version 2.1.2 * * @example * import { model } from "@medusajs/framework/utils" diff --git a/www/utils/packages/typedoc-config/tsdoc.json b/www/utils/packages/typedoc-config/tsdoc.json index d411c222d8fe6..6cd2912cfc53d 100644 --- a/www/utils/packages/typedoc-config/tsdoc.json +++ b/www/utils/packages/typedoc-config/tsdoc.json @@ -49,6 +49,10 @@ { "tagName": "@parentIgnore", "syntaxKind": "block" + }, + { + "tagName": "@version", + "syntaxKind": "block" } ] } \ No newline at end of file diff --git a/www/utils/packages/typedoc-plugin-markdown-medusa/src/render-utils.ts b/www/utils/packages/typedoc-plugin-markdown-medusa/src/render-utils.ts index 744c67a8b4c24..bc3a5cdb163db 100644 --- a/www/utils/packages/typedoc-plugin-markdown-medusa/src/render-utils.ts +++ b/www/utils/packages/typedoc-plugin-markdown-medusa/src/render-utils.ts @@ -76,6 +76,7 @@ import workflowDiagramHelper from "./resources/helpers/workflow-diagram" import workflowHooksHelper from "./resources/helpers/workflow-hooks" import ifMemberShowTitleHelper from "./resources/helpers/if-member-show-title" import signatureCommentHelper from "./resources/helpers/signature-comment" +import versionHelper from "./resources/helpers/version" import { MarkdownTheme } from "./theme" const TEMPLATE_PATH = path.join(__dirname, "resources", "templates") @@ -180,4 +181,5 @@ export function registerHelpers(theme: MarkdownTheme) { workflowHooksHelper(theme) ifMemberShowTitleHelper(theme) signatureCommentHelper() + versionHelper() } diff --git a/www/utils/packages/typedoc-plugin-markdown-medusa/src/resources/helpers/comments.ts b/www/utils/packages/typedoc-plugin-markdown-medusa/src/resources/helpers/comments.ts index 17f5de2fba1df..d707decc6e097 100644 --- a/www/utils/packages/typedoc-plugin-markdown-medusa/src/resources/helpers/comments.ts +++ b/www/utils/packages/typedoc-plugin-markdown-medusa/src/resources/helpers/comments.ts @@ -7,6 +7,7 @@ const EXCLUDED_TAGS = [ "@featureFlag", "@category", "@typeParamDefinition", + "@version", ] export default function () { diff --git a/www/utils/packages/typedoc-plugin-markdown-medusa/src/resources/helpers/version.ts b/www/utils/packages/typedoc-plugin-markdown-medusa/src/resources/helpers/version.ts new file mode 100644 index 0000000000000..7daf4a4491675 --- /dev/null +++ b/www/utils/packages/typedoc-plugin-markdown-medusa/src/resources/helpers/version.ts @@ -0,0 +1,20 @@ +import * as Handlebars from "handlebars" +import { Reflection } from "typedoc" + +export default function () { + Handlebars.registerHelper("version", function (reflection: Reflection) { + const versionTag = reflection.comment?.blockTags.find( + (tag) => tag.tag === "@version" + ) + + if (!versionTag) { + return "" + } + + const tagContent = versionTag.content + .map((content) => content.text) + .join("") + + return `:::note\n\nThis is only available after Medusa \`v${tagContent}\`.\n\n:::` + }) +} diff --git a/www/utils/packages/typedoc-plugin-markdown-medusa/src/resources/partials/member.declaration.hbs b/www/utils/packages/typedoc-plugin-markdown-medusa/src/resources/partials/member.declaration.hbs index c38c124f4a6e7..86706fd0c93c5 100755 --- a/www/utils/packages/typedoc-plugin-markdown-medusa/src/resources/partials/member.declaration.hbs +++ b/www/utils/packages/typedoc-plugin-markdown-medusa/src/resources/partials/member.declaration.hbs @@ -8,6 +8,8 @@ {{> comment}} +{{{version this}}} + {{/if}} {{#if (sectionEnabled "member_declaration_example")}} diff --git a/www/utils/packages/typedoc-plugin-markdown-medusa/src/resources/partials/member.react-query.signature.hbs b/www/utils/packages/typedoc-plugin-markdown-medusa/src/resources/partials/member.react-query.signature.hbs index 3ef6f0c38ddef..310a955de14af 100644 --- a/www/utils/packages/typedoc-plugin-markdown-medusa/src/resources/partials/member.react-query.signature.hbs +++ b/www/utils/packages/typedoc-plugin-markdown-medusa/src/resources/partials/member.react-query.signature.hbs @@ -22,6 +22,8 @@ {{/with}} +{{{version this}}} + {{/if}} {{#if (sectionEnabled "member_signature_example")}} diff --git a/www/utils/packages/typedoc-plugin-markdown-medusa/src/resources/partials/member.signature.hbs b/www/utils/packages/typedoc-plugin-markdown-medusa/src/resources/partials/member.signature.hbs index f089588eb3e27..75a53b9513da3 100644 --- a/www/utils/packages/typedoc-plugin-markdown-medusa/src/resources/partials/member.signature.hbs +++ b/www/utils/packages/typedoc-plugin-markdown-medusa/src/resources/partials/member.signature.hbs @@ -22,6 +22,8 @@ {{/with}} +{{{version this}}} + {{/if}} {{#if (sectionEnabled "member_signature_example")}} diff --git a/www/utils/packages/typedoc-plugin-markdown-medusa/src/resources/partials/member.step.hbs b/www/utils/packages/typedoc-plugin-markdown-medusa/src/resources/partials/member.step.hbs index 104133e78c27f..0be55889abcac 100644 --- a/www/utils/packages/typedoc-plugin-markdown-medusa/src/resources/partials/member.step.hbs +++ b/www/utils/packages/typedoc-plugin-markdown-medusa/src/resources/partials/member.step.hbs @@ -4,6 +4,8 @@ {{{signatureComment}}} +{{{version this}}} + {{/if}} {{#if (sectionEnabled "member_signature_example")}} diff --git a/www/utils/packages/typedoc-plugin-markdown-medusa/src/resources/partials/member.workflow.hbs b/www/utils/packages/typedoc-plugin-markdown-medusa/src/resources/partials/member.workflow.hbs index 138d42cfb4b89..6c975e642ffd8 100644 --- a/www/utils/packages/typedoc-plugin-markdown-medusa/src/resources/partials/member.workflow.hbs +++ b/www/utils/packages/typedoc-plugin-markdown-medusa/src/resources/partials/member.workflow.hbs @@ -4,6 +4,8 @@ {{> comment}} +{{{version this}}} + {{/if}} {{#if (sectionEnabled "member_signature_example")}}