docs: added documentation for build command (#9604)
- Added documentation for `medusa build` command - Update deployment documentation for admin to use `--admin-only` option
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
|
||||
# production
|
||||
/build
|
||||
!app/medusa-cli/commands/build
|
||||
|
||||
# misc
|
||||
.DS_Store
|
||||
|
||||
@@ -86,7 +86,7 @@ To create a Vercel project, on your Vercel dashboard:
|
||||
- Set the Build Command field to the following:
|
||||
|
||||
```bash npm2yarn
|
||||
npm run build
|
||||
npm run build --admin-only
|
||||
```
|
||||
|
||||
- Set the Output Directory field to `.medusa/admin`.
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
---
|
||||
sidebar_label: "build"
|
||||
sidebar_position: 5
|
||||
---
|
||||
|
||||
import { Table } from "docs-ui"
|
||||
|
||||
export const metadata = {
|
||||
title: `build Command - Medusa CLI Reference`,
|
||||
}
|
||||
|
||||
# {metadata.title}
|
||||
|
||||
Create a standalone build of the Medusa application.
|
||||
|
||||
This creates a build that:
|
||||
|
||||
- Doesn't rely on the source TypeScript files.
|
||||
- Can be copied to a production server reliably.
|
||||
|
||||
The build is outputted to a new `.medusa/server` directory.
|
||||
|
||||
```bash
|
||||
npx medusa build
|
||||
```
|
||||
|
||||
Refer to [this section](#run-built-medusa-application) for next steps.
|
||||
|
||||
## Options
|
||||
|
||||
<Table>
|
||||
<Table.Header>
|
||||
<Table.Row>
|
||||
<Table.HeaderCell>Option</Table.HeaderCell>
|
||||
<Table.HeaderCell>Description</Table.HeaderCell>
|
||||
</Table.Row>
|
||||
</Table.Header>
|
||||
<Table.Body>
|
||||
<Table.Row>
|
||||
<Table.Cell>
|
||||
|
||||
`--admin-only`
|
||||
|
||||
</Table.Cell>
|
||||
<Table.Cell>
|
||||
|
||||
Whether to only build the admin to host it separately. If this option is not passed, the admin is built to the `.medusa/server/public/admin`. When this option is passed, the admin is built to the `.medusa/admin` directory instead.
|
||||
|
||||
</Table.Cell>
|
||||
</Table.Row>
|
||||
</Table.Body>
|
||||
</Table>
|
||||
|
||||
---
|
||||
|
||||
## Run Built Medusa Application
|
||||
|
||||
After running the `build` command, use the following step to run the built Medusa application:
|
||||
|
||||
- Change to the `.medusa/server` directory and install the dependencies:
|
||||
|
||||
```bash npm2yarn
|
||||
cd .medusa/server && npm install
|
||||
```
|
||||
|
||||
- When running the application locally, make sure to copy the `.env` file from the root project's directory. In production, use system environment variables instead.
|
||||
|
||||
```bash npm2yarn
|
||||
cp .env .medusa/server
|
||||
```
|
||||
|
||||
- Use the `start` command to run the application:
|
||||
|
||||
```bash npm2yarn
|
||||
cd .medusa/server && npm run start
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Build Medusa Admin
|
||||
|
||||
By default, the Medusa Admin is built to the `.medusa/server/public/admin` directory.
|
||||
|
||||
If you want a separate build to host the admin standalone, such as on Vercel, pass the `--admin-only` option as explained in the [Options](#options) section. This outputs the admin to the `.medusa/admin` directory instead.
|
||||
@@ -120,7 +120,7 @@ export const generatedEditDates = {
|
||||
"app/contribution-guidelines/_admin-translations/page.mdx": "2024-05-13T18:55:11+03:00",
|
||||
"app/contribution-guidelines/docs/page.mdx": "2024-05-13T18:55:11+03:00",
|
||||
"app/create-medusa-app/page.mdx": "2024-08-05T11:10:55+03:00",
|
||||
"app/deployment/admin/vercel/page.mdx": "2024-07-31T17:01:33+03:00",
|
||||
"app/deployment/admin/vercel/page.mdx": "2024-10-16T08:10:29.377Z",
|
||||
"app/deployment/medusa-application/railway/page.mdx": "2024-10-15T12:50:50.981Z",
|
||||
"app/deployment/storefront/vercel/page.mdx": "2024-07-26T07:21:31+00:00",
|
||||
"app/deployment/page.mdx": "2024-07-25T09:55:22+03:00",
|
||||
@@ -2294,5 +2294,6 @@ export const generatedEditDates = {
|
||||
"references/fulfillment/IFulfillmentModuleService/methods/fulfillment.IFulfillmentModuleService.validateFulfillmentData/page.mdx": "2024-10-14T15:28:22.586Z",
|
||||
"references/fulfillment/interfaces/fulfillment.IFulfillmentModuleService/page.mdx": "2024-10-14T15:28:22.238Z",
|
||||
"references/types/CommonTypes/interfaces/types.CommonTypes.RequestQueryFields/page.mdx": "2024-10-14T15:27:49.882Z",
|
||||
"references/utils/utils.ProductUtils/page.mdx": "2024-10-14T15:27:51.874Z"
|
||||
"references/utils/utils.ProductUtils/page.mdx": "2024-10-14T15:27:51.874Z",
|
||||
"app/medusa-cli/commands/build/page.mdx": "2024-10-16T08:16:27.618Z"
|
||||
}
|
||||
@@ -595,6 +595,10 @@ export const filesMap = [
|
||||
"filePath": "/www/apps/resources/app/integrations/page.mdx",
|
||||
"pathname": "/integrations"
|
||||
},
|
||||
{
|
||||
"filePath": "/www/apps/resources/app/medusa-cli/commands/build/page.mdx",
|
||||
"pathname": "/medusa-cli/commands/build"
|
||||
},
|
||||
{
|
||||
"filePath": "/www/apps/resources/app/medusa-cli/commands/db/page.mdx",
|
||||
"pathname": "/medusa-cli/commands/db"
|
||||
|
||||
@@ -8098,6 +8098,14 @@ export const generatedSidebar = [
|
||||
"title": "user",
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"loaded": true,
|
||||
"isPathHref": true,
|
||||
"type": "link",
|
||||
"path": "/medusa-cli/commands/build",
|
||||
"title": "build",
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"loaded": true,
|
||||
"isPathHref": true,
|
||||
|
||||
Reference in New Issue
Block a user