Skip to content

Commit

Permalink
fix: fix pnpm install hoist bug
Browse files Browse the repository at this point in the history
  • Loading branch information
yzh990918 committed Nov 2, 2022
1 parent c56bc79 commit cf343ee
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions packages/init/src/npmrc.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const npmrcContent = `shamefully-hoist=true
strict-peer-dependencies=false
`
3 changes: 2 additions & 1 deletion packages/init/src/template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import ejs from 'ejs'
import { execaCommand } from 'execa'
import ora from 'ora'
import { fileContent } from './gitignore'
import { npmrcContent } from './npmrc'
import type { TemplateListItem } from '@vbs/magic-cli-templates'
import type { ProjectInfo } from './type'

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

try {
info('馃敨 姝e湪鎵ц渚濊禆瀹夎鍛戒护...')
fse.writeFileSync(path.resolve(targetPath, '.npmrc'), 'strict-peer-dependencies = false')
fse.writeFileSync(path.resolve(targetPath, '.npmrc'), npmrcContent)
fse.writeFileSync(path.resolve(targetPath, '.gitignore'), fileContent)
await execaCommand(installCommand, { stdio: 'inherit', encoding: 'utf-8', cwd: targetPath })
} catch (error: any) {
Expand Down

0 comments on commit cf343ee

Please sign in to comment.