Skip to content
This repository was archived by the owner on Apr 6, 2023. It is now read-only.

Commit 6026ff3

Browse files
kecrilypi0
authored andcommitted
feat(nuxi): auto-generate .npmrc and setting for pnpm (#7407)
Co-authored-by: Pooya Parsa <[email protected]>
1 parent 6cff1c3 commit 6026ff3

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

docs/content/1.getting-started/2.installation.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,15 @@ npm install
7474
```
7575

7676
```bash [pnpm]
77-
pnpm install --shamefully-hoist
77+
pnpm install
7878
```
7979

8080
::
8181

82+
::alert
83+
**Note:** If using **pnpm**, make sure to have `.npmrc` with `shamefully-hoist=true` inside it before `pnpm install`.
84+
::
85+
8286
## Development Server
8387

8488
Now you'll be able to start your Nuxt app in development mode:

packages/nuxi/src/commands/init.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { writeFile } from 'node:fs/promises'
12
import { downloadTemplate, startShell } from 'giget'
23
import { relative } from 'pathe'
34
import consola from 'consola'
@@ -27,9 +28,16 @@ export default defineNuxtCommand({
2728

2829
// Show next steps
2930
const relativeDist = rpath(t.dir)
31+
32+
// Write .nuxtrc with `shamefully-hoist=true` for pnpm
33+
const usingPnpm = (process.env.npm_config_user_agent || '').includes('pnpm')
34+
if (usingPnpm) {
35+
await writeFile(`${relativeDist}/.npmrc`, 'shamefully-hoist=true')
36+
}
37+
3038
const nextSteps = [
3139
!args.shell && relativeDist.length > 1 && `\`cd ${relativeDist}\``,
32-
'Install dependencies with `npm install` or `yarn install` or `pnpm install --shamefully-hoist`',
40+
'Install dependencies with `npm install` or `yarn install` or `pnpm install`',
3341
'Start development server with `npm run dev` or `yarn dev` or `pnpm run dev`'
3442
].filter(Boolean)
3543

0 commit comments

Comments
 (0)