Skip to content
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

docs-util: support @version tag #10591

Merged
merged 1 commit into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions packages/core/utils/src/dml/entity-builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 4 additions & 0 deletions www/utils/packages/typedoc-config/tsdoc.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@
{
"tagName": "@parentIgnore",
"syntaxKind": "block"
},
{
"tagName": "@version",
"syntaxKind": "block"
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -180,4 +181,5 @@ export function registerHelpers(theme: MarkdownTheme) {
workflowHooksHelper(theme)
ifMemberShowTitleHelper(theme)
signatureCommentHelper()
versionHelper()
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const EXCLUDED_TAGS = [
"@featureFlag",
"@category",
"@typeParamDefinition",
"@version",
]

export default function () {
Expand Down
Original file line number Diff line number Diff line change
@@ -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:::`
})
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

{{> comment}}

{{{version this}}}

{{/if}}

{{#if (sectionEnabled "member_declaration_example")}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@

{{/with}}

{{{version this}}}

{{/if}}

{{#if (sectionEnabled "member_signature_example")}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@

{{/with}}

{{{version this}}}

{{/if}}

{{#if (sectionEnabled "member_signature_example")}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

{{{signatureComment}}}

{{{version this}}}

{{/if}}

{{#if (sectionEnabled "member_signature_example")}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

{{> comment}}

{{{version this}}}

{{/if}}

{{#if (sectionEnabled "member_signature_example")}}
Expand Down
Loading