Skip to content

Commit

Permalink
docs: update admin CLI configurations (#4910)
Browse files Browse the repository at this point in the history
* docs: update admin configurations

* fix in dev command name
  • Loading branch information
shahednasser authored and riqwan committed Aug 30, 2023
1 parent eeac98e commit d977e7f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 18 deletions.
12 changes: 4 additions & 8 deletions www/docs/content/admin/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,19 @@ The `build` command in the admin CLI allows you to manually build the admin dash
}
```

You can add the following options to the `medusa-admin build` command:
You can add the following option to the `medusa-admin build` command:

- `--deployment`: a boolean value indicating that the build should be ready for deployment. When this option is added, options are not loaded from `medusa-config.js` anymore, and it means the admin will be built to be hosted on an external host. For example, `medusa-admin build --deployment`.
- `--backend` or `-b`: a string specifying the URL of the Medusa backend. This can be useful with the `--deployment` option. The default here is the value of the environment variable `MEDUSA_ADMIN_BACKEND_URL`. For example, `medusa-admin build --deployment --backend example.com`
- `--out-dir` or `-o`: a string specifying a custom path to output the build files to. By default, it will be the `build` directory. For example, `medusa-admin --deployment --out-dir public`.
- `--include` or `-i`: a list of strings of paths to files you want to include in the build output. It can be useful if you want to inject files that are relevant to your external hosting, such as adding a `200.html` file that is needed for redirects on Surge. For example, `medusa-admin --deployment --include 200.html`
- `--include-dist` or `-d`: a string specifying the path to copy the files specified in `--include` to. By default, the files are copied to the root of the build directory. You can use this option to change that. For example, `medusa-admin --deployment --include 200.html --include-dist static`.
- `--deployment`: a boolean value indicating that the build should be ready for deployment. When this option is added, options are not loaded from `medusa-config.js` anymore, and it means the admin will be built to be hosted on an external host. This also means that the backend URL is loaded from the `MEDUSA_ADMIN_BACKEND_URL` environment variable. For example, `medusa-admin build --deployment`.

### Dev Command Options

The `dev` command in the admin CLI allows you to run the admin dashboard in development separately from the Medusa backend. If you intend to use it, you should typically add it to the `package.json` of the Medusa backend:
The `develop` command in the admin CLI allows you to run the admin dashboard in development separately from the Medusa backend. If you intend to use it, you should typically add it to the `package.json` of the Medusa backend:

```json title=package.json
{
"scripts": {
// other scripts...
"dev:admin": "medusa-admin dev"
"dev:admin": "medusa-admin develop"
}
}
```
Expand Down
13 changes: 3 additions & 10 deletions www/docs/content/deployments/admin/deploying-on-vercel.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,7 @@ In the `package.json` of the Medusa backend, add or change a build script for th
}
```

### Additional Build Options

Aside from `--deployment`, you can use the following options when building your admin for deployment:

- `--backend` or `-b`: a string specifying the URL of the Medusa backend. The default here is the value of the environment variable `MEDUSA_ADMIN_BACKEND_URL`. If this options is added, the value you set for `MEDUSA_ADMIN_BACKEND_URL` in Vercel will no longer have an effect. For example, `medusa-admin build --deployment --backend example.com`
- `--out-dir` or `-o`: a string specifying a custom path to output the build files to. By default, it will be the `build` directory. For example, `medusa-admin --deployment --out-dir public`.
- `--include` or `-i`: a list of strings of paths to files you want to include in the build output. It can be useful if you want to inject files that are relevant to your hosting. For example, `medusa-admin --deployment --include 200.html`
- `--include-dist` or `-d`: a string specifying the path to copy the files specified in `--include` to. By default, the files are coopied to the root of the build directory. You can use this option to change that. For example, `medusa-admin --deployment --include 200.html --include-dist static`.
Note that when using the `--deployment` option, the backend's URL is loaded from the `MEDUSA_ADMIN_BACKEND_URL` environment variable. You'll configure this environment variable in a later step.

---

Expand Down Expand Up @@ -133,8 +126,8 @@ This section explains how to deploy the admin using the Vercel website:
3. Choose Project from the dropdown.
4. In the new page that opens, find the Git repository that holds your Medusa backend and click on the Import button. If you haven’t connected your Vercel account to any Git provider, you must do that first.
5. In the Configure Project form:
1. Set the Framework Preset to Vite.
2. Open the Build and Output Settings collapsible, and set the Build Command to `yarn build:admin` and the Output Directory to `build`. If you’ve configured the admin to use a different output directory, then change it to that directory.
1. Set the Framework Preset to Other.
2. Open the Build and Output Settings collapsible, and set the Build Command to `yarn build:admin` and the Output Directory to `build`.
3. Open the Environment Variables collapsible, and add an environment variable with the name `MEDUSA_ADMIN_BACKEND_URL` with the value being the URL to your deployed Medusa backend.
4. You can optionally edit the Project Name.
6. Once you’re done, click on the “Deploy” button.
Expand Down

0 comments on commit d977e7f

Please sign in to comment.