跳到主要内容

金丝雀的版本

Docusaurus 有一个释放金丝雀的系统。

它允许你在合并到 Docusaurus 的下一个版本时测试新的未发布的特性。

这是一个给维护者反馈的好方法,确保新实现的功能按预期工作。

备注

在生产环境中使用金丝雀版本似乎有风险,但在实践中却并非如此。

金丝雀版本通过了所有自动化测试,并由 Docusaurus 站点本身在生产环境中使用。

警告

下面显示的金丝雀版本可能不是最新的。请到npm 页面找到实际的版本名称。

金丝雀 npm dist 标签

For any code-related commit on main, the continuous integration will publish a canary release under the @canary npm dist tag. It generally takes up to 10 minutes.

You can see on npm the current dist tags:

  • latest: stable releases (Current: 3.0.0-alpha.0)
  • canary: canary releases (例子: 0.0.0-4922)
提示

Make sure to use the latest canary release and check the publication date (sometimes the publish process fails).

备注

Canary versions follow the naming convention 0.0.0-commitNumber.

使用金丝雀释放器

Take the latest version published under the canary npm dist tag (例子: 0.0.0-4922).

Use it for all the @docusaurus/* dependencies in your package.json:

-  "@docusaurus/core": "^3.0.0-alpha.0",
- "@docusaurus/preset-classic": "^3.0.0-alpha.0",
+ "@docusaurus/core": "0.0.0-4922",
+ "@docusaurus/preset-classic": "0.0.0-4922",

Then, install the dependencies again and start your site:

npm install
npm start

You can also upgrade the @docusaurus/* packages with command line:

npm install --save-exact @docusaurus/core@canary @docusaurus/preset-classic@canary
警告

Make sure to include all the @docusaurus/* packages.

For canary releases, prefer using an exact version instead of a semver range (avoid the ^ prefix).