feat: update version when pinnedVersion is * (#5720)

close #5681
This commit is contained in:
Homyee King
2022-12-01 06:00:49 +08:00
committed by GitHub
parent 93558ce68f
commit c245edf1b6
3 changed files with 7 additions and 2 deletions

View File

@@ -0,0 +1,6 @@
---
"@pnpm/manifest-utils": patch
"pnpm": patch
---
Dependencies specified via `*` should be updated to semver ranges by `pnpm update` [#5681](https://github.com/pnpm/pnpm/issues/5681).

View File

@@ -19,7 +19,6 @@ export function getPref (
export function createVersionSpec (version: string | undefined, opts: { pinnedVersion?: PinnedVersion, rolling?: boolean }) {
switch (opts.pinnedVersion ?? 'major') {
case 'none':
return '*'
case 'major':
if (opts.rolling) return '^'
return !version ? '*' : `^${version}`

View File

@@ -25,7 +25,7 @@ test('getPref()', () => {
getPref('foo', 'foo', '4.0.0', {
pinnedVersion: 'none',
})
).toEqual('*')
).toEqual('^4.0.0')
expect(
getPref('foo', 'foo', undefined, {