自动迁移
迁移 CLI 工具会自动把你的 v1 站点迁移到 v2 版本。
信息
因为我们无法完全自动化迁移过程,所以你仍然需要在使用自动迁移工具之后,手动完成部分操作。
迁移 CLI 会迁移如下内容:
- Site configurations (from
siteConfig.js
todocusaurus.config.js
) package.json
sidebars.json
/docs
/blog
/static
versioned_sidebar.json
and/versioned_docs
if your site uses versioning
迁移 CLI 的使用分为如下几步:
-
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. -
要开始迁移,请在正确的文件系统位置运行命令行工具:
# migration command format
npx @docusaurus/migrate migrate <v1 website directory> <desired v2 website directory>
# example
npx @docusaurus/migrate migrate ./v1-website ./v2-website
- 要在本地预览你的新网站,请前往 v2 站点目录并启动开发服务器。
- npm
- Yarn
- pnpm
cd ./v2-website
npm install
npm start
cd ./v2-website
yarn install
yarn start
cd ./v2-website
pnpm install
pnpm start