This is the developer documentation for the Svelte CLI. # Overview コマンドラインインターフェイス(CLI)である`sv`は、Svelteアプリケーションの作成と管理のためのツールキットです。 ## 使用方法 `sv`を実行する最も簡単な方法は、[`npx`](https://docs.npmjs.com/cli/v8/commands/npx)(または他のパッケージマネージャを使用している場合は同等のコマンド - 例えば、[pnpm](https://pnpm.io/)を使用している場合は`pnpx`)を使うことです: ```sh npx sv ``` 既に`sv`がインストールされているプロジェクトの内部にいる場合は、ローカルインストールを使用します。それ以外の場合は最新バージョンをダウンロードしてインストール無しで実行します。これは特に[`sv create`](sv-create)に便利です。 ## 謝辞 npmで元々`sv`という名前を所有していた[Christopher Brown](https://github.com/chbrown)に感謝いたします。彼のおかげで、この名前がSvelte CLIのために使えるようになりました。元の`sv`パッケージは[`@chbrown/sv`](https://www.npmjs.com/package/@chbrown/sv)で見つけることができます。 # Frequently asked questions ## How do I run the `sv` CLI? Running `sv` looks slightly different for each package manager. Here is a list of the most common commands: - **npm** : `npx sv create` - **pnpm** : `pnpx sv create` or `pnpm dlx sv create` - **Bun** : `bunx sv create` - **Deno** : `deno run npm:sv create` - **Yarn** : `yarn dlx sv create` ## `npx sv` is not working Some package managers prefer to run locally installed tools instead of downloading and executing packages from the registry. This issue mostly occurs with `npm` and `yarn`. This usually results in an error message or looks like the command you were trying to execute did not do anything. Here is a list of issues with possible solutions that users have encountered in the past: - [`npx sv` create does nothing](https://github.com/sveltejs/cli/issues/472) - [`sv` command name collides with `runit`](https://github.com/sveltejs/cli/issues/259) - [`sv` in windows powershell conflicts with `Set-Variable`](https://github.com/sveltejs/cli/issues/317) # sv create `sv create`は、[追加機能の設定](sv-add#Official-add-ons)オプションを含む新しいSvelteKitプロジェクトをセットアップします。 ## 使用方法 ```sh npx sv create [options] [path] ``` ## オプション ### `--from-playground ` Create a SvelteKit project from a [playground](/playground) URL. This downloads all playground files, detects external dependencies, and sets up a complete SvelteKit project structure with everything ready to go. Example: ```sh npx sv create --from-playground="https://svelte.dev/playground/hello-world" ``` ### `--template ` 使用するプロジェクトテンプレート: - `minimal` — 新しいアプリのための最小限のスキャフォールディング - `demo` — JavaScript無しで動作するワードパズルゲームを備えたデモアプリ - `library` — Svelteライブラリのためのテンプレートで、`svelte-package`でセットアップされています ### `--types