mirror of
https://github.com/pnpm/pnpm.git
synced 2026-03-30 04:52:04 -04:00
fix: issues with storybook and the new lockfile format (#5998)
close #5976
This commit is contained in:
6
.changeset/strong-poets-juggle.md
Normal file
6
.changeset/strong-poets-juggle.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
"@pnpm/dependency-path": patch
|
||||
"pnpm": patch
|
||||
---
|
||||
|
||||
Directories inside the virtual store should not contain the ( or ) chars. This is to fix issues with storybook and the new v6 `pnpm-lock.yaml` lockfile format [#5976](https://github.com/pnpm/pnpm/issues/5976).
|
||||
@@ -143,7 +143,12 @@ export function parse (dependencyPath: string) {
|
||||
}
|
||||
|
||||
export function depPathToFilename (depPath: string) {
|
||||
const filename = depPathToFilenameUnescaped(depPath).replace(/[\\/:*?"<>|]/g, '+')
|
||||
let filename = depPathToFilenameUnescaped(depPath).replace(/[\\/:*?"<>|]/g, '+')
|
||||
if (filename.includes('(')) {
|
||||
filename = filename
|
||||
.replace(/(\)\()|\(/g, '_')
|
||||
.replace(/\)$/, '')
|
||||
}
|
||||
if (filename.length > 120 || filename !== filename.toLowerCase() && !filename.startsWith('file+')) {
|
||||
return `${filename.substring(0, 50)}_${createBase32Hash(filename)}`
|
||||
}
|
||||
|
||||
@@ -154,6 +154,7 @@ test('depPathToFilename()', () => {
|
||||
expect(depPathToFilename('/@foo/bar/1.0.0')).toBe('@foo+bar@1.0.0')
|
||||
expect(depPathToFilename('github.com/something/foo/0000?v=1')).toBe('github.com+something+foo@0000+v=1')
|
||||
expect(depPathToFilename('\\//:*?"<>|')).toBe('++@+++++++')
|
||||
expect(depPathToFilename('/foo/1.0.0(react@16.0.0)(react-dom@16.0.0)')).toBe('foo@1.0.0_react@16.0.0_react-dom@16.0.0')
|
||||
|
||||
const filename = depPathToFilename('file:test/foo-1.0.0.tgz_foo@2.0.0')
|
||||
expect(filename).toBe('file+test+foo-1.0.0.tgz_foo@2.0.0')
|
||||
|
||||
Reference in New Issue
Block a user