Skip to content

Commit 83270fe

Browse files
authoredAug 30, 2023
feat: detect bun package manager (#2874)
1 parent 40da45d commit 83270fe

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed
 

‎docs/guide/deploy.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ Don't enable options like _Auto Minify_ for HTML code. It will remove comments f
157157
with:
158158
fetch-depth: 0 # Not needed if lastUpdated is not enabled
159159
# - uses: pnpm/action-setup@v2 # Uncomment this if you're using pnpm
160+
# - uses: oven-sh/setup-bun@v1 # Uncomment this if you're using Bun
160161
- name: Setup Node
161162
uses: actions/setup-node@v3
162163
with:
@@ -165,10 +166,10 @@ Don't enable options like _Auto Minify_ for HTML code. It will remove comments f
165166
- name: Setup Pages
166167
uses: actions/configure-pages@v3
167168
- name: Install dependencies
168-
run: npm ci # or pnpm install / yarn install
169+
run: npm ci # or pnpm install / yarn install / bun install
169170
- name: Build with VitePress
170171
run: |
171-
npm run docs:build # or pnpm docs:build / yarn docs:build
172+
npm run docs:build # or pnpm docs:build / yarn docs:build / bun run docs:build
172173
touch docs/.vitepress/dist/.nojekyll
173174
- name: Upload artifact
174175
uses: actions/upload-pages-artifact@v2

‎docs/guide/getting-started.md

+16
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ $ pnpm add -D vitepress
2929
$ yarn add -D vitepress
3030
```
3131

32+
```sh [bun]
33+
$ bun add -D vitepress
34+
```
35+
3236
:::
3337

3438
::: details Getting missing peer deps warnings?
@@ -67,6 +71,10 @@ $ npx vitepress init
6771
$ pnpm dlx vitepress init
6872
```
6973

74+
```sh [bun]
75+
$ bunx vitepress init
76+
```
77+
7078
:::
7179

7280
You will be greeted with a few simple questions:
@@ -159,6 +167,10 @@ $ pnpm run docs:dev
159167
$ yarn docs:dev
160168
```
161169

170+
```sh [bun]
171+
$ bun run docs:dev
172+
```
173+
162174
:::
163175

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

188+
```sh [bun]
189+
$ bunx vitepress dev docs
190+
```
191+
176192
:::
177193

178194
More command line usage is documented in the [CLI Reference](../reference/cli).

‎src/node/init/init.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,9 @@ export function scaffold({
211211
`${getPackageManger()} run docs:dev`
212212
)} and start writing.${tip}`
213213
} else {
214+
const execCommand = getPackageManger() === 'bun' ? 'bunx' : 'npx'
214215
return `You're all set! Now run ${cyan(
215-
`npx vitepress dev${dir}`
216+
`${execCommand} vitepress dev${dir}`
216217
)} and start writing.${tip}`
217218
}
218219
}

0 commit comments

Comments
 (0)
Please sign in to comment.