Skip to content

Commit

Permalink
feat: detect bun package manager (#2874)
Browse files Browse the repository at this point in the history
  • Loading branch information
colinhacks committed Aug 30, 2023
1 parent 40da45d commit 83270fe
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
5 changes: 3 additions & 2 deletions docs/guide/deploy.md
Expand Up @@ -157,6 +157,7 @@ Don't enable options like _Auto Minify_ for HTML code. It will remove comments f
with:
fetch-depth: 0 # Not needed if lastUpdated is not enabled
# - uses: pnpm/action-setup@v2 # Uncomment this if you're using pnpm
# - uses: oven-sh/setup-bun@v1 # Uncomment this if you're using Bun
- name: Setup Node
uses: actions/setup-node@v3
with:
Expand All @@ -165,10 +166,10 @@ Don't enable options like _Auto Minify_ for HTML code. It will remove comments f
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Install dependencies
run: npm ci # or pnpm install / yarn install
run: npm ci # or pnpm install / yarn install / bun install
- name: Build with VitePress
run: |
npm run docs:build # or pnpm docs:build / yarn docs:build
npm run docs:build # or pnpm docs:build / yarn docs:build / bun run docs:build
touch docs/.vitepress/dist/.nojekyll
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
Expand Down
16 changes: 16 additions & 0 deletions docs/guide/getting-started.md
Expand Up @@ -29,6 +29,10 @@ $ pnpm add -D vitepress
$ yarn add -D vitepress
```

```sh [bun]
$ bun add -D vitepress
```

:::

::: details Getting missing peer deps warnings?
Expand Down Expand Up @@ -67,6 +71,10 @@ $ npx vitepress init
$ pnpm dlx vitepress init
```

```sh [bun]
$ bunx vitepress init
```

:::

You will be greeted with a few simple questions:
Expand Down Expand Up @@ -159,6 +167,10 @@ $ pnpm run docs:dev
$ yarn docs:dev
```

```sh [bun]
$ bun run docs:dev
```

:::

Instead of npm scripts, you can also invoke VitePress directly with:
Expand All @@ -173,6 +185,10 @@ $ npx vitepress dev docs
$ pnpm exec vitepress dev docs
```

```sh [bun]
$ bunx vitepress dev docs
```

:::

More command line usage is documented in the [CLI Reference](../reference/cli).
Expand Down
3 changes: 2 additions & 1 deletion src/node/init/init.ts
Expand Up @@ -211,8 +211,9 @@ export function scaffold({
`${getPackageManger()} run docs:dev`
)} and start writing.${tip}`
} else {
const execCommand = getPackageManger() === 'bun' ? 'bunx' : 'npx'
return `You're all set! Now run ${cyan(
`npx vitepress dev${dir}`
`${execCommand} vitepress dev${dir}`
)} and start writing.${tip}`
}
}

0 comments on commit 83270fe

Please sign in to comment.