Skip to content

Commit

Permalink
fix: downgrade lockfile version to 6.0 (#6664)
Browse files Browse the repository at this point in the history
close #6648
  • Loading branch information
zkochan committed Jun 11, 2023
1 parent c8422c6 commit dcedc35
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
6 changes: 6 additions & 0 deletions .changeset/grumpy-shrimps-hunt.md
@@ -0,0 +1,6 @@
---
"@pnpm/constants": patch
"pnpm": patch
---

Change lockfile version back to 6.0 as previous versions of pnpm fail to parse the version correctly.
2 changes: 1 addition & 1 deletion lockfile/lockfile-file/src/read.ts
Expand Up @@ -109,7 +109,7 @@ async function _read (
opts.wantedVersions.length === 0 ||
opts.wantedVersions.some((wantedVersion) => {
if (semver.major(lockfileSemver) !== semver.major(comverToSemver(wantedVersion))) return false
if (semver.gt(lockfileSemver, comverToSemver(wantedVersion))) {
if (lockfile.lockfileVersion !== '6.1' && semver.gt(lockfileSemver, comverToSemver(wantedVersion))) {
logger.warn({
message: `Your ${WANTED_LOCKFILE} was generated by a newer version of pnpm. ` +
`It is a compatible version but it might get downgraded to version ${wantedVersion}`,
Expand Down
2 changes: 1 addition & 1 deletion packages/constants/src/index.ts
@@ -1,6 +1,6 @@
export const WANTED_LOCKFILE = 'pnpm-lock.yaml'
export const LOCKFILE_VERSION = 5.4
export const LOCKFILE_VERSION_V6 = '6.1'
export const LOCKFILE_VERSION_V6 = '6.0'

export const ENGINE_NAME = `${process.platform}-${process.arch}-node-${process.version.split('.')[0]}`
export const LAYOUT_VERSION = 5
Expand Down
3 changes: 2 additions & 1 deletion pkg-manager/core/src/install/index.ts
Expand Up @@ -370,7 +370,8 @@ export async function mutateModules (
ctx.existsWantedLockfile &&
(
ctx.wantedLockfile.lockfileVersion === LOCKFILE_VERSION ||
ctx.wantedLockfile.lockfileVersion === LOCKFILE_VERSION_V6
ctx.wantedLockfile.lockfileVersion === LOCKFILE_VERSION_V6 ||
ctx.wantedLockfile.lockfileVersion === '6.1'
) &&
await allProjectsAreUpToDate(Object.values(ctx.projects), {
autoInstallPeers: opts.autoInstallPeers,
Expand Down

0 comments on commit dcedc35

Please sign in to comment.