mirror of
https://github.com/nuxt/nuxt.git
synced 2025-02-16 21:58:19 +00:00
feat(nuxi): auto-generate .npmrc
and setting for pnpm (#7407)
Co-authored-by: Pooya Parsa <pooya@pi0.io>
This commit is contained in:
parent
cd2e004edf
commit
2f53495033
@ -74,11 +74,15 @@ npm install
|
|||||||
```
|
```
|
||||||
|
|
||||||
```bash [pnpm]
|
```bash [pnpm]
|
||||||
pnpm install --shamefully-hoist
|
pnpm install
|
||||||
```
|
```
|
||||||
|
|
||||||
::
|
::
|
||||||
|
|
||||||
|
::alert
|
||||||
|
**Note:** If using **pnpm**, make sure to have `.npmrc` with `shamefully-hoist=true` inside it before `pnpm install`.
|
||||||
|
::
|
||||||
|
|
||||||
## Development Server
|
## Development Server
|
||||||
|
|
||||||
Now you'll be able to start your Nuxt app in development mode:
|
Now you'll be able to start your Nuxt app in development mode:
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import { writeFile } from 'node:fs/promises'
|
||||||
import { downloadTemplate, startShell } from 'giget'
|
import { downloadTemplate, startShell } from 'giget'
|
||||||
import { relative } from 'pathe'
|
import { relative } from 'pathe'
|
||||||
import consola from 'consola'
|
import consola from 'consola'
|
||||||
@ -27,9 +28,16 @@ export default defineNuxtCommand({
|
|||||||
|
|
||||||
// Show next steps
|
// Show next steps
|
||||||
const relativeDist = rpath(t.dir)
|
const relativeDist = rpath(t.dir)
|
||||||
|
|
||||||
|
// Write .nuxtrc with `shamefully-hoist=true` for pnpm
|
||||||
|
const usingPnpm = (process.env.npm_config_user_agent || '').includes('pnpm')
|
||||||
|
if (usingPnpm) {
|
||||||
|
await writeFile(`${relativeDist}/.npmrc`, 'shamefully-hoist=true')
|
||||||
|
}
|
||||||
|
|
||||||
const nextSteps = [
|
const nextSteps = [
|
||||||
!args.shell && relativeDist.length > 1 && `\`cd ${relativeDist}\``,
|
!args.shell && relativeDist.length > 1 && `\`cd ${relativeDist}\``,
|
||||||
'Install dependencies with `npm install` or `yarn install` or `pnpm install --shamefully-hoist`',
|
'Install dependencies with `npm install` or `yarn install` or `pnpm install`',
|
||||||
'Start development server with `npm run dev` or `yarn dev` or `pnpm run dev`'
|
'Start development server with `npm run dev` or `yarn dev` or `pnpm run dev`'
|
||||||
].filter(Boolean)
|
].filter(Boolean)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user