Skip to content

Commit f264d85

Browse files
Merge branch 'main' into update-extraction-dir-location
2 parents 9322fbb + 7cb02d3 commit f264d85

File tree

3 files changed

+82
-0
lines changed

3 files changed

+82
-0
lines changed

runtime/_data.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,10 @@ export const sidebar = [
128128
title: "deno compile",
129129
href: "/runtime/reference/cli/compile/",
130130
},
131+
{
132+
title: "deno create",
133+
href: "/runtime/reference/cli/create/",
134+
},
131135
{
132136
title: "deno completions",
133137
href: "/runtime/reference/cli/completions/",

runtime/reference/cli/create.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
---
2+
title: "deno create, scaffold a new project"
3+
command: create
4+
openGraphLayout: "/open_graph/cli-commands.jsx"
5+
openGraphTitle: "deno create"
6+
description: "Scaffold a new project from a template package"
7+
---
8+
9+
The `deno create` command scaffolds a new project from a template package. It
10+
works with both [JSR](https://jsr.io/) and [npm](https://www.npmjs.com/)
11+
packages that provide project templates.
12+
13+
## Usage
14+
15+
```sh
16+
deno create [OPTIONS] [PACKAGE] [-- [ARGS]...]
17+
```
18+
19+
By default, unprefixed package names are resolved from JSR. You can use the
20+
`npm:` or `jsr:` prefix to be explicit, or use the `--npm` / `--jsr` flags.
21+
22+
## How it works
23+
24+
Package resolution differs between npm and JSR:
25+
26+
- **npm packages** use the `create-` naming convention. Running
27+
`deno create npm:vite` resolves to the `create-vite` package on npm and
28+
executes its main entry point.
29+
- **JSR packages** use the `./create` export. Any JSR package can act as a
30+
template by defining a `./create` entry point in its `deno.json`:
31+
32+
```json title="deno.json"
33+
{
34+
"name": "@my-scope/my-template",
35+
"version": "1.0.0",
36+
"exports": {
37+
".": "./mod.ts",
38+
"./create": "./create.ts"
39+
}
40+
}
41+
```
42+
43+
When you run `deno create @my-scope/my-template`, Deno looks for the `./create`
44+
export and runs it as the scaffolding script.
45+
46+
## Examples
47+
48+
Create a project from a JSR package:
49+
50+
```sh
51+
deno create @fresh/init
52+
```
53+
54+
Create a project from an npm package:
55+
56+
```sh
57+
deno create npm:vite my-app
58+
```
59+
60+
Using the `--npm` flag to treat unprefixed names as npm packages:
61+
62+
```sh
63+
deno create --npm create-vite my-app
64+
```
65+
66+
Pass arguments to the template package:
67+
68+
```sh
69+
deno create @fresh/init -- --force
70+
```
71+
72+
## Flags
73+
74+
- `--npm` - Treat unprefixed package names as npm packages
75+
- `--jsr` - Treat unprefixed package names as JSR packages (default)
76+
- `-y, --yes` - Bypass the prompt and run with full permissions

runtime/reference/cli/index.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ below for more information on each subcommand.
4545
completions
4646
- [deno coverage](/runtime/reference/cli/coverage/) - generate test coverage
4747
reports
48+
- [deno create](/runtime/reference/cli/create/) - scaffold a new project from a
49+
template
4850
- [deno doc](/runtime/reference/cli/doc/) - generate documentation for a module
4951
- [deno deploy](/runtime/reference/cli/deploy) - Manage and publish your
5052
projects on the web

0 commit comments

Comments
 (0)