Skip to main content
Version: 2.0.0-beta.5

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:

# migration command formatnpx @docusaurus/migrate migrate <v1 website directory> <desired v2 website directory>
# examplenpx @docusaurus/migrate migrate ./v1-website ./v2-website
  1. To view your new website locally, go into your v2 website's directory and start your development server.
cd ./v2-websiteyarn installyarn start
danger

The migration CLI updates existing files. Be sure to have committed them first!

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.

NameDescription
--mdxAdd this flag to convert Markdown to MDX automatically
--pageAdd this flag to migrate pages automatically
# example using optionsnpx @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.