docs: fixes and preparations for workflows reference (#8579)
- Fix the merger configuration that adds the correct slug / sidebar labels - Add an overview page for the workflows reference. - Fixes to components and build scripts
This commit is contained in:
1 parent
6f50e376a9
commit
cd0acbd921
7 files changed
+59
-45
No files matched your search
@@ -0,0 +1,13 @@
|
|||||||
|
import { ChildDocs } from "docs-ui"
|
||||||
|
|
||||||
|
export const metadata = {
|
||||||
|
title: `Medusa Workflows Reference`,
|
||||||
|
}
|
||||||
|
|
||||||
|
# {metadata.title}
|
||||||
|
|
||||||
|
This section of the documentation provides a reference to the workflows created by Medusa. These workflows are used in the Store and Admin API routes.
|
||||||
|
|
||||||
|
You can use these workflows in your customizations as well. They're available in the `@medusajs/core-flows` package.
|
||||||
|
|
||||||
|
<ChildDocs childLevel={2} />
|
||||||
@@ -683,6 +683,10 @@ export const filesMap = [
|
|||||||
"filePath": "/www/apps/resources/app/medusa-container-resources/page.mdx",
|
"filePath": "/www/apps/resources/app/medusa-container-resources/page.mdx",
|
||||||
"pathname": "/medusa-container-resources"
|
"pathname": "/medusa-container-resources"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"filePath": "/www/apps/resources/app/medusa-workflows-reference/page.mdx",
|
||||||
|
"pathname": "/medusa-workflows-reference"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"filePath": "/www/apps/resources/app/nextjs-starter/page.mdx",
|
"filePath": "/www/apps/resources/app/nextjs-starter/page.mdx",
|
||||||
"pathname": "/nextjs-starter"
|
"pathname": "/nextjs-starter"
|
||||||
|
|||||||
@@ -3,10 +3,9 @@
|
|||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "yarn prep && next dev",
|
"dev": "next dev",
|
||||||
"dev:monorepo": "yarn prep && yarn dev -p 3003",
|
"dev:monorepo": "yarn dev -p 3003",
|
||||||
"build": "next build",
|
"build": "next build",
|
||||||
"build:dev": "NODE_ENV=test yarn prep && yarn build",
|
|
||||||
"start": "next start",
|
"start": "next start",
|
||||||
"start:monorepo": "yarn start -p 3003",
|
"start:monorepo": "yarn start -p 3003",
|
||||||
"lint": "next lint --fix",
|
"lint": "next lint --fix",
|
||||||
|
|||||||
@@ -45,6 +45,10 @@ export default async function getCoreFlowsRefSidebarChildren(): Promise<
|
|||||||
const childDirPath = path.join(namespaceBasePath, childDir.name)
|
const childDirPath = path.join(namespaceBasePath, childDir.name)
|
||||||
const childFile = readdirSync(childDirPath)
|
const childFile = readdirSync(childDirPath)
|
||||||
|
|
||||||
|
if (!childFile.length) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
const sidebarItem = await getSidebarItemLink({
|
const sidebarItem = await getSidebarItemLink({
|
||||||
filePath: path.join(childDirPath, childFile[0]),
|
filePath: path.join(childDirPath, childFile[0]),
|
||||||
basePath: projPath,
|
basePath: projPath,
|
||||||
|
|||||||
@@ -42,11 +42,11 @@ export const Card = ({
|
|||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
{startIcon}
|
{startIcon}
|
||||||
<div className="flex items-start gap-docs_1 justify-between flex-1">
|
<div className="flex items-start gap-docs_1 justify-between flex-1 max-w-full">
|
||||||
<div className={clsx("flex flex-col", contentClassName)}>
|
<div className={clsx("flex flex-col max-w-full", contentClassName)}>
|
||||||
{title && (
|
{title && (
|
||||||
<span className={clsx(badge && "flex gap-docs_0.5")}>
|
<span className={clsx(badge && "flex gap-docs_0.5")}>
|
||||||
<span className="text-compact-medium-plus text-medusa-fg-base">
|
<span className="text-compact-medium-plus text-medusa-fg-base block truncate">
|
||||||
{title}
|
{title}
|
||||||
</span>
|
</span>
|
||||||
{badge && <Badge {...badge} />}
|
{badge && <Badge {...badge} />}
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ type ChildDocsProps = {
|
|||||||
hideItems?: string[]
|
hideItems?: string[]
|
||||||
showItems?: string[]
|
showItems?: string[]
|
||||||
hideTitle?: boolean
|
hideTitle?: boolean
|
||||||
|
childLevel?: number
|
||||||
}
|
}
|
||||||
|
|
||||||
export const ChildDocs = ({
|
export const ChildDocs = ({
|
||||||
@@ -18,6 +19,7 @@ export const ChildDocs = ({
|
|||||||
showItems,
|
showItems,
|
||||||
type = "sidebar",
|
type = "sidebar",
|
||||||
hideTitle = false,
|
hideTitle = false,
|
||||||
|
childLevel = 1,
|
||||||
}: ChildDocsProps) => {
|
}: ChildDocsProps) => {
|
||||||
const { currentItems, getActiveItem } = useSidebar()
|
const { currentItems, getActiveItem } = useSidebar()
|
||||||
const filterType = useMemo(() => {
|
const filterType = useMemo(() => {
|
||||||
@@ -79,6 +81,32 @@ export const ChildDocs = ({
|
|||||||
}
|
}
|
||||||
}, [currentItems, type, getActiveItem, filterItems])
|
}, [currentItems, type, getActiveItem, filterItems])
|
||||||
|
|
||||||
|
const getChildrenForLevel = (
|
||||||
|
item: SidebarItemType,
|
||||||
|
currentLevel = 1
|
||||||
|
): SidebarItemType[] | undefined => {
|
||||||
|
if (currentLevel === childLevel) {
|
||||||
|
return item.children
|
||||||
|
}
|
||||||
|
if (!item.children) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const childrenResult: SidebarItemType[] = []
|
||||||
|
|
||||||
|
item.children.forEach((child) => {
|
||||||
|
const childChildren = getChildrenForLevel(child, currentLevel + 1)
|
||||||
|
|
||||||
|
if (!childChildren) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
childrenResult.push(...childChildren)
|
||||||
|
})
|
||||||
|
|
||||||
|
return childrenResult
|
||||||
|
}
|
||||||
|
|
||||||
const getTopLevelElms = (items?: SidebarItemType[]) => (
|
const getTopLevelElms = (items?: SidebarItemType[]) => (
|
||||||
<CardList
|
<CardList
|
||||||
items={
|
items={
|
||||||
@@ -93,7 +121,8 @@ export const ChildDocs = ({
|
|||||||
|
|
||||||
const getAllLevelsElms = (items?: SidebarItemType[]) =>
|
const getAllLevelsElms = (items?: SidebarItemType[]) =>
|
||||||
items?.map((item, key) => {
|
items?.map((item, key) => {
|
||||||
const HeadingComponent = item.children?.length
|
const itemChildren = getChildrenForLevel(item)
|
||||||
|
const HeadingComponent = itemChildren?.length
|
||||||
? MDXComponents["h2"]
|
? MDXComponents["h2"]
|
||||||
: undefined
|
: undefined
|
||||||
|
|
||||||
@@ -104,7 +133,7 @@ export const ChildDocs = ({
|
|||||||
{!hideTitle && <HeadingComponent>{item.title}</HeadingComponent>}
|
{!hideTitle && <HeadingComponent>{item.title}</HeadingComponent>}
|
||||||
<CardList
|
<CardList
|
||||||
items={
|
items={
|
||||||
item.children?.map((childItem) => ({
|
itemChildren?.map((childItem) => ({
|
||||||
title: childItem.title,
|
title: childItem.title,
|
||||||
href: childItem.path,
|
href: childItem.path,
|
||||||
showLinkIcon: false,
|
showLinkIcon: false,
|
||||||
|
|||||||
+2
-37
@@ -11,42 +11,7 @@ const coreFlowsOptions: FormattingOptionsType = {
|
|||||||
workflowDiagramComponent: "WorkflowDiagram",
|
workflowDiagramComponent: "WorkflowDiagram",
|
||||||
mdxImports: [`import { TypeList, WorkflowDiagram } from "docs-ui"`],
|
mdxImports: [`import { TypeList, WorkflowDiagram } from "docs-ui"`],
|
||||||
},
|
},
|
||||||
"^modules/core_flows/page\\.mdx": {
|
"^core_flows/.*/functions/.*Workflow/page\\.mdx": {
|
||||||
reflectionDescription:
|
|
||||||
"This section of the documentation provides a reference to Medusa's workflows and steps that you can use in your customizations.",
|
|
||||||
reflectionGroups: {
|
|
||||||
Namespaces: true,
|
|
||||||
Enumerations: false,
|
|
||||||
Classes: false,
|
|
||||||
Interfaces: false,
|
|
||||||
"Type Aliases": false,
|
|
||||||
Variables: false,
|
|
||||||
"Enumeration Members": false,
|
|
||||||
Functions: false,
|
|
||||||
},
|
|
||||||
hideTocHeaders: true,
|
|
||||||
frontmatterData: {
|
|
||||||
slug: "/references/medusa-workflows",
|
|
||||||
},
|
|
||||||
reflectionTitle: {
|
|
||||||
fullReplacement: "Medusa Workflows API Reference",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"^core_flows/.*/.*(Workflows|Steps)/page\\.mdx": {
|
|
||||||
expandMembers: false,
|
|
||||||
reflectionGroups: {
|
|
||||||
Variables: false,
|
|
||||||
Properties: false,
|
|
||||||
"Type Literals": false,
|
|
||||||
},
|
|
||||||
sections: {
|
|
||||||
...baseSectionsOptions,
|
|
||||||
member_getterSetter: false,
|
|
||||||
members_categories: false,
|
|
||||||
},
|
|
||||||
hideTocHeaders: true,
|
|
||||||
},
|
|
||||||
"^core_flows/.*Workflows/functions/.*/page\\.mdx": {
|
|
||||||
reflectionDescription:
|
reflectionDescription:
|
||||||
"This documentation provides a reference to the `{{alias}}`. It belongs to the `@medusajs/core-flows` package.",
|
"This documentation provides a reference to the `{{alias}}`. It belongs to the `@medusajs/core-flows` package.",
|
||||||
frontmatterData: {
|
frontmatterData: {
|
||||||
@@ -59,7 +24,7 @@ const coreFlowsOptions: FormattingOptionsType = {
|
|||||||
suffix: "- Medusa Workflows API Reference",
|
suffix: "- Medusa Workflows API Reference",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"^core_flows/.*Steps/functions/.*/page\\.mdx": {
|
"^core_flows/.*/functions/.*Step/page\\.mdx": {
|
||||||
reflectionDescription:
|
reflectionDescription:
|
||||||
"This documentation provides a reference to the `{{alias}}`. It belongs to the `@medusajs/core-flows` package.",
|
"This documentation provides a reference to the `{{alias}}`. It belongs to the `@medusajs/core-flows` package.",
|
||||||
frontmatterData: {
|
frontmatterData: {
|
||||||
|
|||||||
Reference in new issue
Block a user