docs-util: reorder workflow execution examples (#10955)
* docs-util: reorder workflow execution examples * reorder again * add examples header
This commit is contained in:
+22
-20
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user