From f44b736eae8c46813aed7df2ccc1c811c216aebf Mon Sep 17 00:00:00 2001 From: 2239559319 Date: Tue, 20 Jun 2023 22:01:49 +0800 Subject: [PATCH] fix: pnpm @docusaurus/types hoist --- packages/create-docusaurus/src/index.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/packages/create-docusaurus/src/index.ts b/packages/create-docusaurus/src/index.ts index a4fba1214132..52fc5b4b47ad 100755 --- a/packages/create-docusaurus/src/index.ts +++ b/packages/create-docusaurus/src/index.ts @@ -519,6 +519,18 @@ export default async function init( // Display the most elegant way to cd. const cdpath = path.relative('.', dest); const pkgManager = await getPackageManager(dest, cliOptions); + + if (pkgManager === 'pnpm') { + await fs.writeFile( + path.join(dest, '.npmrc'), + `\npublic-hoist-pattern[]=@docusaurus/types`, + { + flag: 'a', + encoding: 'utf-8', + }, + ); + } + if (!cliOptions.skipInstall) { shell.cd(dest); logger.info`Installing dependencies with name=${pkgManager}...`;