Skip to main content

📦 create-docusaurus

高機能なDocusaurusアプリを即座にセットアップするための足がかりとなるユーティリティ

使い方

npx create-docusaurus@latest [name] [template] [rootDir]

The name argument will be used as the site's path as well as the name field in the created app's package.json. It can be an absolute path, or a path relative to rootDir.

The template argument can be one of the following:

  • classic: Uses the classic template (recommended)
  • facebook: Uses the Facebook/Meta template, which contains some Meta-specific setup
  • A git repo URL (beginning with https:// or git@), which can be cloned to the destination
  • 現在のディレクトリを起点とする、作成先にコピーされるファイルを含むローカルファイルパス

The rootDir will be used to resolve the absolute path to the site directory. 初期値は現在のディレクトリです。

警告

このコマンドは、すべての機能が利用できるように、対話型シェルで使用することを推奨します。

Options

-t, --typescript

テンプレート引数が認識可能な名前である場合に使用されます。 Currently, only classic provides a TypeScript variant.

-g, --git-strategy

テンプレートの引数がGitリポジトリの場合に使用します。 次のいずれかである必要があります。

  • deep: preserves full git history
  • shallow: clones with --depth=1
  • copy: does a shallow clone, but does not create a git repo
  • custom: enter your custom git clone command. プロンプトを表示して尋ねます。 You can write something like git clone --depth 10, and we will append the repository URL and destination directory.

-p, --package-manager

Value should be one of npm, yarn, pnpm, or bun. 明示的に指定されていない場合、Docusaurusは以下を基に適切なものを推測します:

  • 現在の作業ディレクトリ(CWD)に既に存在するロックファイル(例えば、既存プロジェクトでウェブサイトをセットアップしている場合)
  • The command used to invoke create-docusaurus (e.g. npm init, npx, yarn create, bunx, etc.)
  • ヒューリスティック(経験則・推測ルール)が使えない場合は、対話形式のプロンプトが表示されます

-s, --skip-install

このオプションを指定すると、Docusaurusはアプリ作成後に依存関係を自動的にインストールしません。 The --package-manager option is only useful when you are actually installing dependencies.