mirror of
https://github.com/pnpm/pnpm.git
synced 2026-04-11 02:29:48 -04:00
fix: use shorter temp file name for the index files (#6863)
close #6842 Co-authored-by: David Michon <dmichon@microsoft.com>
This commit is contained in:
6
.changeset/four-penguins-buy.md
Normal file
6
.changeset/four-penguins-buy.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
"@pnpm/package-requester": patch
|
||||
"pnpm": patch
|
||||
---
|
||||
|
||||
The length of the temporary file names in the content-addressable store reduced in order to prevent `ENAMETOOLONG` errors from happening [#6842](https://github.com/pnpm/pnpm/issues/6842).
|
||||
@@ -52,7 +52,6 @@
|
||||
"p-limit": "^3.1.0",
|
||||
"p-map-values": "^1.0.0",
|
||||
"p-queue": "^6.6.2",
|
||||
"path-temp": "^2.1.0",
|
||||
"promise-share": "^1.0.0",
|
||||
"ramda": "npm:@pnpm/ramda@0.28.1",
|
||||
"safe-promise-defer": "^1.0.1",
|
||||
|
||||
@@ -49,7 +49,6 @@ import pMapValues from 'p-map-values'
|
||||
import PQueue from 'p-queue'
|
||||
import loadJsonFile from 'load-json-file'
|
||||
import pDefer from 'p-defer'
|
||||
import { fastPathTemp as pathTemp } from 'path-temp'
|
||||
import pShare from 'promise-share'
|
||||
import pick from 'ramda/src/pick'
|
||||
import semver from 'semver'
|
||||
@@ -656,7 +655,9 @@ async function writeJsonFile (filePath: string, data: unknown) {
|
||||
// There is actually no need to create the directory in 99% of cases.
|
||||
// So by using cafs API, we'll improve performance.
|
||||
await fs.mkdir(targetDir, { recursive: true })
|
||||
const temp = pathTemp(filePath)
|
||||
// We remove the "-index.json" from the end of the temp file name
|
||||
// in order to avoid ENAMETOOLONG errors
|
||||
const temp = `${filePath.slice(0, -11)}${process.pid}`
|
||||
await gfs.writeFile(temp, JSON.stringify(data))
|
||||
await optimisticRenameOverwrite(temp, filePath)
|
||||
}
|
||||
|
||||
3
pnpm-lock.yaml
generated
3
pnpm-lock.yaml
generated
@@ -3633,9 +3633,6 @@ importers:
|
||||
p-queue:
|
||||
specifier: ^6.6.2
|
||||
version: 6.6.2
|
||||
path-temp:
|
||||
specifier: ^2.1.0
|
||||
version: 2.1.0
|
||||
promise-share:
|
||||
specifier: ^1.0.0
|
||||
version: 1.0.0
|
||||
|
||||
Reference in New Issue
Block a user