From 044af3f211170f7c5d609bbdb32c91a8da83f648 Mon Sep 17 00:00:00 2001 From: Shahed Nasser Date: Tue, 14 Jan 2025 18:47:56 +0200 Subject: [PATCH] docs-util: add exception for workflow examples modification + show summary instead of comment (#10963) * docs-util: add exception for workflow examples modification + show summary instead of comment * add currency and country code in example * add common IDs --- .../src/resources/helpers/workflow-diagram.ts | 8 +++++--- .../src/resources/helpers/workflow-examples.ts | 5 ++++- www/utils/packages/utils/src/examples-utils.ts | 7 ++++++- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/www/utils/packages/typedoc-plugin-markdown-medusa/src/resources/helpers/workflow-diagram.ts b/www/utils/packages/typedoc-plugin-markdown-medusa/src/resources/helpers/workflow-diagram.ts index b8924f8547ac0..e572da7ca5320 100644 --- a/www/utils/packages/typedoc-plugin-markdown-medusa/src/resources/helpers/workflow-diagram.ts +++ b/www/utils/packages/typedoc-plugin-markdown-medusa/src/resources/helpers/workflow-diagram.ts @@ -101,9 +101,11 @@ function getStep({ return { type, name: document.name, - description: associatedReflection?.comment - ? Handlebars.helpers.comments(associatedReflection.comment, true) - : "", + description: associatedReflection?.comment?.summary + ? Handlebars.helpers.comment(associatedReflection.comment.summary) + : associatedReflection?.comment + ? Handlebars.helpers.comments(associatedReflection.comment, true) + : "", link: type === "hook" || !associatedReflection?.url ? `#${document.name}` diff --git a/www/utils/packages/typedoc-plugin-markdown-medusa/src/resources/helpers/workflow-examples.ts b/www/utils/packages/typedoc-plugin-markdown-medusa/src/resources/helpers/workflow-examples.ts index 7891f8560cf0d..40d80fd5f8575 100644 --- a/www/utils/packages/typedoc-plugin-markdown-medusa/src/resources/helpers/workflow-examples.ts +++ b/www/utils/packages/typedoc-plugin-markdown-medusa/src/resources/helpers/workflow-examples.ts @@ -24,7 +24,10 @@ export default function () { } else { exampleTags.forEach((exampleTag) => { exampleTag.content.forEach((part) => { - if (part.kind !== "code") { + if ( + part.kind !== "code" || + part.text.startsWith("```ts workflow={false}") + ) { exampleStr.push(part.text) return } diff --git a/www/utils/packages/utils/src/examples-utils.ts b/www/utils/packages/utils/src/examples-utils.ts index 71cfc18c2121b..2ceb46fc69e8c 100644 --- a/www/utils/packages/utils/src/examples-utils.ts +++ b/www/utils/packages/utils/src/examples-utils.ts @@ -266,10 +266,15 @@ export function getFakeStrValue({ `id_${faker.string.alphanumeric({ length: { min: 10, max: 20 }, })}`, + region_id: "reg_123", + product_id: "prod_123", + cart_id: "cart_123", + order_id: "order_123", name: () => faker.person.firstName(), email: () => faker.internet.email(), password: () => faker.internet.password({ length: 8 }), - currency: () => faker.finance.currencyCode(), + currency_code: () => faker.finance.currencyCode().toLowerCase(), + country_code: () => faker.location.countryCode().toLowerCase(), title: () => faker.lorem.word(), description: () => faker.lorem.sentence(), url: () => faker.internet.url(),