mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-08 22:57:20 +02:00
Co-authored-by: Joshua Chen <sidachen2003@gmail.com> Co-authored-by: sebastienlorber <lorber.sebastien@gmail.com> Co-authored-by: Sébastien Lorber <slorber@users.noreply.github.com> Co-authored-by: Ben Gubler <nebrelbug@gmail.com> Co-authored-by: Davide Donadio <davide.donadio@it.clara.net> Co-authored-by: Petter Drønnen <36735557+dr0nn1@users.noreply.github.com> Co-authored-by: Moritz Stückler <moritz@bitbetter.de> Co-authored-by: Mysterious_Dev <40738104+Mysterious-Dev@users.noreply.github.com> Co-authored-by: TrueQAP <32407751+trueqap@users.noreply.github.com> Co-authored-by: Kagan <34136752+kagankan@users.noreply.github.com> Co-authored-by: Dewansh Thakur <71703033+dewanshDT@users.noreply.github.com> Co-authored-by: Armano <armano2@users.noreply.github.com> Co-authored-by: Anas <60762285+Anasqx@users.noreply.github.com> Co-authored-by: Tanner Dolby <tannercdolby@gmail.com> Co-authored-by: Davide Donadio <davide.donadio94@gmail.com> Co-authored-by: biplavmz <68702055+biplavmz@users.noreply.github.com> Co-authored-by: Vishruta Patil <72292532+Vishruta-Patil@users.noreply.github.com> fix(theme-classic): fix tab focus bug in dropdown (#8697) (#8699) fix(theme): improve color toggle when using dark navbar (#8615) fix(theme-translations): fix wrong arabic words (tip/next) (#8744) fix(core): baseUrl error banner link anchor case (#8746) fix(search): search page should react to querystring changes + cleanup/refactor (#8757) fix(theme): allow tabs children to be falsy (#8801) fix(theme): codeblock buttons should be kept on the right when using RTL locale (#8803)
75 lines
2.1 KiB
Markdown
75 lines
2.1 KiB
Markdown
---
|
|
slug: /migration/automated
|
|
---
|
|
|
|
# Automated migration
|
|
|
|
The migration CLI automatically migrates your v1 website to a v2 website.
|
|
|
|
:::info
|
|
|
|
Manual work is still required after using the migration CLI, as we can't automate a full migration
|
|
|
|
:::
|
|
|
|
The migration CLI migrates:
|
|
|
|
- Site configurations (from `siteConfig.js` to `docusaurus.config.js`)
|
|
- `package.json`
|
|
- `sidebars.json`
|
|
- `/docs`
|
|
- `/blog`
|
|
- `/static`
|
|
- `versioned_sidebar.json` and `/versioned_docs` if your site uses versioning
|
|
|
|
To use the migration CLI, follow these steps:
|
|
|
|
1. Before using the migration CLI, ensure that `/docs`, `/blog`, `/static`, `sidebars.json`, `siteConfig.js`, `package.json` follow the [structure](#) shown at the start of this page.
|
|
|
|
2. To migrate your v1 website, run the migration CLI with the appropriate filesystem paths:
|
|
|
|
```bash
|
|
# migration command format
|
|
npx @docusaurus/migrate migrate <v1 website directory> <desired v2 website directory>
|
|
|
|
# example
|
|
npx @docusaurus/migrate migrate ./v1-website ./v2-website
|
|
```
|
|
|
|
3. To view your new website locally, go into your v2 website's directory and start your development server.
|
|
|
|
```bash npm2yarn
|
|
cd ./v2-website
|
|
npm install
|
|
npm start
|
|
```
|
|
|
|
:::danger
|
|
|
|
The migration CLI updates existing files. Be sure to have committed them first!
|
|
|
|
:::
|
|
|
|
#### Options {#options}
|
|
|
|
You can add option flags to the migration CLI to automatically migrate Markdown content and pages to v2. It is likely that you will still need to make some manual changes to achieve your desired result.
|
|
|
|
| Name | Description |
|
|
| -------- | ------------------------------------------------------ |
|
|
| `--mdx` | Add this flag to convert Markdown to MDX automatically |
|
|
| `--page` | Add this flag to migrate pages automatically |
|
|
|
|
```bash
|
|
# example using options
|
|
npx @docusaurus/migrate migrate --mdx --page ./v1-website ./v2-website
|
|
```
|
|
|
|
:::danger
|
|
|
|
The migration of pages and MDX is still a work in progress.
|
|
|
|
We recommend you to try to run the pages without these options, commit, and then try to run the migration again with the `--page` and `--mdx` options.
|
|
|
|
This way, you'd be able to easily inspect and fix the diff.
|
|
|
|
:::
|