feat: dedupe-direct-deps (#6319)

close #6299
This commit is contained in:
Zoltan Kochan
2023-03-30 00:56:15 +03:00
committed by GitHub
parent e2cb4b63d2
commit cd6ce11f05
3 changed files with 43 additions and 0 deletions

View File

@@ -0,0 +1,6 @@
---
"@pnpm/config": minor
"pnpm": minor
---
A new settig has been added called `dedupe-direct-deps`, which is disabled by default. When set to `true`, dependencies that are already symlinked to the root `node_modules` directory of the workspace will not be symlinked to subproject `node_modules` directories. This feature was enabled by default in v8.0.0 but caused issues, so it's best to disable it by default [#6299](https://github.com/pnpm/pnpm/issues/6299).

View File

@@ -41,6 +41,7 @@ export const types = Object.assign({
'config-dir': String,
'deploy-all-files': Boolean,
'dedupe-peer-dependents': Boolean,
'dedupe-direct-deps': Boolean,
dev: [null, true],
dir: String,
'enable-modules-dir': Boolean,
@@ -187,6 +188,7 @@ export async function getConfig (
color: 'auto',
'deploy-all-files': false,
'dedupe-peer-dependents': true,
'dedupe-direct-deps': false,
'enable-modules-dir': true,
'extend-node-path': true,
'fetch-retries': 2,

View File

@@ -62,6 +62,41 @@ test('shamefully-hoist: applied to all the workspace projects when set to true i
await execPnpm(['install'])
await projects.root.has('@pnpm.e2e/dep-of-pkg-with-1-dep')
await projects.root.has('@pnpm.e2e/foo')
await projects.root.has('@pnpm.e2e/foobar')
await projects.project.hasNot('@pnpm.e2e/foo')
await projects.project.has('@pnpm.e2e/foobar')
})
test('shamefully-hoist: applied to all the workspace projects when set to true in the root .npmrc file (with dedupe-direct-deps=true)', async () => {
const projects = preparePackages([
{
location: '.',
package: {
name: 'root',
dependencies: {
'@pnpm.e2e/pkg-with-1-dep': '100.0.0',
},
},
},
{
name: 'project',
version: '1.0.0',
dependencies: {
'@pnpm.e2e/foobar': '100.0.0',
},
},
])
await writeYamlFile('pnpm-workspace.yaml', { packages: ['**', '!store/**'] })
await fs.writeFile('.npmrc', `shamefully-hoist=true
dedupe-direct-deps=true`, 'utf8')
await execPnpm(['install'])
await projects.root.has('@pnpm.e2e/dep-of-pkg-with-1-dep')
await projects.root.has('@pnpm.e2e/foo')
await projects.root.has('@pnpm.e2e/foobar')