docs: added plugins documentation (#10989)
(Should be merged after the next release) Closes DX-1294
This commit is contained in:
1 parent
0c5f21e893
commit
c26ef84cae
26 files changed
+2901
-52
No files matched your search
@@ -15,7 +15,7 @@ export const metadata = {
|
||||
|
||||
# {metadata.title}
|
||||
|
||||
The `create-medusa-app` CLI tool simplifies the process of creating a new Medusa project and provides an onboarding experience.
|
||||
The `create-medusa-app` CLI tool simplifies the process of creating a new Medusa project. It also allows you to setup a [Medusa plugin project](#create-a-medusa-plugin-project).
|
||||
|
||||
<Prerequisites items={[
|
||||
{
|
||||
@@ -206,6 +206,23 @@ npx create-medusa-app@latest [project-name]
|
||||
|
||||
</Table.Cell>
|
||||
</Table.Row>
|
||||
<Table.Row>
|
||||
<Table.Cell>
|
||||
|
||||
`--plugin`
|
||||
|
||||
</Table.Cell>
|
||||
<Table.Cell>
|
||||
|
||||
Create a [plugin project](#create-a-medusa-plugin-project) instead of a Medusa application. This option is available starting from [Medusa v2.3.0](https://github.com/medusajs/medusa/releases/tag/v2.3.0).
|
||||
|
||||
</Table.Cell>
|
||||
<Table.Cell>
|
||||
|
||||
`false`
|
||||
|
||||
</Table.Cell>
|
||||
</Table.Row>
|
||||
</Table.Body>
|
||||
</Table>
|
||||
|
||||
@@ -241,6 +258,18 @@ If the database already has the necessary migrations and you don't need the comm
|
||||
|
||||
---
|
||||
|
||||
## Create a Medusa Plugin Project
|
||||
|
||||
The `create-medusa-app` tool can also be used to create a Medusa Plugin Project. You can do that by passing the `--plugin` option:
|
||||
|
||||
```bash
|
||||
npx create-medusa-app@latest my-plugin --plugin
|
||||
```
|
||||
|
||||
Learn more about how to create a plugin in [this documentation](!docs!/learn/fundamentals/plugins).
|
||||
|
||||
---
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
<DetailsList
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
sidebar_label: "exec"
|
||||
sidebar_position: 6
|
||||
sidebar_position: 7
|
||||
---
|
||||
|
||||
import { Table } from "docs-ui"
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
---
|
||||
sidebar_label: "plugin"
|
||||
sidebar_position: 6
|
||||
---
|
||||
|
||||
import { Table } from "docs-ui"
|
||||
|
||||
export const metadata = {
|
||||
title: `plugin Commands - Medusa CLI Reference`,
|
||||
}
|
||||
|
||||
# {metadata.title}
|
||||
|
||||
Commands starting with `plugin:` perform actions related to [plugin](!docs!/learn/fundamentals/plugins) development.
|
||||
|
||||
<Note>
|
||||
|
||||
These commands are available starting from [Medusa v2.3.0](https://github.com/medusajs/medusa/releases/tag/v2.3.0).
|
||||
|
||||
</Note>
|
||||
|
||||
## plugin\:publish
|
||||
|
||||
Publish a plugin into the local packages registry. The command uses [Yalc](https://github.com/wclr/yalc) under the hood to publish the plugin to a local package registry. You can then install the plugin in a local Medusa project using the [plugin\:add](#pluginadd) command.
|
||||
|
||||
```bash
|
||||
npx medusa plugin:publish
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## plugin\:add
|
||||
|
||||
Install the specified plugins from the local package registry into a local Medusa application. Plugins can be added to the local package registry using the [plugin\:publish](#pluginpublish) command.
|
||||
|
||||
```bash
|
||||
npx medusa plugin:add [names...]
|
||||
```
|
||||
|
||||
### Arguments
|
||||
|
||||
<Table>
|
||||
<Table.Header>
|
||||
<Table.Row>
|
||||
<Table.HeaderCell>Argument</Table.HeaderCell>
|
||||
<Table.HeaderCell>Description</Table.HeaderCell>
|
||||
<Table.HeaderCell>Required</Table.HeaderCell>
|
||||
</Table.Row>
|
||||
</Table.Header>
|
||||
<Table.Body>
|
||||
<Table.Row>
|
||||
<Table.Cell>
|
||||
|
||||
`names`
|
||||
|
||||
</Table.Cell>
|
||||
<Table.Cell>
|
||||
|
||||
The names of one or more plugins to install from the local package registry. A plugin's name is as specified in its `package.json` file.
|
||||
|
||||
</Table.Cell>
|
||||
<Table.Cell>
|
||||
|
||||
Yes
|
||||
|
||||
</Table.Cell>
|
||||
</Table.Row>
|
||||
</Table.Body>
|
||||
</Table>
|
||||
|
||||
---
|
||||
|
||||
## plugin\:develop
|
||||
|
||||
Start a development server for a plugin. The command will watch for changes in the plugin's source code and automatically re-publish the changes into the local package registry.
|
||||
|
||||
```bash
|
||||
npx medusa plugin:develop
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## plugin\:db\:generate
|
||||
|
||||
Generate migrations for all modules in a plugin.
|
||||
|
||||
```bash
|
||||
npx medusa plugin:db:generate
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## plugin\:build
|
||||
|
||||
Build a plugin before publishing it to NPM. The command will compile an output in the `.medusa/server` directory.
|
||||
|
||||
```bash
|
||||
npx medusa plugin:build
|
||||
```
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
sidebar_label: "start-cluster"
|
||||
sidebar_position: 7
|
||||
sidebar_position: 8
|
||||
---
|
||||
|
||||
import { Table } from "docs-ui"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
sidebar_label: "telemetry"
|
||||
sidebar_position: 8
|
||||
sidebar_position: 9
|
||||
---
|
||||
|
||||
import { Table } from "docs-ui"
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,21 @@
|
||||
import { ChildDocs } from "docs-ui"
|
||||
|
||||
export const metadata = {
|
||||
title: `Plugins`,
|
||||
}
|
||||
|
||||
# {metadata.title}
|
||||
|
||||
A plugin is a package of re-usable Medusa customizations, including [modules](!docs!/learn/fundamentals/modules), [workflows](!docs!/learn/fundamentals/workflows), [API routes](!docs!/learn/fundamentals/api-routes), and more.
|
||||
|
||||
Plugins are useful if you want to re-use your customizations across Medusa applications, or you want to share those customizations with the community. You publish your plugin to NPM, then install it in a Medusa application to use its features.
|
||||
|
||||
<Note>
|
||||
|
||||
Learn more about plugins and their difference from modules in [this documentation](!docs!/learn/fundamentals/plugins).
|
||||
|
||||
</Note>
|
||||
|
||||
## Guides
|
||||
|
||||
<ChildDocs showItems={["Guides"]} hideTitle />
|
||||
@@ -212,7 +212,7 @@ So, the `RestockModuleService` class now has methods like `createRestockSubscrip
|
||||
|
||||
<Note>
|
||||
|
||||
Find all methods generated by the `MedusaService` in [this reference](../../..//service-factory-reference/page.mdx).
|
||||
Find all methods generated by the `MedusaService` in [this reference](../../../service-factory-reference/page.mdx).
|
||||
|
||||
</Note>
|
||||
|
||||
@@ -330,7 +330,7 @@ You define a link using `defineLink` from the Modules SDK. It accepts three para
|
||||
|
||||
1. The first data model part of the link, which is the Restock Module's `restockSubscription` data model. A module has a special `linkable` property that contain link configurations for its data models. You also specify the field that points to the product variant.
|
||||
1. The second data model part of the link, which is the Product Module's `productVariant` data model.
|
||||
3. An object of configurations for the module link. By default, Medusa creates a table in the database to represent the link you define. However, in this guide, you only want this link to retrieve the variants associated with a subscription and vice-versa. So, you enable `readOnly` telling Medusa not to create a table for this link.
|
||||
3. An object of configurations for the module link. By default, Medusa creates a table in the database to represent the link you define. However, in this guide, you only want this link to retrieve the variants associated with a subscription. So, you enable `readOnly` telling Medusa not to create a table for this link.
|
||||
|
||||
In the next steps, you'll see how this link allows you to retrieve product variants' details when retrieving restock subscriptions.
|
||||
|
||||
|
||||
@@ -100,7 +100,7 @@ export const generatedEditDates = {
|
||||
"app/commerce-modules/user/page.mdx": "2025-01-09T13:41:05.543Z",
|
||||
"app/commerce-modules/page.mdx": "2024-12-23T14:38:21.064Z",
|
||||
"app/contribution-guidelines/docs/page.mdx": "2024-12-12T11:06:12.250Z",
|
||||
"app/create-medusa-app/page.mdx": "2025-01-06T09:14:55.483Z",
|
||||
"app/create-medusa-app/page.mdx": "2025-01-16T10:00:25.975Z",
|
||||
"app/deployment/admin/vercel/page.mdx": "2024-10-16T08:10:29.377Z",
|
||||
"app/deployment/medusa-application/railway/page.mdx": "2024-11-11T11:50:10.517Z",
|
||||
"app/deployment/storefront/vercel/page.mdx": "2025-01-06T12:19:31.142Z",
|
||||
@@ -593,11 +593,11 @@ export const generatedEditDates = {
|
||||
"references/types/types.NotificationTypes/page.mdx": "2024-11-25T17:49:28.027Z",
|
||||
"app/medusa-cli/commands/db/page.mdx": "2025-01-16T07:34:08.014Z",
|
||||
"app/medusa-cli/commands/develop/page.mdx": "2024-08-28T10:43:45.452Z",
|
||||
"app/medusa-cli/commands/exec/page.mdx": "2024-08-28T10:45:31.229Z",
|
||||
"app/medusa-cli/commands/exec/page.mdx": "2025-01-16T09:51:17.050Z",
|
||||
"app/medusa-cli/commands/new/page.mdx": "2024-08-28T10:43:34.110Z",
|
||||
"app/medusa-cli/commands/start-cluster/page.mdx": "2024-08-28T11:25:05.257Z",
|
||||
"app/medusa-cli/commands/start-cluster/page.mdx": "2025-01-16T09:51:19.838Z",
|
||||
"app/medusa-cli/commands/start/page.mdx": "2024-08-28T10:44:19.952Z",
|
||||
"app/medusa-cli/commands/telemtry/page.mdx": "2024-08-28T11:25:08.553Z",
|
||||
"app/medusa-cli/commands/telemtry/page.mdx": "2025-01-16T09:51:24.323Z",
|
||||
"app/medusa-cli/commands/user/page.mdx": "2024-08-28T10:44:52.489Z",
|
||||
"app/recipes/marketplace/examples/restaurant-delivery/page.mdx": "2024-12-11T10:05:52.851Z",
|
||||
"references/types/HttpTypes/interfaces/types.HttpTypes.AdminCreateCustomerGroup/page.mdx": "2024-12-09T13:21:33.569Z",
|
||||
@@ -5609,7 +5609,7 @@ export const generatedEditDates = {
|
||||
"references/modules/sales_channel_models/page.mdx": "2024-12-10T14:55:13.205Z",
|
||||
"references/types/DmlTypes/types/types.DmlTypes.KnownDataTypes/page.mdx": "2024-12-17T16:57:19.922Z",
|
||||
"references/types/DmlTypes/types/types.DmlTypes.RelationshipTypes/page.mdx": "2024-12-10T14:54:55.435Z",
|
||||
"app/recipes/commerce-automation/restock-notification/page.mdx": "2024-12-11T08:47:27.471Z",
|
||||
"app/recipes/commerce-automation/restock-notification/page.mdx": "2025-01-23T10:18:28.126Z",
|
||||
"app/troubleshooting/workflow-errors/page.mdx": "2024-12-11T08:44:36.598Z",
|
||||
"app/integrations/guides/shipstation/page.mdx": "2025-01-07T14:40:42.561Z",
|
||||
"app/nextjs-starter/guides/customize-stripe/page.mdx": "2024-12-25T14:48:55.877Z",
|
||||
@@ -5866,6 +5866,7 @@ export const generatedEditDates = {
|
||||
"references/types/types/types.CreateProductVariantWorkflowInputDTO/page.mdx": "2025-01-13T17:30:29.301Z",
|
||||
"references/types/types/types.CreateProductWorkflowInputDTO/page.mdx": "2025-01-13T17:30:29.302Z",
|
||||
"references/types/types/types.UpdateProductVariantWorkflowInputDTO/page.mdx": "2025-01-13T17:30:29.302Z",
|
||||
"app/medusa-cli/commands/plugin/page.mdx": "2025-01-16T09:58:16.179Z",
|
||||
"references/inventory_next/interfaces/inventory_next.UpdateInventoryLevelInput/page.mdx": "2025-01-17T16:43:28.933Z",
|
||||
"references/js_sdk/admin/InventoryItem/methods/js_sdk.admin.InventoryItem.batchInventoryItemLocationLevels/page.mdx": "2025-01-17T16:43:31.720Z",
|
||||
"references/js_sdk/admin/InventoryItem/methods/js_sdk.admin.InventoryItem.batchInventoryItemsLocationLevels/page.mdx": "2025-01-17T16:43:31.721Z",
|
||||
@@ -5887,5 +5888,7 @@ export const generatedEditDates = {
|
||||
"references/core_flows/types/core_flows.ThrowUnlessPaymentCollectionNotePaidInput/page.mdx": "2025-01-17T16:43:25.819Z",
|
||||
"references/core_flows/types/core_flows.ValidatePaymentsRefundStepInput/page.mdx": "2025-01-17T16:43:26.128Z",
|
||||
"references/core_flows/types/core_flows.ValidateRefundStepInput/page.mdx": "2025-01-17T16:43:26.124Z",
|
||||
"app/plugins/guides/wishlist/page.mdx": "2025-01-23T11:59:10.008Z",
|
||||
"app/plugins/page.mdx": "2025-01-22T09:36:37.745Z",
|
||||
"app/admin-components/components/data-table/page.mdx": "2025-01-22T16:01:01.279Z"
|
||||
}
|
||||
@@ -823,6 +823,10 @@ export const filesMap = [
|
||||
"filePath": "/www/apps/resources/app/medusa-cli/commands/new/page.mdx",
|
||||
"pathname": "/medusa-cli/commands/new"
|
||||
},
|
||||
{
|
||||
"filePath": "/www/apps/resources/app/medusa-cli/commands/plugin/page.mdx",
|
||||
"pathname": "/medusa-cli/commands/plugin"
|
||||
},
|
||||
{
|
||||
"filePath": "/www/apps/resources/app/medusa-cli/commands/start/page.mdx",
|
||||
"pathname": "/medusa-cli/commands/start"
|
||||
@@ -863,6 +867,14 @@ export const filesMap = [
|
||||
"filePath": "/www/apps/resources/app/page.mdx",
|
||||
"pathname": "/"
|
||||
},
|
||||
{
|
||||
"filePath": "/www/apps/resources/app/plugins/guides/wishlist/page.mdx",
|
||||
"pathname": "/plugins/guides/wishlist"
|
||||
},
|
||||
{
|
||||
"filePath": "/www/apps/resources/app/plugins/page.mdx",
|
||||
"pathname": "/plugins"
|
||||
},
|
||||
{
|
||||
"filePath": "/www/apps/resources/app/recipes/b2b/page.mdx",
|
||||
"pathname": "/recipes/b2b"
|
||||
|
||||
@@ -15942,6 +15942,41 @@ export const generatedSidebar = [
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"loaded": true,
|
||||
"isPathHref": true,
|
||||
"type": "ref",
|
||||
"path": "/plugins",
|
||||
"title": "Plugins",
|
||||
"isChildSidebar": true,
|
||||
"children": [
|
||||
{
|
||||
"loaded": true,
|
||||
"isPathHref": true,
|
||||
"type": "link",
|
||||
"title": "Overview",
|
||||
"path": "/plugins",
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"loaded": true,
|
||||
"isPathHref": true,
|
||||
"type": "category",
|
||||
"title": "Guides",
|
||||
"children": [
|
||||
{
|
||||
"loaded": true,
|
||||
"isPathHref": true,
|
||||
"type": "link",
|
||||
"title": "Wishlist",
|
||||
"path": "/plugins/guides/wishlist",
|
||||
"description": "Learn how to build a wishlist plugin.",
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"loaded": true,
|
||||
"isPathHref": true,
|
||||
@@ -16456,6 +16491,15 @@ export const generatedSidebar = [
|
||||
"description": "",
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"loaded": true,
|
||||
"isPathHref": true,
|
||||
"type": "link",
|
||||
"path": "/medusa-cli/commands/plugin",
|
||||
"title": "plugin",
|
||||
"description": "",
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"loaded": true,
|
||||
"isPathHref": true,
|
||||
|
||||
@@ -6,6 +6,7 @@ import { currencySidebar } from "./sidebars/currency.mjs"
|
||||
import { customerSidebar } from "./sidebars/customer.mjs"
|
||||
import { fulfillmentSidebar } from "./sidebars/fulfillment.mjs"
|
||||
import { integrationsSidebar } from "./sidebars/integrations.mjs"
|
||||
import { pluginsSidebar } from "./sidebars/plugins.mjs"
|
||||
import { inventorySidebar } from "./sidebars/inventory.mjs"
|
||||
import { orderSidebar } from "./sidebars/order-module.mjs"
|
||||
import { paymentSidebar } from "./sidebars/payment.mjs"
|
||||
@@ -87,6 +88,13 @@ export const sidebar = sidebarAttachHrefCommonOptions([
|
||||
isChildSidebar: true,
|
||||
children: integrationsSidebar,
|
||||
},
|
||||
{
|
||||
type: "ref",
|
||||
path: "/plugins",
|
||||
title: "Plugins",
|
||||
isChildSidebar: true,
|
||||
children: pluginsSidebar,
|
||||
},
|
||||
{
|
||||
type: "link",
|
||||
path: "/storefront-development",
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
/** @type {import('types').RawSidebarItem[]} */
|
||||
export const pluginsSidebar = [
|
||||
{
|
||||
type: "link",
|
||||
title: "Overview",
|
||||
path: "/plugins",
|
||||
},
|
||||
{
|
||||
type: "category",
|
||||
title: "Guides",
|
||||
children: [
|
||||
{
|
||||
type: "link",
|
||||
title: "Wishlist",
|
||||
path: "/plugins/guides/wishlist",
|
||||
description: "Learn how to build a wishlist plugin.",
|
||||
},
|
||||
],
|
||||
},
|
||||
]
|
||||
Reference in new issue
Block a user