-
Notifications
You must be signed in to change notification settings - Fork 353
docs: add deno create command reference #2948
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.