fix: issues with storybook and the new lockfile format (#5998)
close #5976
This commit is contained in:
1 parent
587c4a2bb6
commit
9247f6781b
3 files changed
+13
-1
No files matched your search
@@ -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