create-remix
create-react-router
CLI 用于启动新项目。
create-remix
CLI 将创建一个新的 Remix 项目。如果不传递参数,此命令将启动一个交互式 CLI 来配置新项目并将其设置在给定目录中。
¥The create-remix
CLI will create a new Remix project. Without passing arguments, this command will launch an interactive CLI to configure the new project and set it up in a given directory.
npx create-remix@latest
你也可以选择将所需的目录路径作为参数传递:
¥Optionally, you can pass the desired directory path as an argument:
npx create-remix@latest <projectDir>
默认应用是使用内置 Remix 应用服务器 的 TypeScript 应用。如果你希望基于不同的设置创建应用,可以使用 --template
标志:
¥The default application is a TypeScript app using the built-in Remix App Server. If you wish to create your application based on a different setup, you can use the --template
flag:
npx create-remix@latest --template <templateUrl>
要获取可用命令和标志的完整列表,请运行:
¥To get a full list of available commands and flags, run:
npx create-remix@latest --help
¥Package managers
create-remix
也可以使用各种包管理器调用,你可以选择 npm、Yarn、pnpm 和 Bun 来管理安装过程。
¥create-remix
can also be invoked using various package managers, allowing you to choose between npm, Yarn, pnpm, and Bun for managing the installation process.
npm create remix@latest <projectDir>
# or
yarn create remix@latest <projectDir>
# or
pnpm create remix@latest <projectDir>
# or
bunx create-remix@latest <projectDir>
create-remix --template
有关可用模板的更全面指南,请参阅我们的 模板页面。。
¥For a more comprehensive guide to available templates, see our templates page.
有效的模板可以是:
¥A valid template can be:
一个 GitHub 仓库简写 - :username/:repo
或 :username/:repo/:directory
¥a GitHub repo shorthand — :username/:repo
or :username/:repo/:directory
GitHub 代码库(或其中的目录)的 URL — https://github.com/:username/:repo
或 https://github.com/:username/:repo/tree/:branch/:directory
¥the URL of a GitHub repo (or directory within it) — https://github.com/:username/:repo
or https://github.com/:username/:repo/tree/:branch/:directory
使用此格式时,分支名称 (:branch
) 不能包含 /
,因为 create-remix
无法区分分支名称和目录路径。
¥The branch name (:branch
) cannot have a /
when using this format since create-remix
cannot unable to differentiate the branch name from the directory path
远程 tarball 的 URL — https://example.com/remix-template.tar.gz
¥the URL of a remote tarball — https://example.com/remix-template.tar.gz
一个文件目录的本地文件路径 - ./path/to/remix-template
¥a local file path to a directory of files — ./path/to/remix-template
一个 tarball 的本地文件路径 - ./path/to/remix-template.tar.gz
¥a local file path to a tarball — ./path/to/remix-template.tar.gz
npx create-remix@latest ./my-app --template remix-run/grunge-stack
npx create-remix@latest ./my-app --template remix-run/remix/templates/remix
npx create-remix@latest ./my-app --template remix-run/examples/basic
npx create-remix@latest ./my-app --template :username/:repo
npx create-remix@latest ./my-app --template :username/:repo/:directory
npx create-remix@latest ./my-app --template https://github.com/:username/:repo
npx create-remix@latest ./my-app --template https://github.com/:username/:repo/tree/:branch
npx create-remix@latest ./my-app --template https://github.com/:username/:repo/tree/:branch/:directory
npx create-remix@latest ./my-app --template https://github.com/:username/:repo/archive/refs/tags/:tag.tar.gz
npx create-remix@latest ./my-app --template https://github.com/:username/:repo/releases/latest/download/:tag.tar.gz
npx create-remix@latest ./my-app --template https://example.com/remix-template.tar.gz
npx create-remix@latest ./my-app --template ./path/to/remix-template
npx create-remix@latest ./my-app --template ./path/to/remix-template.tar.gz
create-remix --overwrite
如果 create-remix
检测到模板与你创建应用的目录之间存在任何文件冲突,它将提示你确认是否可以用模板版本覆盖这些文件。你可以使用 --overwrite
CLI 标志跳过此提示。
¥If create-remix
detects any file collisions between the template and the directory you are creating your app in, it will prompt you for confirmation that it's OK to overwrite those files with the template versions. You may skip this prompt with the --overwrite
CLI flag.