Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions runtime/_data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,10 @@ export const sidebar = [
title: "deno compile",
href: "/runtime/reference/cli/compile/",
},
{
title: "deno create",
href: "/runtime/reference/cli/create/",
},
{
title: "deno completions",
href: "/runtime/reference/cli/completions/",
Expand Down
76 changes: 76 additions & 0 deletions runtime/reference/cli/create.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
---
title: "`deno create`, scaffold a new project"
command: create
openGraphLayout: "/open_graph/cli-commands.jsx"
openGraphTitle: "deno create"
description: "Scaffold a new project from a template package"
---

The `deno create` command scaffolds a new project from a template package. It
works with both [JSR](https://jsr.io/) and [npm](https://www.npmjs.com/)
packages that provide project templates.

## Usage

```sh
deno create [OPTIONS] [PACKAGE] [-- [ARGS]...]
```

By default, unprefixed package names are resolved from JSR. You can use the
`npm:` or `jsr:` prefix to be explicit, or use the `--npm` / `--jsr` flags.

## How it works

Package resolution differs between npm and JSR:

- **npm packages** use the `create-` naming convention. Running
`deno create npm:vite` resolves to the `create-vite` package on npm and
executes its main entry point.
- **JSR packages** use the `./create` export. Any JSR package can act as a
template by defining a `./create` entry point in its `deno.json`:

```json title="deno.json"
{
"name": "@my-scope/my-template",
"version": "1.0.0",
"exports": {
".": "./mod.ts",
"./create": "./create.ts"
}
}
```

When you run `deno create @my-scope/my-template`, Deno looks for the `./create`
export and runs it as the scaffolding script.

## Examples

Create a project from a JSR package:

```sh
deno create @fresh/init
```

Create a project from an npm package:

```sh
deno create npm:vite my-app
```

Using the `--npm` flag to treat unprefixed names as npm packages:

```sh
deno create --npm create-vite my-app
```

Pass arguments to the template package:

```sh
deno create @fresh/init -- --force
```

## Flags

- `--npm` - Treat unprefixed package names as npm packages
- `--jsr` - Treat unprefixed package names as JSR packages (default)
- `-y, --yes` - Bypass the prompt and run with full permissions
2 changes: 2 additions & 0 deletions runtime/reference/cli/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ below for more information on each subcommand.
completions
- [deno coverage](/runtime/reference/cli/coverage/) - generate test coverage
reports
- [deno create](/runtime/reference/cli/create/) - scaffold a new project from a
template
- [deno doc](/runtime/reference/cli/doc/) - generate documentation for a module
- [deno deploy](/runtime/reference/cli/deploy) - Manage and publish your
projects on the web
Expand Down