docs-util: reorder workflow execution examples (#10955)

* docs-util: reorder workflow execution examples

* reorder again

* add examples header
This commit is contained in:
Shahed Nasser
2025-01-14 11:52:50 +02:00
committed by GitHub
parent 4bc3f5b845
commit 98e77fad89
473 changed files with 13139 additions and 12637 deletions
@@ -39,7 +39,9 @@ export default function () {
})
}
return exampleStr.join("\n")
return `${Handlebars.helpers.titleLevel()} Examples\n\n${exampleStr.join(
"\n"
)}`
}
)
}
@@ -54,25 +56,6 @@ function getExecutionCodeTabs({
exampleCode = exampleCode.replace("```ts\n", "").replace("\n```", "")
return `<CodeTabs group="workflow-exection">
<CodeTab label="Another Workflow" value="another-workflow">
\`\`\`ts title="src/workflows/my-workflow.ts"
${beautifyCode(`import { createWorkflow } from "@medusajs/framework/workflows-sdk"
import { ${workflowName} } from "@medusajs/medusa/core-flows"
const myWorkflow = createWorkflow(
"my-workflow",
() => {
${exampleCode
.replace(`{ result }`, "result")
.replace(`await `, "")
.replace(`(container)`, "")
.replace(".run(", ".runAsStep(")}
}
)`)}
\`\`\`
</CodeTab>
<CodeTab label="API Route" value="api-route">
\`\`\`ts title="src/api/workflow/route.ts"
@@ -136,6 +119,25 @@ export const config = {
name: "run-once-a-day",
schedule: "0 0 * * *",
}`)}
\`\`\`
</CodeTab>
<CodeTab label="Another Workflow" value="another-workflow">
\`\`\`ts title="src/workflows/my-workflow.ts"
${beautifyCode(`import { createWorkflow } from "@medusajs/framework/workflows-sdk"
import { ${workflowName} } from "@medusajs/medusa/core-flows"
const myWorkflow = createWorkflow(
"my-workflow",
() => {
${exampleCode
.replace(`{ result }`, "result")
.replace(`await `, "")
.replace(`(container)`, "")
.replace(".run(", ".runAsStep(")}
}
)`)}
\`\`\`
</CodeTab>