Skip to content

Commit cf343ee

Browse files
committed
fix: fix pnpm install hoist bug
1 parent c56bc79 commit cf343ee

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

packages/init/src/npmrc.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export const npmrcContent = `shamefully-hoist=true
2+
strict-peer-dependencies=false
3+
`

packages/init/src/template.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import ejs from 'ejs'
88
import { execaCommand } from 'execa'
99
import ora from 'ora'
1010
import { fileContent } from './gitignore'
11+
import { npmrcContent } from './npmrc'
1112
import type { TemplateListItem } from '@vbs/magic-cli-templates'
1213
import type { ProjectInfo } from './type'
1314

@@ -104,7 +105,7 @@ export async function renderTemplate(template: TemplateListItem, projectInfo: Pa
104105

105106
try {
106107
info('🔫 正在执行依赖安装命令...')
107-
fse.writeFileSync(path.resolve(targetPath, '.npmrc'), 'strict-peer-dependencies = false')
108+
fse.writeFileSync(path.resolve(targetPath, '.npmrc'), npmrcContent)
108109
fse.writeFileSync(path.resolve(targetPath, '.gitignore'), fileContent)
109110
await execaCommand(installCommand, { stdio: 'inherit', encoding: 'utf-8', cwd: targetPath })
110111
} catch (error: any) {

0 commit comments

Comments
 (0)