refactor: bump lockfile version to v9 instead of v7 (#7861)

In order to align the lockfile version with pnpm version that ships it.
This commit is contained in:
Zoltan Kochan
2024-04-06 17:12:37 +02:00
committed by GitHub
parent a950ba8d7b
commit 501133d30b
100 changed files with 111 additions and 116 deletions

View File

@@ -1,4 +1,4 @@
lockfileVersion: '7.0'
lockfileVersion: '9.0'
settings:
autoInstallPeers: true

View File

@@ -1,4 +1,4 @@
lockfileVersion: '7.0'
lockfileVersion: '9.0'
importers:

View File

@@ -1,4 +1,4 @@
lockfileVersion: '7.0'
lockfileVersion: '9.0'
settings:
autoInstallPeers: true

View File

@@ -1,4 +1,4 @@
lockfileVersion: '7.0'
lockfileVersion: '9.0'
importers:

View File

@@ -1,4 +1,4 @@
lockfileVersion: '7.0'
lockfileVersion: '9.0'
settings:
autoInstallPeers: true

View File

@@ -1,4 +1,4 @@
lockfileVersion: '7.0'
lockfileVersion: '9.0'
settings:
autoInstallPeers: true

View File

@@ -1,4 +1,4 @@
lockfileVersion: '7.0'
lockfileVersion: '9.0'
settings:
autoInstallPeers: true

View File

@@ -1,4 +1,4 @@
lockfileVersion: '7.0'
lockfileVersion: '9.0'
dependencies:
minimatch:

View File

@@ -1,4 +1,4 @@
lockfileVersion: '7.0'
lockfileVersion: '9.0'
dependencies:
general:

View File

@@ -1,4 +1,4 @@
lockfileVersion: '7.0'
lockfileVersion: '9.0'
settings:
autoInstallPeers: true

View File

@@ -1,4 +1,4 @@
lockfileVersion: '7.0'
lockfileVersion: '9.0'
settings:
autoInstallPeers: true

View File

@@ -1,4 +1,4 @@
lockfileVersion: '7.0'
lockfileVersion: '9.0'
settings:
autoInstallPeers: true

View File

@@ -1,4 +1,4 @@
lockfileVersion: '7.0'
lockfileVersion: '9.0'
dependencies:
is-negative:

View File

@@ -1,4 +1,4 @@
lockfileVersion: '7.0'
lockfileVersion: '9.0'
importers:

View File

@@ -1,4 +1,4 @@
lockfileVersion: '7.0'
lockfileVersion: '9.0'
importers:
pkg:

View File

@@ -1,4 +1,4 @@
lockfileVersion: '7.0'
lockfileVersion: '9.0'
importers:

View File

@@ -1,4 +1,4 @@
lockfileVersion: '7.0'
lockfileVersion: '9.0'
settings:
autoInstallPeers: true

View File

@@ -1,4 +1,4 @@
lockfileVersion: '7.0'
lockfileVersion: '9.0'
settings:
autoInstallPeers: true

View File

@@ -1,4 +1,4 @@
lockfileVersion: '7.0'
lockfileVersion: '9.0'
importers:
package:

View File

@@ -1,4 +1,4 @@
lockfileVersion: '7.0'
lockfileVersion: '9.0'
settings:
autoInstallPeers: true

View File

@@ -1,4 +1,4 @@
lockfileVersion: '7.0'
lockfileVersion: '9.0'
settings:
autoInstallPeers: true

View File

@@ -1,4 +1,4 @@
lockfileVersion: '7.0'
lockfileVersion: '9.0'
settings:
autoInstallPeers: true

View File

@@ -1,4 +1,4 @@
lockfileVersion: '7.0'
lockfileVersion: '9.0'
settings:
autoInstallPeers: true

View File

@@ -1,4 +1,4 @@
lockfileVersion: '7.0'
lockfileVersion: '9.0'
settings:
autoInstallPeers: true

View File

@@ -1,4 +1,4 @@
lockfileVersion: '7.0'
lockfileVersion: '9.0'
settings:
autoInstallPeers: true

View File

@@ -1,4 +1,4 @@
lockfileVersion: '7.0'
lockfileVersion: '9.0'
settings:
autoInstallPeers: true

View File

@@ -1,4 +1,4 @@
lockfileVersion: '7.0'
lockfileVersion: '9.0'
settings:
autoInstallPeers: true

View File

@@ -1,4 +1,4 @@
lockfileVersion: '7.0'
lockfileVersion: '9.0'
settings:
autoInstallPeers: true

View File

@@ -1,4 +1,4 @@
lockfileVersion: '7.0'
lockfileVersion: '9.0'
settings:
autoInstallPeers: true

View File

@@ -1,4 +1,4 @@
lockfileVersion: '7.0'
lockfileVersion: '9.0'
settings:
autoInstallPeers: true

View File

@@ -1,4 +1,4 @@
lockfileVersion: '7.0'
lockfileVersion: '9.0'
importers:

View File

@@ -1 +1 @@
lockfileVersion: '7.0'
lockfileVersion: '9.0'

View File

@@ -1 +1 @@
lockfileVersion: '7.0'
lockfileVersion: '9.0'

View File

@@ -1 +1 @@
lockfileVersion: '7.0'
lockfileVersion: '9.0'

View File

@@ -1,4 +1,4 @@
lockfileVersion: '7.0'
lockfileVersion: '9.0'
importers:

View File

@@ -1,4 +1,4 @@
lockfileVersion: '7.0'
lockfileVersion: '9.0'
importers:

View File

@@ -1,4 +1,4 @@
lockfileVersion: '7.0'
lockfileVersion: '9.0'
settings:
autoInstallPeers: true

View File

@@ -1,4 +1,4 @@
lockfileVersion: '7.0'
lockfileVersion: '9.0'
settings:
autoInstallPeers: true

View File

@@ -1,4 +1,4 @@
lockfileVersion: '7.0'
lockfileVersion: '9.0'
importers:

View File

@@ -1,4 +1,4 @@
lockfileVersion: '7.0'
lockfileVersion: '9.0'
importers:

View File

@@ -1,4 +1,4 @@
lockfileVersion: '7.0'
lockfileVersion: '9.0'
dependencies:
is-positive:

View File

@@ -186,7 +186,7 @@ function convertFromLockfileFileMutable (lockfileFile: LockfileFile): InlineSpec
export function convertToLockfileObject (lockfile: LockfileFile | LockfileFileV7): Lockfile {
if ((lockfile as LockfileFileV7).snapshots) {
return convertLockfileV7ToLockfileObject(lockfile as LockfileFileV7)
return convertLockfileV9ToLockfileObject(lockfile as LockfileFileV7)
}
convertPkgIds(lockfile)
const { importers, ...rest } = convertFromLockfileFileMutable(lockfile)
@@ -268,7 +268,7 @@ function convertPkgIds (lockfile: LockfileFile) {
}
}
export function convertLockfileV7ToLockfileObject (lockfile: LockfileFileV7): Lockfile {
export function convertLockfileV9ToLockfileObject (lockfile: LockfileFileV7): Lockfile {
const { importers, ...rest } = convertFromLockfileFileMutable(lockfile)
const packages: PackageSnapshots = {}

View File

@@ -1,7 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`writeLockfiles() 1`] = `
"lockfileVersion: '7.0'
"lockfileVersion: '9.0'
importers:

View File

@@ -1,4 +1,4 @@
lockfileVersion: '7.0'
lockfileVersion: '9.0'
dependencies:
foo:
version: '1.0.0'

View File

@@ -1,4 +1,4 @@
lockfileVersion: '7.0'
lockfileVersion: '9.0'
dependencies:
is-positive:

View File

@@ -1,4 +1,4 @@
lockfileVersion: '7.0'
lockfileVersion: '9.0'
dependencies:
is-positive:

View File

@@ -2,7 +2,7 @@ import { convertToLockfileFile, convertToLockfileObject } from '../lib/lockfileF
test('convertToLockfileFile()', () => {
const lockfileV5 = {
lockfileVersion: '7.0',
lockfileVersion: '9.0',
importers: {
project1: {
specifiers: {
@@ -39,7 +39,7 @@ test('convertToLockfileFile()', () => {
},
}
const lockfileV6 = {
lockfileVersion: '7.0',
lockfileVersion: '9.0',
importers: {
project1: {
dependencies: {
@@ -93,7 +93,7 @@ test('convertToLockfileFile()', () => {
test('convertToLockfileFile() with lockfile v6', () => {
const lockfileV5 = {
lockfileVersion: '7.0',
lockfileVersion: '9.0',
importers: {
project1: {
specifiers: {
@@ -130,7 +130,7 @@ test('convertToLockfileFile() with lockfile v6', () => {
},
}
const lockfileV6 = {
lockfileVersion: '7.0',
lockfileVersion: '9.0',
importers: {
project1: {
dependencies: {

View File

@@ -18,7 +18,7 @@ test('readWantedLockfile()', async () => {
const lockfile = await readWantedLockfile(path.join('fixtures', '2'), {
ignoreIncompatible: false,
})
expect(lockfile?.lockfileVersion).toEqual('7.0')
expect(lockfile?.lockfileVersion).toEqual('9.0')
expect(lockfile?.importers).toStrictEqual({
'.': {
dependencies: {
@@ -88,7 +88,7 @@ test('writeWantedLockfile()', async () => {
},
},
},
lockfileVersion: '7.0',
lockfileVersion: '9.0',
packages: {
'is-negative@1.0.0': {
dependencies: {
@@ -131,7 +131,7 @@ test('writeCurrentLockfile()', async () => {
},
},
},
lockfileVersion: '7.0',
lockfileVersion: '9.0',
packages: {
'is-negative@1.0.0': {
dependencies: {

View File

@@ -22,7 +22,7 @@ export interface Lockfile {
settings?: LockfileSettings
}
export interface LockfileV7 {
export interface LockfileV9 {
importers: Record<string, ProjectSnapshot>
lockfileVersion: number | string
time?: Record<string, string>

View File

@@ -1,4 +1,4 @@
lockfileVersion: '7.0'
lockfileVersion: '9.0'
dependencies:
karma:

View File

@@ -1,4 +1,4 @@
lockfileVersion: '7.0'
lockfileVersion: '9.0'
settings:
autoInstallPeers: true

View File

@@ -2,7 +2,7 @@ import { lockfileToDepGraph } from '@pnpm/calc-dep-state'
test('lockfileToDepGraph', () => {
expect(lockfileToDepGraph({
lockfileVersion: '7.0',
lockfileVersion: '9.0',
importers: {},
packages: {
'foo@1.0.0': {

View File

@@ -1,5 +1,6 @@
export const WANTED_LOCKFILE = 'pnpm-lock.yaml'
export const LOCKFILE_VERSION = '7.0'
export const LOCKFILE_MAJOR_VERSION = '9'
export const LOCKFILE_VERSION = `${LOCKFILE_MAJOR_VERSION}.0`
export const LOCKFILE_VERSION_V6 = '6.0'
export const ENGINE_NAME = `${process.platform}-${process.arch}-node-${process.version.split('.')[0]}`

View File

@@ -1,4 +1,4 @@
lockfileVersion: '7.0'
lockfileVersion: '9.0'
settings:
autoInstallPeers: true

View File

@@ -5,6 +5,7 @@ import { createAllowBuildFunction } from '@pnpm/builder.policy'
import {
LAYOUT_VERSION,
LOCKFILE_VERSION,
LOCKFILE_MAJOR_VERSION,
LOCKFILE_VERSION_V6,
WANTED_LOCKFILE,
} from '@pnpm/constants'
@@ -351,7 +352,7 @@ export async function mutateModules (
}
let needsFullResolution = outdatedLockfileSettings ||
opts.fixLockfile ||
!ctx.wantedLockfile.lockfileVersion.toString().startsWith('7.') ||
!ctx.wantedLockfile.lockfileVersion.toString().startsWith(`${LOCKFILE_MAJOR_VERSION}.`) ||
opts.forceFullResolution
if (needsFullResolution) {
ctx.wantedLockfile.settings = {

View File

@@ -4,7 +4,7 @@ import { prepareEmpty, preparePackages } from '@pnpm/prepare'
import { install, type MutatedProject, mutateModules } from '@pnpm/core'
import { sync as writeYamlFile } from 'write-yaml-file'
import { sync as readYamlFile } from 'read-yaml-file'
import { type LockfileV7 as Lockfile, type PackageSnapshots } from '@pnpm/lockfile-file'
import { type LockfileV9 as Lockfile, type PackageSnapshots } from '@pnpm/lockfile-file'
import { testDefaults } from '../utils'
test('fix broken lockfile with --fix-lockfile', async () => {

View File

@@ -1,7 +1,7 @@
import fs from 'fs'
import path from 'path'
import { LOCKFILE_VERSION } from '@pnpm/constants'
import { type LockfileV7 as Lockfile } from '@pnpm/lockfile-file'
import { type LockfileV9 as Lockfile } from '@pnpm/lockfile-file'
import { prepareEmpty, preparePackages } from '@pnpm/prepare'
import { addDistTag } from '@pnpm/registry-mock'
import { fixtures } from '@pnpm/test-fixtures'

View File

@@ -1,6 +1,6 @@
import fs from 'fs'
import path from 'path'
import { type LockfileV7 as Lockfile } from '@pnpm/lockfile-file'
import { type LockfileV9 as Lockfile } from '@pnpm/lockfile-file'
import { prepareEmpty, preparePackages } from '@pnpm/prepare'
import deepRequireCwd from 'deep-require-cwd'
import { sync as readYamlFile } from 'read-yaml-file'

View File

@@ -1,7 +1,7 @@
import fs from 'fs'
import path from 'path'
import { WANTED_LOCKFILE } from '@pnpm/constants'
import { type LockfileV7 as Lockfile } from '@pnpm/lockfile-file'
import { type LockfileV9 as Lockfile } from '@pnpm/lockfile-file'
import { prepareEmpty, preparePackages } from '@pnpm/prepare'
import { addDistTag, REGISTRY_MOCK_PORT } from '@pnpm/registry-mock'
import { fixtures } from '@pnpm/test-fixtures'

View File

@@ -1,6 +1,6 @@
import path from 'path'
import { WANTED_LOCKFILE } from '@pnpm/constants'
import { type LockfileV7 as Lockfile } from '@pnpm/lockfile-file'
import { type LockfileV9 as Lockfile } from '@pnpm/lockfile-file'
import { prepareEmpty } from '@pnpm/prepare'
import { addDistTag } from '@pnpm/registry-mock'
import { sync as readYamlFile } from 'read-yaml-file'

View File

@@ -1,4 +1,4 @@
lockfileVersion: '7.0'
lockfileVersion: '9.0'
settings:
autoInstallPeers: true

View File

@@ -1,4 +1,4 @@
lockfileVersion: '7.0'
lockfileVersion: '9.0'
settings:
autoInstallPeers: true

View File

@@ -1,4 +1,4 @@
lockfileVersion: '7.0'
lockfileVersion: '9.0'
settings:
autoInstallPeers: true

View File

@@ -1,4 +1,4 @@
lockfileVersion: '7.0'
lockfileVersion: '9.0'
settings:
autoInstallPeers: true

View File

@@ -1,4 +1,4 @@
lockfileVersion: '7.0'
lockfileVersion: '9.0'
settings:
autoInstallPeers: true

View File

@@ -1,4 +1,4 @@
lockfileVersion: '7.0'
lockfileVersion: '9.0'
settings:
autoInstallPeers: true

View File

@@ -1,4 +1,4 @@
lockfileVersion: '7.0'
lockfileVersion: '9.0'
settings:
autoInstallPeers: true

View File

@@ -1,4 +1,4 @@
lockfileVersion: '7.0'
lockfileVersion: '9.0'
settings:
autoInstallPeers: true

View File

@@ -1,4 +1,4 @@
lockfileVersion: '7.0'
lockfileVersion: '9.0'
settings:
autoInstallPeers: true

View File

@@ -1,4 +1,4 @@
lockfileVersion: '7.0'
lockfileVersion: '9.0'
settings:
autoInstallPeers: true

View File

@@ -1,4 +1,4 @@
lockfileVersion: '7.0'
lockfileVersion: '9.0'
settings:
autoInstallPeers: true

View File

@@ -1,4 +1,4 @@
lockfileVersion: '7.0'
lockfileVersion: '9.0'
settings:
autoInstallPeers: true

View File

@@ -1,4 +1,4 @@
lockfileVersion: '7.0'
lockfileVersion: '9.0'
settings:
autoInstallPeers: false

View File

@@ -1,4 +1,4 @@
lockfileVersion: '7.0'
lockfileVersion: '9.0'
settings:
autoInstallPeers: true

View File

@@ -1,4 +1,4 @@
lockfileVersion: '7.0'
lockfileVersion: '9.0'
settings:
autoInstallPeers: true

View File

@@ -1,4 +1,4 @@
lockfileVersion: '7.0'
lockfileVersion: '9.0'
settings:
autoInstallPeers: false

View File

@@ -1,4 +1,4 @@
lockfileVersion: '7.0'
lockfileVersion: '9.0'
settings:
autoInstallPeers: true

View File

@@ -1,4 +1,4 @@
lockfileVersion: '7.0'
lockfileVersion: '9.0'
settings:
autoInstallPeers: true

View File

@@ -1,4 +1,4 @@
lockfileVersion: '7.0'
lockfileVersion: '9.0'
settings:
autoInstallPeers: true

View File

@@ -1,4 +1,4 @@
lockfileVersion: '7.0'
lockfileVersion: '9.0'
settings:
autoInstallPeers: true

View File

@@ -1,4 +1,4 @@
lockfileVersion: '7.0'
lockfileVersion: '9.0'
importers:

View File

@@ -1,4 +1,4 @@
lockfileVersion: '7.0'
lockfileVersion: '9.0'
settings:
autoInstallPeers: true

View File

@@ -15,7 +15,7 @@ exports[`pnpm dedupe updates old resolutions from importers block and removes ol
},
@@ -20,31 +20,16 @@
},
"lockfileVersion": "7.0",
"lockfileVersion": "9.0",
"packages": Object {
- "ajv@6.10.2": Object {
- "resolution": Object {
@@ -116,7 +116,7 @@ exports[`pnpm dedupe updates old resolutions from package block 1`] = `
@@ -20,14 +20,6 @@
},
"lockfileVersion": "7.0",
"lockfileVersion": "9.0",
"packages": Object {
- "punycode@2.1.1": Object {
- "engines": Object {

13
pnpm-lock.yaml generated
View File

@@ -6360,7 +6360,7 @@ importers:
version: link:../fs/symlink-dependency
'@rushstack/worker-pool':
specifier: 0.4.9
version: 0.4.9(@types/node@20.11.30)
version: 0.4.9(@types/node@18.19.26)
load-json-file:
specifier: ^6.2.0
version: 6.2.0
@@ -7891,9 +7891,6 @@ packages:
'@types/node@18.19.26':
resolution: {integrity: sha512-+wiMJsIwLOYCvUqSdKTrfkS8mpTp+MPINe6+Np4TAGFWWRWiBQ5kSq9nZGCSPkzx9mvT+uEukzpX4MOSCydcvw==}
'@types/node@20.11.30':
resolution: {integrity: sha512-dHM6ZxwlmuZaRmUPfv1p+KrdD1Dci04FbdEm/9wEMouFqxYoFl5aMkt0VMAUtYRQDyYvD41WJLukhq/ha3YuTw==}
'@types/node@20.5.1':
resolution: {integrity: sha512-4tT2UrL5LBqDwoed9wZ6N3umC4Yhz3W3FloMmiiG4JwmUJWpie0c7lcnUNd4gtMKuDEO4wRVS8B6Xa0uMRsMKg==}
@@ -14475,9 +14472,9 @@ snapshots:
'@reflink/reflink-win32-arm64-msvc': 0.1.16
'@reflink/reflink-win32-x64-msvc': 0.1.16
'@rushstack/worker-pool@0.4.9(@types/node@20.11.30)':
'@rushstack/worker-pool@0.4.9(@types/node@18.19.26)':
dependencies:
'@types/node': 20.11.30
'@types/node': 18.19.26
'@sinclair/typebox@0.27.8': {}
@@ -14663,10 +14660,6 @@ snapshots:
dependencies:
undici-types: 5.26.5
'@types/node@20.11.30':
dependencies:
undici-types: 5.26.5
'@types/node@20.5.1': {}
'@types/normalize-package-data@2.4.4': {}

View File

@@ -5,7 +5,7 @@
### Major Changes
- Node.js v16 support dropped. Use at least Node.js v18.12.
- Lockfile version bumped to v7.
- Lockfile version bumped to v9.
- Support for lockfile v5 is dropped. Use pnpm v8 to convert lockfile v5 to lockfile v6 [#7470](https://github.com/pnpm/pnpm/pull/7470).
- The [`dedupe-injected-deps`](https://pnpm.io/npmrc#dedupe-injected-deps) setting is `true` by default.
- The default value of the `link-workspace-packages` setting changed from `true` to `false`. This means that by default, dependencies will be linked from workspace packages only when they are specified using the [workspace protocol](https://pnpm.io/workspaces#workspace-protocol-workspace).

View File

@@ -1,6 +1,6 @@
import fs from 'fs'
import path from 'path'
import { type LockfileV7 as Lockfile } from '@pnpm/lockfile-types'
import { type LockfileV9 as Lockfile } from '@pnpm/lockfile-types'
import { prepare, preparePackages } from '@pnpm/prepare'
import { sync as readYamlFile } from 'read-yaml-file'
import loadJsonFile from 'load-json-file'

View File

@@ -1,7 +1,7 @@
import fs from 'fs'
import path from 'path'
import { WANTED_LOCKFILE } from '@pnpm/constants'
import { type LockfileV7 as Lockfile } from '@pnpm/lockfile-types'
import { type LockfileV9 as Lockfile } from '@pnpm/lockfile-types'
import { preparePackages } from '@pnpm/prepare'
import { addDistTag } from '@pnpm/registry-mock'
import { sync as readYamlFile } from 'read-yaml-file'

View File

@@ -1,6 +1,6 @@
import fs from 'fs'
import { WANTED_LOCKFILE } from '@pnpm/constants'
import { type LockfileV7 as Lockfile } from '@pnpm/lockfile-types'
import { type LockfileV9 as Lockfile } from '@pnpm/lockfile-types'
import { preparePackages } from '@pnpm/prepare'
import { sync as readYamlFile } from 'read-yaml-file'
import { sync as writeYamlFile } from 'write-yaml-file'

View File

@@ -1,7 +1,7 @@
import fs from 'fs'
import path from 'path'
import { prepare, preparePackages } from '@pnpm/prepare'
import { type LockfileV7 as Lockfile } from '@pnpm/lockfile-types'
import { type LockfileV9 as Lockfile } from '@pnpm/lockfile-types'
import { sync as readYamlFile } from 'read-yaml-file'
import { isCI } from 'ci-info'
import isWindows from 'is-windows'

View File

@@ -1,4 +1,4 @@
lockfileVersion: '7.0'
lockfileVersion: '9.0'
settings:
autoInstallPeers: true

View File

@@ -1,4 +1,4 @@
lockfileVersion: '7.0'
lockfileVersion: '9.0'
settings:
autoInstallPeers: true

View File

@@ -1,4 +1,4 @@
lockfileVersion: '7.0'
lockfileVersion: '9.0'
settings:
autoInstallPeers: true

View File

@@ -1,4 +1,4 @@
lockfileVersion: '7.0'
lockfileVersion: '9.0'
settings:
autoInstallPeers: true

View File

@@ -1,4 +1,4 @@
lockfileVersion: '7.0'
lockfileVersion: '9.0'
settings:
autoInstallPeers: true

View File

@@ -1,4 +1,4 @@
lockfileVersion: '7.0'
lockfileVersion: '9.0'
settings:
autoInstallPeers: true

View File

@@ -1,4 +1,4 @@
lockfileVersion: '7.0'
lockfileVersion: '9.0'
settings:
autoInstallPeers: true

View File

@@ -1,4 +1,4 @@
lockfileVersion: '7.0'
lockfileVersion: '9.0'
settings:
autoInstallPeers: true

View File

@@ -1,4 +1,4 @@
lockfileVersion: '7.0'
lockfileVersion: '9.0'
settings:
autoInstallPeers: true

View File

@@ -1,4 +1,4 @@
lockfileVersion: '7.0'
lockfileVersion: '9.0'
settings:
autoInstallPeers: true

View File

@@ -1,4 +1,4 @@
lockfileVersion: '7.0'
lockfileVersion: '9.0'
settings:
autoInstallPeers: true