mirror of
https://github.com/pnpm/pnpm.git
synced 2025-12-24 07:38:12 -05:00
feat!: set manage-package-manager-versions to true
This commit is contained in:
6
.changeset/fifty-forks-think.md
Normal file
6
.changeset/fifty-forks-think.md
Normal 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`.
|
||||
@@ -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',
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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',
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user