Skip to content

设置项目

¥Setup the project

先决条件

¥Prerequisites

构建和运行 Rolldown 只需要一些工具。你需要:

¥Only a few tools are required to build and run Rolldown. You'll need:

  • 通过 rustup 安装 Rust

    ¥Install Rust via rustup

  • 安装 just

    ¥Install just

你可以通过运行以下命令或按照官方 guide 的说明快速安装 just

¥You could install just quickly by running the following command or by following the official guide:

sh
npm install --global just-install
sh
pnpm --global add just-install
sh
yarn global add just-install
sh
brew install just
sh
cargo install just
  • 安装 cmake

    ¥Install cmake

你可以按照官方 下载 的说明进行安装。

¥You could install it by following the official Download.

  • 安装 Node.js >= lts/* / 21.2.0

    ¥Install Node.js >= lts/* / 21.2.0

just setup

第一次检出存储库时,你只需在存储库根目录中运行 just setup 即可。

¥On your first checkout of the repository, all you need to do is run just setup in the repository root.

如果你在末尾看到 ✅✅✅ Setup complete!,则表示你已拥有构建和运行 Rolldown 所需的一切。

¥If you are seeing ✅✅✅ Setup complete! at the end, that means you have everything you need to build and run rolldown.

你可以运行 just roll 来验证一切是否正常运行。

¥You could run just roll to verify if everything is working correctly.

提示

  • just roll 可能需要一段时间才能运行,因为它将从头构建 Rolldown 并运行所有测试。

    ¥just roll might take a while to run, since it will build rolldown from scratch and run all the tests.

  • 如果你想了解 just setup 的底层功能,可以查看代码库根目录中的 justfile

    ¥If you want to know what just setup does under the hood, you can check the justfile in the repository root.

现在,你可以转到下一章 构建并运行。如果你想深入了解设置过程,请继续阅读。

¥Now, you could move to next chapter Building and Running. Continue reading if you want to have a in-depth understanding of the setup process.

深入了解

¥In Depth

本节将详细介绍构建和运行 Rolldown 所需的已安装工具和依赖。

¥This section will go into more detail about the installed tools and dependencies required to build and run Rolldown.

设置 Rust

¥Setup Rust

Rolldown 基于 Rust 构建,并且需要你的环境中存在 rustupcargo。你可以使用 从官方网站安装 Rust

¥Rolldown is built on Rust and requires rustup and cargo to exist in your environment. You can install Rust from the official website.

设置 Node.js

¥Setup Node.js

Rolldown 是一个使用 NAPI-RS 构建的 npm 包,并发布到 npm 注册表,因此需要 Node.js 和 pnpm(用于依赖管理)。

¥Rolldown is a npm package built with NAPI-RS and is published to the npm registry, and as such requires Node.js and pnpm (for dependency management).

我们建议使用版本管理器(例如 nvmfnm)安装 Node.js。确保安装并使用 Node.js lts/*+ 版本,这是本项目的最低要求。如果你已经在使用你选择的 Node.js 版本管理器,并且 Node.js 版本符合要求,则可以跳过此步骤。

¥We recommend installing Node.js with a version manager, like nvm or fnm. Make sure to install and use Node.js version lts/*+, which is the minimum requirement for this project. You can skip this step if you are already using a Node.js version manager of your choice and on a Node.js version that meets the requirement.

设置 pnpm

¥Setup pnpm

我们建议通过 corepack 启用 pnpm,这样在本项目中工作时就可以自动使用正确版本的 pnpm:

¥We recommend enabling pnpm via corepack, so the correct version of pnpm can be automatically used when working in this project:

shell
corepack enable

为了验证所有设置是否正确。

¥to verify that everything is setup correctly.