mirror of
https://github.com/pnpm/pnpm.git
synced 2025-12-24 15:48:06 -05:00
feat!: bump store version to v10 (#8709)
This commit is contained in:
6
.changeset/wise-buses-roll.md
Normal file
6
.changeset/wise-buses-roll.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
"@pnpm/constants": major
|
||||
"pnpm": major
|
||||
---
|
||||
|
||||
Store version bumped to v10. The new store layout has a different directory called "index" for storing the package content mappings. Previously these files were stored in the same directory where the package contents are (in "files"). The new store has also a new format for storing the mappings for side-effects cache.
|
||||
@@ -37,6 +37,7 @@
|
||||
"@pnpm/logger": "^5.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@pnpm/constants": "workspace:*",
|
||||
"@pnpm/logger": "workspace:*",
|
||||
"@pnpm/mount-modules": "workspace:*",
|
||||
"@types/normalize-path": "catalog:",
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { STORE_VERSION } from '@pnpm/constants'
|
||||
import path from 'path'
|
||||
|
||||
jest.mock('fuse-native', () => ({ ENOENT: -2 }))
|
||||
@@ -11,7 +12,7 @@ describe('FUSE handlers', () => {
|
||||
let handlers: FuseHandlers
|
||||
beforeAll(async () => {
|
||||
const fixture = path.join(__dirname, '__fixtures__/simple')
|
||||
handlers = await createFuseHandlers(fixture, path.join(fixture, 'store/v3'))
|
||||
handlers = await createFuseHandlers(fixture, path.join(fixture, 'store', STORE_VERSION))
|
||||
})
|
||||
|
||||
it('readdir', () => {
|
||||
|
||||
@@ -18,6 +18,9 @@
|
||||
{
|
||||
"path": "../../lockfile/utils"
|
||||
},
|
||||
{
|
||||
"path": "../../packages/constants"
|
||||
},
|
||||
{
|
||||
"path": "../../packages/dependency-path"
|
||||
},
|
||||
|
||||
@@ -5,7 +5,7 @@ export const LOCKFILE_VERSION_V6 = '6.0'
|
||||
|
||||
export const ENGINE_NAME = `${process.platform};${process.arch};node${process.version.split('.')[0].substring(1)}`
|
||||
export const LAYOUT_VERSION = 5
|
||||
export const STORE_VERSION = 'v3'
|
||||
export const STORE_VERSION = 'v10'
|
||||
|
||||
export const WORKSPACE_MANIFEST_FILENAME = 'pnpm-workspace.yaml'
|
||||
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
import path from 'path'
|
||||
import { prepareEmpty } from '@pnpm/prepare'
|
||||
import { addDependenciesToPackage, install } from '@pnpm/core'
|
||||
import { sync as rimraf } from '@zkochan/rimraf'
|
||||
import writeJsonFile from 'write-json-file'
|
||||
import { testDefaults } from '../utils'
|
||||
|
||||
test('repeat install with corrupted `store.json` should work', async () => {
|
||||
const project = prepareEmpty()
|
||||
|
||||
const opts = testDefaults()
|
||||
const manifest = await addDependenciesToPackage({}, ['is-negative@1.0.0'], opts)
|
||||
|
||||
rimraf('node_modules')
|
||||
|
||||
// When a package reference is missing from `store.json`
|
||||
// we assume that it is not in the store.
|
||||
// The package is downloaded and in case there is a folder
|
||||
// in the store, it is overwritten.
|
||||
writeJsonFile.sync(path.join(opts.storeDir, 'v3/store.json'), {})
|
||||
|
||||
await install(manifest, opts)
|
||||
|
||||
project.has('is-negative')
|
||||
})
|
||||
@@ -1,6 +1,7 @@
|
||||
import fs from 'fs'
|
||||
import delay from 'delay'
|
||||
import path from 'path'
|
||||
import { STORE_VERSION } from '@pnpm/constants'
|
||||
import { add, install } from '@pnpm/plugin-commands-installation'
|
||||
import { prepare, prepareEmpty } from '@pnpm/prepare'
|
||||
import { sync as rimraf } from '@zkochan/rimraf'
|
||||
@@ -41,7 +42,7 @@ test('install with no store integrity validation', async () => {
|
||||
// We should have a short delay before modifying the file in the store.
|
||||
// Otherwise pnpm will not consider it to be modified.
|
||||
await delay(200)
|
||||
const readmePath = path.join(DEFAULT_OPTS.storeDir, 'v3/files/9a/f6af85f55c111108eddf1d7ef7ef224b812e7c7bfabae41c79cf8bc9a910352536963809463e0af2799abacb975f22418a35a1d170055ef3fdc3b2a46ef1c5')
|
||||
const readmePath = path.join(DEFAULT_OPTS.storeDir, STORE_VERSION, 'files/9a/f6af85f55c111108eddf1d7ef7ef224b812e7c7bfabae41c79cf8bc9a910352536963809463e0af2799abacb975f22418a35a1d170055ef3fdc3b2a46ef1c5')
|
||||
fs.writeFileSync(readmePath, 'modified', 'utf8')
|
||||
|
||||
rimraf('node_modules')
|
||||
|
||||
3
pnpm-lock.yaml
generated
3
pnpm-lock.yaml
generated
@@ -3501,6 +3501,9 @@ importers:
|
||||
specifier: 'catalog:'
|
||||
version: 2.2.6
|
||||
devDependencies:
|
||||
'@pnpm/constants':
|
||||
specifier: workspace:*
|
||||
version: link:../../packages/constants
|
||||
'@pnpm/mount-modules':
|
||||
specifier: workspace:*
|
||||
version: 'link:'
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import fs from 'fs'
|
||||
import path from 'path'
|
||||
import { STORE_VERSION } from '@pnpm/constants'
|
||||
import { prepare, preparePackages } from '@pnpm/prepare'
|
||||
import { type LockfileV9 as Lockfile } from '@pnpm/lockfile.types'
|
||||
import { sync as readYamlFile } from 'read-yaml-file'
|
||||
@@ -122,7 +123,7 @@ skipOnWindows('recursive installation using server', async () => {
|
||||
const storeDir = path.resolve('store')
|
||||
spawnPnpm(['server', 'start'], { storeDir })
|
||||
|
||||
const serverJsonPath = path.resolve(storeDir, 'v3/server/server.json')
|
||||
const serverJsonPath = path.resolve(storeDir, STORE_VERSION, 'server/server.json')
|
||||
const serverJson = await retryLoadJsonFile<{ connectionOptions: object }>(serverJsonPath)
|
||||
expect(serverJson).toBeTruthy()
|
||||
expect(serverJson.connectionOptions).toBeTruthy()
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import os from 'os'
|
||||
import path from 'path'
|
||||
import { STORE_VERSION } from '@pnpm/constants'
|
||||
import { store } from '@pnpm/plugin-commands-store'
|
||||
import { prepare } from '@pnpm/prepare'
|
||||
import { REGISTRY_MOCK_PORT } from '@pnpm/registry-mock'
|
||||
@@ -24,8 +25,8 @@ test('CLI prints the current store path', async () => {
|
||||
}, ['path'])
|
||||
|
||||
const expectedStorePath = os.platform() === 'win32'
|
||||
? '\\home\\example\\.pnpm-store\\v3'
|
||||
: '/home/example/.pnpm-store/v3'
|
||||
? `\\home\\example\\.pnpm-store\\${STORE_VERSION}`
|
||||
: `/home/example/.pnpm-store/${STORE_VERSION}`
|
||||
|
||||
expect(candidateStorePath).toBe(expectedStorePath)
|
||||
})
|
||||
|
||||
@@ -214,7 +214,7 @@ test('prune does not fail if the store contains an unexpected directory', async
|
||||
await execa('node', [pnpmBin, 'add', 'is-negative@2.1.0', '--store-dir', storeDir, '--registry', REGISTRY])
|
||||
|
||||
project.storeHas('is-negative', '2.1.0')
|
||||
const alienDir = path.join(storeDir, 'v3/files/44/directory')
|
||||
const alienDir = path.join(storeDir, STORE_VERSION, 'files/44/directory')
|
||||
fs.mkdirSync(alienDir)
|
||||
|
||||
const reporter = jest.fn()
|
||||
@@ -252,7 +252,7 @@ test('prune removes alien files from the store if the --force flag is used', asy
|
||||
await execa('node', [pnpmBin, 'add', 'is-negative@2.1.0', '--store-dir', storeDir, '--registry', REGISTRY])
|
||||
|
||||
project.storeHas('is-negative', '2.1.0')
|
||||
const alienDir = path.join(storeDir, 'v3/files/44/directory')
|
||||
const alienDir = path.join(storeDir, STORE_VERSION, 'files/44/directory')
|
||||
fs.mkdirSync(alienDir)
|
||||
|
||||
const reporter = jest.fn()
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { STORE_VERSION } from '@pnpm/constants'
|
||||
import { getStorePath } from '@pnpm/store-path'
|
||||
import isWindows from 'is-windows'
|
||||
|
||||
@@ -10,21 +11,21 @@ skipOnWindows('when a link can be created to the homedir', async () => {
|
||||
expect(await getStorePath({
|
||||
pkgRoot: '/can-link-to-homedir',
|
||||
pnpmHomeDir: '/local/share/pnpm',
|
||||
})).toBe('/local/share/pnpm/store/v3')
|
||||
})).toBe(`/local/share/pnpm/store/${STORE_VERSION}`)
|
||||
})
|
||||
|
||||
skipOnWindows('a link can be created to the root of the drive', async () => {
|
||||
expect(await getStorePath({
|
||||
pkgRoot: '/src/workspace/project',
|
||||
pnpmHomeDir: '/local/share/pnpm',
|
||||
})).toBe('/.pnpm-store/v3')
|
||||
})).toBe(`/.pnpm-store/${STORE_VERSION}`)
|
||||
})
|
||||
|
||||
skipOnWindows('a link can be created to the a subdir in the root of the drive', async () => {
|
||||
expect(await getStorePath({
|
||||
pkgRoot: '/mnt/project',
|
||||
pnpmHomeDir: '/local/share/pnpm',
|
||||
})).toBe('/mnt/.pnpm-store/v3')
|
||||
})).toBe(`/mnt/.pnpm-store/${STORE_VERSION}`)
|
||||
})
|
||||
|
||||
test('fail when pnpm home directory is not defined', async () => {
|
||||
|
||||
Reference in New Issue
Block a user