feat!: set manage-package-manager-versions to true

This commit is contained in:
Zoltan Kochan
2024-09-20 16:03:37 +02:00
parent 5bcfc308c1
commit dfcf0347c5
4 changed files with 11 additions and 6 deletions

View File

@@ -0,0 +1,6 @@
---
"@pnpm/config": major
"pnpm": major
---
pnpm will now manage it's own versions according to the `packageManager` filed of `package.json`. To disable this, set `manage-package-manager-versions` to `false`.

View File

@@ -148,7 +148,7 @@ export async function getConfig (opts: {
'ignore-workspace-root-check': false,
'link-workspace-packages': false,
'lockfile-include-tarball-url': false,
'manage-package-manager-versions': false,
'manage-package-manager-versions': true,
'modules-cache-max-age': 7 * 24 * 60, // 7 days
'dlx-cache-max-age': 24 * 60, // 1 day
'node-linker': 'isolated',

View File

@@ -286,6 +286,7 @@ test('install should fail if the project requires a different package manager',
packageManager: 'yarn@4.0.0',
})
fs.writeFileSync('.npmrc', 'manage-package-manager-versions=false')
const { status, stdout } = execPnpmSync(['install'])
expect(status).toBe(1)

View File

@@ -4,11 +4,10 @@ import { prepare } from '@pnpm/prepare'
import { sync as writeJsonFile } from 'write-json-file'
import { execPnpmSync } from './utils'
test('switch to the pnpm version specified in the packageManager field of package.json, when manager-package-manager=versions is true', async () => {
test('switch to the pnpm version specified in the packageManager field of package.json', async () => {
prepare()
const pnpmHome = path.resolve('pnpm')
const env = { PNPM_HOME: pnpmHome }
fs.writeFileSync('.npmrc', 'manage-package-manager-versions=true')
writeJsonFile('package.json', {
packageManager: 'pnpm@9.3.0',
})
@@ -18,10 +17,11 @@ test('switch to the pnpm version specified in the packageManager field of packag
expect(stdout.toString()).toContain('Version 9.3.0')
})
test('do not switch to the pnpm version specified in the packageManager field of package.json', async () => {
test('do not switch to the pnpm version specified in the packageManager field of package.json, if manage-package-manager-versions is set to false', async () => {
prepare()
const pnpmHome = path.resolve('pnpm')
const env = { PNPM_HOME: pnpmHome }
fs.writeFileSync('.npmrc', 'manage-package-manager-versions=false')
writeJsonFile('package.json', {
packageManager: 'pnpm@9.3.0',
})
@@ -35,7 +35,6 @@ test('do not switch to pnpm version that is specified not with a semver version'
prepare()
const pnpmHome = path.resolve('pnpm')
const env = { PNPM_HOME: pnpmHome }
fs.writeFileSync('.npmrc', 'manage-package-manager-versions=true')
writeJsonFile('package.json', {
packageManager: 'pnpm@kevva/is-positive',
})
@@ -49,7 +48,6 @@ test('do not switch to pnpm version when a range is specified', async () => {
prepare()
const pnpmHome = path.resolve('pnpm')
const env = { PNPM_HOME: pnpmHome }
fs.writeFileSync('.npmrc', 'manage-package-manager-versions=true')
writeJsonFile('package.json', {
packageManager: 'pnpm@^9.3.0',
})