mirror of
https://github.com/withastro/astro.git
synced 2024-12-23 21:53:55 -05:00
a800bf7ec1
* .md only: npm init astro --> npm create astro For consistency with https://github.com/withastro/docs/pull/360. Docs always use `npm create astro` (never `npm init astro`), README.md files in this repo should do the same. Search: `\b(npm|yarn|pnpm) init astro\b` Replace: `$1 create astro` Except for two instances: 1. `packages/create-astro/CHANGELOG.md` -- skipped because changelog. 2. `packages/create-astro/test/create-astro.test.js.skipped` -- skipped, old test disabled in https://github.com/withastro/astro/pull/3168. * docs: add `@latest` to `npm create astro` Co-authored-by: Bjorn Lu <bjorn@bjornlu.com> Co-authored-by: Michael Rienstra <michael@goodmoney.com>
61 lines
1.6 KiB
Markdown
61 lines
1.6 KiB
Markdown
# create-astro
|
|
|
|
## Scaffolding for Astro projects
|
|
|
|
**With NPM:**
|
|
|
|
```bash
|
|
npm create astro@latest
|
|
```
|
|
|
|
**With Yarn:**
|
|
|
|
```bash
|
|
yarn create astro
|
|
```
|
|
|
|
`create-astro` automatically runs in _interactive_ mode, but you can also specify your project name and template with command line arguments.
|
|
|
|
```bash
|
|
# npm 6.x
|
|
npm create astro@latest my-astro-project --template starter
|
|
|
|
# npm 7+, extra double-dash is needed:
|
|
npm create astro@latest my-astro-project -- --template starter
|
|
|
|
# yarn
|
|
yarn create astro my-astro-project --template starter
|
|
```
|
|
[Check out the full list][examples] of example starter templates, available on GitHub.
|
|
|
|
You can also use any GitHub repo as a template:
|
|
|
|
```bash
|
|
npm create astro@latest my-astro-project -- --template cassidoo/shopify-react-astro
|
|
```
|
|
|
|
### CLI Flags
|
|
|
|
May be provided in place of prompts
|
|
|
|
| Name | Description |
|
|
|:-------------|:----------------------------------------------------|
|
|
| `--template` | Specify the template name ([list][examples]) |
|
|
| `--commit` | Specify a specific Git commit or branch to use from this repo (by default, `main` branch of this repo will be used) |
|
|
|
|
### Debugging
|
|
|
|
To debug `create-astro`, you can use the `--verbose` flag which will log the output of degit and some more information about the command, this can be useful when you encounter an error and want to report it.
|
|
|
|
```bash
|
|
# npm 6.x
|
|
npm create astro@latest my-astro-project --verbose
|
|
|
|
# npm 7+, extra double-dash is needed:
|
|
npm create astro@latest my-astro-project -- --verbose
|
|
|
|
# yarn
|
|
yarn create astro my-astro-project --verbose
|
|
```
|
|
|
|
[examples]: https://github.com/withastro/astro/tree/main/examples
|