Skip to content

Commit

Permalink
feat: add pnpm, yarn and bun support in quick-start (#2605)
Browse files Browse the repository at this point in the history
* feat: add pnpm, yarn and bun support in quick-start

* fix: simplify yarn instructions
  • Loading branch information
the-pesar committed Dec 19, 2023
1 parent c15a06f commit bcc313c
Showing 1 changed file with 103 additions and 8 deletions.
111 changes: 103 additions & 8 deletions src/guide/quick-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
footer: false
---

<script setup>
import { VTCodeGroup, VTCodeGroupTab } from '@vue/theme'
</script>

# Quick Start {#quick-start}

## Try Vue Online {#try-vue-online}
Expand All @@ -22,9 +26,38 @@ footer: false

In this section we will introduce how to scaffold a Vue [Single Page Application](/guide/extras/ways-of-using-vue#single-page-application-spa) on your local machine. The created project will be using a build setup based on [Vite](https://vitejs.dev) and allow us to use Vue [Single-File Components](/guide/scaling-up/sfc) (SFCs).

Make sure you have an up-to-date version of [Node.js](https://nodejs.org/) installed and your current working directory is the one where you intend to create a project. Run the following command in your command line (without the `>` sign):
Make sure you have an up-to-date version of [Node.js](https://nodejs.org/) installed and your current working directory is the one where you intend to create a project. Run the following command in your command line (without the `$` sign):

<VTCodeGroup>
<VTCodeGroupTab label="npm">

```sh
$ npm create vue@latest
```

</VTCodeGroupTab>
<VTCodeGroupTab label="pnpm">

```sh
$ pnpm create vue@latest
```

</VTCodeGroupTab>
<VTCodeGroupTab label="yarn">

```sh
$ yarn create vue@latest
```

</VTCodeGroupTab>
<VTCodeGroupTab label="bun">

```sh
$ bun create vue@latest
```

<div class="language-sh"><pre><code><span class="line"><span style="color:var(--vt-c-green);">&gt;</span> <span style="color:#A6ACCD;">npm create vue@latest</span></span></code></pre></div>
</VTCodeGroupTab>
</VTCodeGroup>

This command will install and execute [create-vue](https://github.com/vuejs/create-vue), the official Vue project scaffolding tool. You will be presented with prompts for several optional features such as TypeScript and testing support:

Expand All @@ -43,10 +76,44 @@ This command will install and execute [create-vue](https://github.com/vuejs/crea

If you are unsure about an option, simply choose `No` by hitting enter for now. Once the project is created, follow the instructions to install dependencies and start the dev server:

<div class="language-sh"><pre><code><span class="line"><span style="color:var(--vt-c-green);">&gt; </span><span style="color:#A6ACCD;">cd</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;">&lt;</span><span style="color:#888;">your-project-name</span><span style="color:#89DDFF;">&gt;</span></span>
<span class="line"><span style="color:var(--vt-c-green);">&gt; </span><span style="color:#A6ACCD;">npm install</span></span>
<span class="line"><span style="color:var(--vt-c-green);">&gt; </span><span style="color:#A6ACCD;">npm run dev</span></span>
<span class="line"></span></code></pre></div>
<VTCodeGroup>
<VTCodeGroupTab label="npm">

```sh
$ cd <your-project-name>
$ npm install
$ npm run dev
```

</VTCodeGroupTab>
<VTCodeGroupTab label="pnpm">

```sh
$ cd <your-project-name>
$ pnpm install
$ pnpm run dev
```

</VTCodeGroupTab>
<VTCodeGroupTab label="yarn">

```sh
$ cd <your-project-name>
$ yarn
$ yarn dev
```

</VTCodeGroupTab>
<VTCodeGroupTab label="bun">

```sh
$ cd <your-project-name>
$ bun install
$ bun run dev
```

</VTCodeGroupTab>
</VTCodeGroup>

You should now have your first Vue project running! Note that the example components in the generated project are written using the [Composition API](/guide/introduction#composition-api) and `<script setup>`, rather than the [Options API](/guide/introduction#options-api). Here are some additional tips:

Expand All @@ -57,8 +124,36 @@ You should now have your first Vue project running! Note that the example compon

When you are ready to ship your app to production, run the following:

<div class="language-sh"><pre><code><span class="line"><span style="color:var(--vt-c-green);">&gt; </span><span style="color:#A6ACCD;">npm run build</span></span>
<span class="line"></span></code></pre></div>
<VTCodeGroup>
<VTCodeGroupTab label="npm">

```sh
$ npm run build
```

</VTCodeGroupTab>
<VTCodeGroupTab label="pnpm">

```sh
$ pnpm run build
```

</VTCodeGroupTab>
<VTCodeGroupTab label="yarn">

```sh
$ yarn build
```

</VTCodeGroupTab>
<VTCodeGroupTab label="bun">

```sh
$ bun run build
```

</VTCodeGroupTab>
</VTCodeGroup>

This will create a production-ready build of your app in the project's `./dist` directory. Check out the [Production Deployment Guide](/guide/best-practices/production-deployment) to learn more about shipping your app to production.

Expand Down

0 comments on commit bcc313c

Please sign in to comment.